Skip to content

Commit

Permalink
Improve per-process CPU report
Browse files Browse the repository at this point in the history
When there is only one process of a particular type it doesn't make
sense to list the context switches and CPU usage both for the total and
for the (one) process. This change makes it so that the information is
omitted for the line where the PID is listed. This makes many reports
much less cluttered.
  • Loading branch information
randomascii committed Jul 20, 2017
1 parent c01b535 commit a068e88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/IdentifyChromeProcesses.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ def main():
context_switches += context_switches_by_pid[pid]
cpu_usage += cpu_usage_by_pid[pid]
print("total - %6d context switches, %8.2f ms CPU" % (context_switches, cpu_usage), end="")
for pid in pidsByType[type]:
list_by_type = pidsByType[type]
for pid in list_by_type:
if show_cpu_usage:
print("\r\n ", end="")
if pid in cpu_usage_by_pid:
if pid in cpu_usage_by_pid and len(list_by_type) > 1: # Skip per-process details if there's only one.:
print("%5d - %6d context switches, %8.2f ms CPU" % (pid, context_switches_by_pid[pid], cpu_usage_by_pid[pid]), end="")
else:
print("%5d" % pid, end="")
Expand Down

0 comments on commit a068e88

Please sign in to comment.