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

Core: Refine ST stat for thread switch

This commit is contained in:
winlin 2021-02-11 13:26:20 +08:00
parent e726aba8f9
commit 71cc8e35d9
2 changed files with 26 additions and 2 deletions

View file

@ -63,6 +63,9 @@ unsigned long long _st_stat_sched_160ms = 0;
unsigned long long _st_stat_sched_320ms = 0;
unsigned long long _st_stat_sched_1000ms = 0;
unsigned long long _st_stat_sched_s = 0;
unsigned long long _st_stat_thread_run = 0;
unsigned long long _st_stat_thread_idle = 0;
#endif
@ -131,10 +134,18 @@ void _st_vp_schedule(void)
_st_thread_t *thread;
if (_ST_RUNQ.next != &_ST_RUNQ) {
#ifdef DEBUG
++_st_stat_thread_run;
#endif
/* Pull thread off of the run queue */
thread = _ST_THREAD_PTR(_ST_RUNQ.next);
_ST_DEL_RUNQ(thread);
} else {
#ifdef DEBUG
++_st_stat_thread_idle;
#endif
/* If there are no threads to run, switch to the idle thread */
thread = _st_this_vp.idle_thread;
}