fix auto stop cpu profiler
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Successful in 1m42s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m11s
linux-arm-gcc / linux-gcc-armhf (push) Successful in 2m27s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 2m42s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 3m13s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 3m23s
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Successful in 1m42s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m11s
linux-arm-gcc / linux-gcc-armhf (push) Successful in 2m27s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 2m42s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 3m13s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 3m23s
This commit is contained in:
parent
6e064ba6ce
commit
78b7cc8e28
@ -156,7 +156,6 @@ CpuProfilerSwitch(int signal_number)
|
||||
char full_profile_name[PATH_MAX + 16];
|
||||
snprintf(full_profile_name, sizeof(full_profile_name), "%s.%u", base_profile_name, profile_count);
|
||||
if (!started) {
|
||||
++profile_count;
|
||||
if (!ProfilerStart(full_profile_name)) {
|
||||
RAW_LOG(FATAL, "Can't turn on cpu profiling for '%s': %s\n", full_profile_name, strerror(errno));
|
||||
}
|
||||
@ -166,9 +165,19 @@ CpuProfilerSwitch(int signal_number)
|
||||
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();
|
||||
RAW_LOG(INFO, "Auto Stop cpu Profiling After %ss", interval);
|
||||
int cur_profile_count = profile_count;
|
||||
std::thread([interval, cur_profile_count] {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(interval));
|
||||
if (profile_count == cur_profile_count) {
|
||||
RAW_LOG(INFO, "Trigger Auto stop CPU Profiling, duration=%ss", interval);
|
||||
ProfilerStop();
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
|
||||
++profile_count;
|
||||
} else {
|
||||
ProfilerStop();
|
||||
RAW_LOG(INFO, "Stop cpu Profiling for '%s'", full_profile_name);
|
||||
|
Loading…
Reference in New Issue
Block a user