Skip to content

Commit

Permalink
Upstream two performance monitor collectors to MachTask
Browse files Browse the repository at this point in the history
Add two more perf monitors to MachTask::GetProfileData.

<rdar://problem/63984105>
  • Loading branch information
jasonmolenda committed Jun 15, 2020
1 parent 5a4c3f6 commit 480a383
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lldb/tools/debugserver/source/MacOSX/MachTask.mm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
#include <pmsample.h>
#endif

extern "C" int
proc_get_cpumon_params(pid_t pid, int *percentage,
int *interval); // <libproc_internal.h> SPI

//----------------------------------------------------------------------
// MachTask constructor
//----------------------------------------------------------------------
Expand Down Expand Up @@ -470,6 +474,16 @@ static void get_threads_profile_data(DNBProfileDataScanType scanType,
}
#endif

if (scanType & eProfileEnergyCPUCap) {
int percentage = -1;
int interval = -1;
int result = proc_get_cpumon_params(pid, &percentage, &interval);
if ((result == 0) && (percentage >= 0) && (interval >= 0)) {
profile_data_stream << "cpu_cap_p:" << percentage << ';';
profile_data_stream << "cpu_cap_t:" << interval << ';';
}
}

profile_data_stream << "--end--;";

result = profile_data_stream.str();
Expand Down

0 comments on commit 480a383

Please sign in to comment.