|
|
|
@ -25,21 +25,21 @@ extern SrsPps* _srs_pps_conn;
|
|
|
|
|
extern SrsPps* _srs_pps_dispose;
|
|
|
|
|
|
|
|
|
|
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
|
|
|
|
extern unsigned long long _st_stat_recvfrom;
|
|
|
|
|
extern unsigned long long _st_stat_recvfrom_eagain;
|
|
|
|
|
extern unsigned long long _st_stat_sendto;
|
|
|
|
|
extern unsigned long long _st_stat_sendto_eagain;
|
|
|
|
|
extern __thread unsigned long long _st_stat_recvfrom;
|
|
|
|
|
extern __thread unsigned long long _st_stat_recvfrom_eagain;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sendto;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sendto_eagain;
|
|
|
|
|
SrsPps* _srs_pps_recvfrom = NULL;
|
|
|
|
|
SrsPps* _srs_pps_recvfrom_eagain = NULL;
|
|
|
|
|
SrsPps* _srs_pps_sendto = NULL;
|
|
|
|
|
SrsPps* _srs_pps_sendto_eagain = NULL;
|
|
|
|
|
|
|
|
|
|
extern unsigned long long _st_stat_read;
|
|
|
|
|
extern unsigned long long _st_stat_read_eagain;
|
|
|
|
|
extern unsigned long long _st_stat_readv;
|
|
|
|
|
extern unsigned long long _st_stat_readv_eagain;
|
|
|
|
|
extern unsigned long long _st_stat_writev;
|
|
|
|
|
extern unsigned long long _st_stat_writev_eagain;
|
|
|
|
|
extern __thread unsigned long long _st_stat_read;
|
|
|
|
|
extern __thread unsigned long long _st_stat_read_eagain;
|
|
|
|
|
extern __thread unsigned long long _st_stat_readv;
|
|
|
|
|
extern __thread unsigned long long _st_stat_readv_eagain;
|
|
|
|
|
extern __thread unsigned long long _st_stat_writev;
|
|
|
|
|
extern __thread unsigned long long _st_stat_writev_eagain;
|
|
|
|
|
SrsPps* _srs_pps_read = NULL;
|
|
|
|
|
SrsPps* _srs_pps_read_eagain = NULL;
|
|
|
|
|
SrsPps* _srs_pps_readv = NULL;
|
|
|
|
@ -47,33 +47,33 @@ SrsPps* _srs_pps_readv_eagain = NULL;
|
|
|
|
|
SrsPps* _srs_pps_writev = NULL;
|
|
|
|
|
SrsPps* _srs_pps_writev_eagain = NULL;
|
|
|
|
|
|
|
|
|
|
extern unsigned long long _st_stat_recvmsg;
|
|
|
|
|
extern unsigned long long _st_stat_recvmsg_eagain;
|
|
|
|
|
extern unsigned long long _st_stat_sendmsg;
|
|
|
|
|
extern unsigned long long _st_stat_sendmsg_eagain;
|
|
|
|
|
extern __thread unsigned long long _st_stat_recvmsg;
|
|
|
|
|
extern __thread unsigned long long _st_stat_recvmsg_eagain;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sendmsg;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sendmsg_eagain;
|
|
|
|
|
SrsPps* _srs_pps_recvmsg = NULL;
|
|
|
|
|
SrsPps* _srs_pps_recvmsg_eagain = NULL;
|
|
|
|
|
SrsPps* _srs_pps_sendmsg = NULL;
|
|
|
|
|
SrsPps* _srs_pps_sendmsg_eagain = NULL;
|
|
|
|
|
|
|
|
|
|
extern unsigned long long _st_stat_epoll;
|
|
|
|
|
extern unsigned long long _st_stat_epoll_zero;
|
|
|
|
|
extern unsigned long long _st_stat_epoll_shake;
|
|
|
|
|
extern unsigned long long _st_stat_epoll_spin;
|
|
|
|
|
extern __thread unsigned long long _st_stat_epoll;
|
|
|
|
|
extern __thread unsigned long long _st_stat_epoll_zero;
|
|
|
|
|
extern __thread unsigned long long _st_stat_epoll_shake;
|
|
|
|
|
extern __thread unsigned long long _st_stat_epoll_spin;
|
|
|
|
|
SrsPps* _srs_pps_epoll = NULL;
|
|
|
|
|
SrsPps* _srs_pps_epoll_zero = NULL;
|
|
|
|
|
SrsPps* _srs_pps_epoll_shake = NULL;
|
|
|
|
|
SrsPps* _srs_pps_epoll_spin = NULL;
|
|
|
|
|
|
|
|
|
|
extern unsigned long long _st_stat_sched_15ms;
|
|
|
|
|
extern unsigned long long _st_stat_sched_20ms;
|
|
|
|
|
extern unsigned long long _st_stat_sched_25ms;
|
|
|
|
|
extern unsigned long long _st_stat_sched_30ms;
|
|
|
|
|
extern unsigned long long _st_stat_sched_35ms;
|
|
|
|
|
extern unsigned long long _st_stat_sched_40ms;
|
|
|
|
|
extern unsigned long long _st_stat_sched_80ms;
|
|
|
|
|
extern unsigned long long _st_stat_sched_160ms;
|
|
|
|
|
extern unsigned long long _st_stat_sched_s;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_15ms;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_20ms;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_25ms;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_30ms;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_35ms;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_40ms;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_80ms;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_160ms;
|
|
|
|
|
extern __thread unsigned long long _st_stat_sched_s;
|
|
|
|
|
SrsPps* _srs_pps_sched_15ms = NULL;
|
|
|
|
|
SrsPps* _srs_pps_sched_20ms = NULL;
|
|
|
|
|
SrsPps* _srs_pps_sched_25ms = NULL;
|
|
|
|
@ -96,11 +96,12 @@ SrsPps* _srs_pps_clock_160ms = NULL;
|
|
|
|
|
SrsPps* _srs_pps_timer_s = NULL;
|
|
|
|
|
|
|
|
|
|
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
|
|
|
|
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;
|
|
|
|
|
extern unsigned long long _st_stat_thread_yield2;
|
|
|
|
|
extern __thread int _st_active_count;
|
|
|
|
|
extern __thread int _st_num_free_stacks;
|
|
|
|
|
extern __thread unsigned long long _st_stat_thread_run;
|
|
|
|
|
extern __thread unsigned long long _st_stat_thread_idle;
|
|
|
|
|
extern __thread unsigned long long _st_stat_thread_yield;
|
|
|
|
|
extern __thread unsigned long long _st_stat_thread_yield2;
|
|
|
|
|
SrsPps* _srs_pps_thread_run = NULL;
|
|
|
|
|
SrsPps* _srs_pps_thread_idle = NULL;
|
|
|
|
|
SrsPps* _srs_pps_thread_yield = NULL;
|
|
|
|
@ -135,19 +136,20 @@ SrsHybridServer::SrsHybridServer()
|
|
|
|
|
|
|
|
|
|
SrsHybridServer::~SrsHybridServer()
|
|
|
|
|
{
|
|
|
|
|
srs_freep(clock_monitor_);
|
|
|
|
|
|
|
|
|
|
srs_freep(timer20ms_);
|
|
|
|
|
srs_freep(timer100ms_);
|
|
|
|
|
srs_freep(timer1s_);
|
|
|
|
|
srs_freep(timer5s_);
|
|
|
|
|
|
|
|
|
|
// We must free servers first, because it may depend on the timers of hybrid server.
|
|
|
|
|
vector<ISrsHybridServer*>::iterator it;
|
|
|
|
|
for (it = servers.begin(); it != servers.end(); ++it) {
|
|
|
|
|
ISrsHybridServer* server = *it;
|
|
|
|
|
srs_freep(server);
|
|
|
|
|
}
|
|
|
|
|
servers.clear();
|
|
|
|
|
|
|
|
|
|
srs_freep(clock_monitor_);
|
|
|
|
|
|
|
|
|
|
srs_freep(timer20ms_);
|
|
|
|
|
srs_freep(timer100ms_);
|
|
|
|
|
srs_freep(timer1s_);
|
|
|
|
|
srs_freep(timer5s_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SrsHybridServer::register_server(ISrsHybridServer* svr)
|
|
|
|
@ -237,8 +239,6 @@ void SrsHybridServer::stop()
|
|
|
|
|
ISrsHybridServer* server = *it;
|
|
|
|
|
server->stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
srs_st_destroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SrsServerAdapter* SrsHybridServer::srs()
|
|
|
|
@ -372,8 +372,8 @@ srs_error_t SrsHybridServer::on_timer(srs_utime_t interval)
|
|
|
|
|
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
|
|
|
|
_srs_pps_thread_run->update(_st_stat_thread_run); _srs_pps_thread_idle->update(_st_stat_thread_idle);
|
|
|
|
|
_srs_pps_thread_yield->update(_st_stat_thread_yield); _srs_pps_thread_yield2->update(_st_stat_thread_yield2);
|
|
|
|
|
if (_st_active_count > 0 || _srs_pps_thread_run->r10s() || _srs_pps_thread_idle->r10s() || _srs_pps_thread_yield->r10s() || _srs_pps_thread_yield2->r10s()) {
|
|
|
|
|
snprintf(buf, sizeof(buf), ", co=%d,%d,%d, yield=%d,%d", _st_active_count, _srs_pps_thread_run->r10s(), _srs_pps_thread_idle->r10s(), _srs_pps_thread_yield->r10s(), _srs_pps_thread_yield2->r10s());
|
|
|
|
|
if (_st_active_count > 0 || _st_num_free_stacks > 0 || _srs_pps_thread_run->r10s() || _srs_pps_thread_idle->r10s() || _srs_pps_thread_yield->r10s() || _srs_pps_thread_yield2->r10s()) {
|
|
|
|
|
snprintf(buf, sizeof(buf), ", co=%d,%d,%d, stk=%d, yield=%d,%d", _st_active_count, _srs_pps_thread_run->r10s(), _srs_pps_thread_idle->r10s(), _st_num_free_stacks, _srs_pps_thread_yield->r10s(), _srs_pps_thread_yield2->r10s());
|
|
|
|
|
thread_desc = buf;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|