Merge branch 'dev' of gitea.larke.org:kevin/libcw into dev

This commit is contained in:
kevin 2024-03-25 14:32:21 -04:00
commit 6b2a3db3f0
7 changed files with 37 additions and 4 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -71,6 +71,8 @@ namespace cw
bool is_empty( handle_t h );
unsigned count( handle_t h );
rc_t test( const object_t* cfg );
}

View File

@ -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);
}

3
cwUi.h
View File

@ -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

View File

@ -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));
}

View File

@ -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 );
}