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

add uptime, startup time, load to api

This commit is contained in:
winlin 2014-05-08 15:45:51 +08:00
parent 8388da6325
commit a1fed15789
7 changed files with 121 additions and 15 deletions

View file

@ -71,6 +71,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// SRS_SYS_CYCLE_INTERVAL * SRS_SYS_MEMINFO_RESOLUTION_TIMES
#define SRS_SYS_MEMINFO_RESOLUTION_TIMES 60
// update platform info interval:
// SRS_SYS_CYCLE_INTERVAL * SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES
#define SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES 80
SrsListener::SrsListener(SrsServer* server, SrsListenerType type)
{
fd = -1;
@ -623,6 +627,7 @@ int SrsServer::do_cycle()
max = srs_max(max, SRS_SYS_RUSAGE_RESOLUTION_TIMES);
max = srs_max(max, SRS_SYS_CPU_STAT_RESOLUTION_TIMES);
max = srs_max(max, SRS_SYS_MEMINFO_RESOLUTION_TIMES);
max = srs_max(max, SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES);
// the deamon thread, update the time cache
while (true) {
@ -665,6 +670,9 @@ int SrsServer::do_cycle()
if ((i % SRS_SYS_MEMINFO_RESOLUTION_TIMES) == 0) {
srs_update_meminfo();
}
if ((i % SRS_SYS_PLATFORM_INFO_RESOLUTION_TIMES) == 0) {
srs_update_platform_info();
}
}
}