Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream two performance monitor collectors to MachTask #1343

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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