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

add gperf to heap check, use reload signal to terminate program normally

This commit is contained in:
winlin 2014-03-06 18:12:19 +08:00
parent 03a14e2e1a
commit dcd568a0d7
6 changed files with 55 additions and 11 deletions

View file

@ -37,6 +37,13 @@ SrsServer* _srs_server = new SrsServer();
#include <stdlib.h>
#include <signal.h>
#ifdef SRS_GPERF_HEAP_PROFILE
#include <gperftools/heap-profiler.h>
#endif
#ifdef SRS_GPERF_CPU_PROFILE
#include <gperftools/profiler.h>
#endif
void handler(int signo)
{
srs_trace("get a signal, signo=%d", signo);
@ -47,6 +54,17 @@ int main(int argc, char** argv)
{
int ret = ERROR_SUCCESS;
#ifdef SRS_GPERF_HEAP_CHECK
// env HEAPCHECK=normal ./objs/srs -c srs.conf
#endif
#ifdef SRS_GPERF_HEAP_PROFILE
HeapProfilerStart("gperf.srs");
#endif
#ifdef SRS_GPERF_CPU_PROFILE
ProfilerStart("gperf.srs.prof");
#endif
signal(SIGNAL_RELOAD, handler);
if ((ret = _srs_config->parse_options(argc, argv)) != ERROR_SUCCESS) {