diff --git a/cwIo.cpp b/cwIo.cpp index 9e551f3..c00f79a 100644 --- a/cwIo.cpp +++ b/cwIo.cpp @@ -2497,7 +2497,7 @@ void cw::io::realTimeReport( handle_t h ) { io_t* p = _handleToPtr(h); audio::device::realTimeReport(p->audioH); - + uiRealTimeReport(h); } @@ -3957,8 +3957,8 @@ void cw::io::uiReport( handle_t h ) void cw::io::uiRealTimeReport( handle_t h ) { - ui::handle_t uiH; - if(_handleToUiHandle(h,uiH) == kOkRC ) - ui::realTimeReport(uiH); + ui::ws::handle_t uiH; + if(_handleToWsUiHandle(h,uiH) == kOkRC ) + ui::ws::realTimeReport(uiH); } diff --git a/cwNbMpScQueue.cpp b/cwNbMpScQueue.cpp index 2940b8f..70fbb1d 100644 --- a/cwNbMpScQueue.cpp +++ b/cwNbMpScQueue.cpp @@ -408,6 +408,18 @@ bool cw::nbmpscq::is_empty( handle_t h ) return next == nullptr; } +unsigned cw::nbmpscq::count( handle_t h ) +{ + nbmpscq_t* p = _handleToPtr(h); + + block_t* b = p->blockL; + int eleN = 0; + for(; b!=nullptr; b=b->link) + eleN += b->eleN.load(std::memory_order_acquire); + + return eleN; +} + cw::rc_t cw::nbmpscq::test( const object_t* cfg ) { rc_t rc=kOkRC,rc0,rc1; diff --git a/cwNbMpScQueue.h b/cwNbMpScQueue.h index ac3dbf2..fe6c13e 100644 --- a/cwNbMpScQueue.h +++ b/cwNbMpScQueue.h @@ -71,6 +71,8 @@ namespace cw bool is_empty( handle_t h ); + unsigned count( handle_t h ); + rc_t test( const object_t* cfg ); } diff --git a/cwUi.cpp b/cwUi.cpp index 509fbc7..a744f31 100644 --- a/cwUi.cpp +++ b/cwUi.cpp @@ -2216,6 +2216,7 @@ void cw::ui::realTimeReport( handle_t h ) { ui_t* p = _handleToPtr(h); printf("UI msg count: recv:%i send:%i\n",p->recvMsgN,p->sentMsgN); + } @@ -2504,6 +2505,12 @@ cw::ui::handle_t cw::ui::ws::uiHandle( handle_t h ) return p->uiH; } +void cw::ui::ws::realTimeReport( handle_t h ) +{ + ui_ws_t* p = _handleToPtr(h); + report(p->wsH); + realTimeReport(p->uiH); +} namespace cw @@ -2674,3 +2681,4 @@ cw::ui::handle_t cw::ui::srv::uiHandle( handle_t h ) ui_ws_srv_t* p = _handleToPtr(h); return ws::uiHandle(p->wsUiH); } + diff --git a/cwUi.h b/cwUi.h index 7bbf535..e4077e4 100644 --- a/cwUi.h +++ b/cwUi.h @@ -236,6 +236,9 @@ namespace cw websock::handle_t websockHandle( handle_t h ); ui::handle_t uiHandle( handle_t h ); + + void realTimeReport( handle_t h ); + } namespace srv diff --git a/cwWebSock.cpp b/cwWebSock.cpp index 6382066..7411b07 100644 --- a/cwWebSock.cpp +++ b/cwWebSock.cpp @@ -785,3 +785,9 @@ cw::rc_t cw::websock::exec( handle_t h, unsigned timeOutMs ) return rc; } + +void cw::websock::report( handle_t h ) +{ + websock_t* p = _handleToPtr(h); + printf("Websock: msgs sent:%i recvd:%i que count:%i\n",p->_sendMsgCnt,p->_recvMsgCnt,count(p->_qH)); +} diff --git a/cwWebSock.h b/cwWebSock.h index e87fb04..de6dece 100644 --- a/cwWebSock.h +++ b/cwWebSock.h @@ -56,6 +56,8 @@ namespace cw // Call periodically from the same thread to send/recv messages. rc_t exec( handle_t h, unsigned timeOutMs ); + + void report( handle_t h ); }