[Lldb-commits] [lldb] r175928 - <rdar://problem/13277100>
Han Ming Ong
hanming at apple.com
Fri Feb 22 15:26:59 PST 2013
Author: hanming
Date: Fri Feb 22 17:26:59 2013
New Revision: 175928
URL: http://llvm.org/viewvc/llvm-project?rev=175928&view=rev
Log:
<rdar://problem/13277100>
Need host_statistics on profile data to get host's user/system/idle clicks
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp?rev=175928&r1=175927&r2=175928&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp Fri Feb 22 17:26:59 2013
@@ -291,6 +291,14 @@ std::string
MachTask::GetProfileData ()
{
std::string result;
+
+ mach_port_t localHost = mach_host_self();
+ struct host_cpu_load_info host_info;
+ mach_msg_type_number_t count = HOST_CPU_LOAD_INFO_COUNT;
+ kern_return_t kr = host_statistics(localHost, HOST_CPU_LOAD_INFO, (host_info_t)&host_info, &count);
+ if (kr != KERN_SUCCESS)
+ return result;
+
task_t task = TaskPort();
if (task == TASK_NULL)
return result;
@@ -335,6 +343,10 @@ MachTask::GetProfileData ()
{
std::ostringstream profile_data_stream;
+ profile_data_stream << "host_user_ticks:" << host_info.cpu_ticks[CPU_STATE_USER] << ';';
+ profile_data_stream << "host_sys_ticks:" << host_info.cpu_ticks[CPU_STATE_SYSTEM] << ';';
+ profile_data_stream << "host_idle_ticks:" << host_info.cpu_ticks[CPU_STATE_IDLE] << ';';
+
profile_data_stream << "elapsed_usec:" << elapsed_usec << ';';
profile_data_stream << "task_used_usec:" << task_used_usec << ';';
More information about the lldb-commits
mailing list