1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #2194, Support ST yield

This commit is contained in:
winlin 2021-02-11 21:14:45 +08:00
parent 8d9af57cfa
commit 76d6449317
3 changed files with 11 additions and 2 deletions

View file

@ -115,8 +115,10 @@ SrsPps* _srs_pps_timer_s = new SrsPps(_srs_clock);
extern int _st_active_count;
extern unsigned long long _st_stat_thread_run;
extern unsigned long long _st_stat_thread_idle;
extern unsigned long long _st_stat_thread_yield;
SrsPps* _srs_pps_thread_run = new SrsPps(_srs_clock);
SrsPps* _srs_pps_thread_idle = new SrsPps(_srs_clock);
SrsPps* _srs_pps_thread_yield = new SrsPps(_srs_clock);
ISrsHybridServer::ISrsHybridServer()
{
@ -428,8 +430,9 @@ srs_error_t SrsHybridServer::notify(int event, srs_utime_t interval, srs_utime_t
string thread_desc;
_srs_pps_thread_run->update(_st_stat_thread_run); _srs_pps_thread_idle->update(_st_stat_thread_idle);
if (_st_active_count > 0 || _srs_pps_thread_run->r10s() || _srs_pps_thread_idle->r10s()) {
snprintf(buf, sizeof(buf), ", co=%d,%d,%d", _st_active_count, _srs_pps_thread_run->r10s(), _srs_pps_thread_idle->r10s());
_srs_pps_thread_yield->update(_st_stat_thread_yield);
if (_st_active_count > 0 || _srs_pps_thread_run->r10s() || _srs_pps_thread_idle->r10s() || _srs_pps_thread_yield->r10s()) {
snprintf(buf, sizeof(buf), ", co=%d,%d,%d,%d", _st_active_count, _srs_pps_thread_run->r10s(), _srs_pps_thread_idle->r10s(), _srs_pps_thread_yield->r10s());
thread_desc = buf;
}