Skip to content

Commit

Permalink
Show legend for subprocess conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
marxin committed Feb 26, 2024
1 parent 638e1a5 commit c7a2601
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions usage-wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys
import threading
import time
from itertools import chain

try:
import psutil
Expand Down Expand Up @@ -398,9 +399,10 @@ def generate_graph():
custom_lines.append(Line2D([0], [0], color='green', lw=LW))
custom_lines.append(Line2D([0], [0], color='red', lw=LW))

colors = special_processes.values()
custom_lines += [Line2D([0], [0], color=x, lw=5) for x in colors]
names += list(special_processes.keys())
if sum(chain(*cpu_stacks)) > 0:
colors = special_processes.values()
custom_lines += [Line2D([0], [0], color=x, lw=5) for x in colors]
names += list(special_processes.keys())
fig.legend(custom_lines, names, loc='right', prop={'size': 6})

filename = args.output
Expand Down

0 comments on commit c7a2601

Please sign in to comment.