!497 优化record采集时间

Merge pull request !497 from yuyanqing/master
This commit is contained in:
openharmony_ci 2024-06-01 14:10:27 +00:00 committed by Gitee
commit b010125caf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -512,6 +512,12 @@ bool PerfEvents::StartTracking(bool immediately)
return false;
}
if (recordCallBack_) {
if (!PrepareRecordThread()) {
return false;
}
}
HLOGD("step: 1. enable event");
trackingStartTime_ = steady_clock::now();
if (immediately) {
@ -521,12 +527,6 @@ bool PerfEvents::StartTracking(bool immediately)
}
}
if (recordCallBack_) {
if (!PrepareRecordThread()) {
return false;
}
}
if (immediately) {
printf("Profiling duration is %.3f seconds.\n", float(timeOut_.count()) / THOUSANDS);
printf("Start Profiling...\n");
@ -547,14 +547,15 @@ bool PerfEvents::StartTracking(bool immediately)
StatLoop();
}
HLOGD("step: 3. disable event");
if (!PerfEventsEnable(false)) {
HLOGE("PerfEvents::PerfEventsEnable() failed");
}
if (recordCallBack_) {
// read left samples after disable events
ReadRecordsFromMmaps();
}
HLOGD("step: 3. disable event");
if (!PerfEventsEnable(false)) {
HLOGE("PerfEvents::PerfEventsEnable() failed");
}
trackingEndTime_ = steady_clock::now();
RecoverCaptureSig();