feat auto stop profiler
All checks were successful
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 2m22s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 2m27s
linux-arm-gcc / linux-gcc-armhf (push) Successful in 2m38s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m33s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 2m54s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Successful in 3m35s
All checks were successful
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 2m22s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 2m27s
linux-arm-gcc / linux-gcc-armhf (push) Successful in 2m38s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m33s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 2m54s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Successful in 3m35s
This commit is contained in:
parent
5ffe6c71f9
commit
6e064ba6ce
@ -65,6 +65,7 @@ typedef int ucontext_t;// just to quiet the compiler, mostly
|
||||
#include <gperftools/stacktrace.h>
|
||||
#include <string>
|
||||
#include <sys/time.h>
|
||||
#include <thread>
|
||||
|
||||
using std::string;
|
||||
|
||||
@ -160,6 +161,14 @@ CpuProfilerSwitch(int signal_number)
|
||||
RAW_LOG(FATAL, "Can't turn on cpu profiling for '%s': %s\n", full_profile_name, strerror(errno));
|
||||
}
|
||||
RAW_LOG(INFO, "Start New cpu Profiling for '%s'", full_profile_name);
|
||||
|
||||
char *auto_stop_interval = getenv("CPUPROFILESTOP");
|
||||
if (auto_stop_interval != NULL) {
|
||||
long int interval = strtol(auto_stop_interval, NULL, 10);
|
||||
if (interval > 0) {
|
||||
std::thread([interval] { std::this_thread::sleep_for(std::chrono::seconds(interval)); }).detach();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ProfilerStop();
|
||||
RAW_LOG(INFO, "Stop cpu Profiling for '%s'", full_profile_name);
|
||||
|
Loading…
Reference in New Issue
Block a user