mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Clock: Update stat. Insert timer to execute first
This commit is contained in:
parent
f987198af0
commit
d8563398b2
10 changed files with 112 additions and 65 deletions
2
trunk/research/st/.gitignore
vendored
2
trunk/research/st/.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
udp-server
|
||||
udp-client
|
||||
cost
|
||||
cost.log
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
g++ -g -O0 cost.cpp -o cost && ./cost | grep COST
|
||||
g++ -g -O0 cost.cpp ../../objs/st/libst.a -I../../objs/st -o cost && ./cost | grep COST
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <st.h>
|
||||
|
||||
#define SRS_UTIME_MILLISECONDS 1000
|
||||
#define srsu2i(us) ((int)(us))
|
||||
|
@ -143,6 +144,18 @@ int main(int argc, char** argv)
|
|||
);
|
||||
}
|
||||
|
||||
// The cost for ST timer.
|
||||
st_set_eventsys(ST_EVENTSYS_ALT);
|
||||
st_init();
|
||||
for (;;) {
|
||||
int64_t start = srs_update_system_time();
|
||||
st_usleep(20 * 1000);
|
||||
int64_t cost = srs_update_system_time() - start;
|
||||
if (cost > (20 + 10) * 1000) {
|
||||
printf("[COST] timer=%dms\n", (int)(cost / 1000));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue