diff --git a/trunk/src/app/srs_app_hybrid.cpp b/trunk/src/app/srs_app_hybrid.cpp index 941fef02b..cecd3a2e0 100644 --- a/trunk/src/app/srs_app_hybrid.cpp +++ b/trunk/src/app/srs_app_hybrid.cpp @@ -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; } diff --git a/trunk/src/protocol/srs_service_st.cpp b/trunk/src/protocol/srs_service_st.cpp index 99cf856af..a4189dd8e 100644 --- a/trunk/src/protocol/srs_service_st.cpp +++ b/trunk/src/protocol/srs_service_st.cpp @@ -156,6 +156,11 @@ void srs_thread_exit(void* retval) st_thread_exit(retval); } +void srs_thread_yield() +{ + st_thread_yield(); +} + srs_error_t srs_tcp_connect(string server, int port, srs_utime_t tm, srs_netfd_t* pstfd) { st_utime_t timeout = ST_UTIME_NO_TIMEOUT; diff --git a/trunk/src/protocol/srs_service_st.hpp b/trunk/src/protocol/srs_service_st.hpp index 263bb5104..bcad9c8b9 100644 --- a/trunk/src/protocol/srs_service_st.hpp +++ b/trunk/src/protocol/srs_service_st.hpp @@ -58,6 +58,7 @@ extern srs_error_t srs_fd_keepalive(int fd); // Get current coroutine/thread. extern srs_thread_t srs_thread_self(); extern void srs_thread_exit(void* retval); +extern void srs_thread_yield(); // For client, to open socket and connect to server. // @param tm The timeout in srs_utime_t.