Commit b3828ebb authored by Ingo Molnar's avatar Ingo Molnar

perf_counter tools: include PID in perf-report output, tweak user/kernel printut

It's handier than an <unknown> entry.
Also replace the kernel/user column with a more compact version:

  0.52              cc1  [k]  page_fault
  0.57               :0  [k]   _spin_lock
  0.59            :7506  [.]  <unknown>
  0.69               as  [.]  /usr/bin/as: <unknown>
  0.76              cc1  [.]  /lib64/libc-2.8.so: _int_free
  0.92              cc1  [k]  clear_page_c
  1.00            :7465  [.]  <unknown>
  1.43              cc1  [.]  /lib64/libc-2.8.so: memset
  1.86              cc1  [.]  /lib64/libc-2.8.so: _int_malloc
 70.33              cc1  [.]  /usr/libexec/gcc/x86_64-redhat-linux/4.3.2/cc1: <unknown>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 888fcee0
...@@ -277,10 +277,17 @@ static std::multimap<int, std::string> rev_hist; ...@@ -277,10 +277,17 @@ static std::multimap<int, std::string> rev_hist;
static std::string resolve_comm(int pid) static std::string resolve_comm(int pid)
{ {
std::string comm = "<unknown>"; std::string comm;
std::map<int, std::string>::const_iterator ci = comms.find(pid); std::map<int, std::string>::const_iterator ci = comms.find(pid);
if (ci != comms.end()) if (ci != comms.end()) {
comm = ci->second; comm = ci->second;
} else {
char pid_str[30];
sprintf(pid_str, ":%d", pid);
comm = pid_str;
}
return comm; return comm;
} }
...@@ -422,13 +429,13 @@ more: ...@@ -422,13 +429,13 @@ more:
char output[1024]; char output[1024];
if (event->header.misc & PERF_EVENT_MISC_KERNEL) { if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
level = "[kernel]"; level = " [k] ";
sym = resolve_kernel_symbol(event->ip.ip); sym = resolve_kernel_symbol(event->ip.ip);
} else if (event->header.misc & PERF_EVENT_MISC_USER) { } else if (event->header.misc & PERF_EVENT_MISC_USER) {
level = "[ user ]"; level = " [.] ";
sym = resolve_user_symbol(event->ip.pid, event->ip.ip); sym = resolve_user_symbol(event->ip.pid, event->ip.ip);
} else { } else {
level = "[ hv ]"; level = " [H] ";
} }
comm = resolve_comm(event->ip.pid); comm = resolve_comm(event->ip.pid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment