Browse Source

global index con offset para que no se peguen los grupos

David 10 năm trước cách đây
mục cha
commit
fb7a09f22b
1 tập tin đã thay đổi với 3 bổ sung4 xóa
  1. 3 4
      scripts/plotter.py

+ 3 - 4
scripts/plotter.py

@@ -5,11 +5,10 @@ import matplotlib.pyplot as plt
 import sys
 
 bar_width = 0.25
+index = []
 def plot(process_data):
     fig, ax = plt.subplots(figsize=(10,5))
     
-    index = list(range(len(process_data)))
-    
     plot_data(0,[latency(p) for p in process_data], 'r', 'Latency')
     plot_data(1,[ready(p) for p in process_data],   'g', 'Ready')
     plot_data(2,[cpu(p) for p in process_data],     'b', 'CPU')
@@ -38,8 +37,7 @@ def cpu_io(p):
     return p["ticksBlock"]+p["ticksCpu"]
 
 def plot_data(ind, data, color, label):
-    opacity = 0.9
-    index = list(range(len(data)))
+    opacity = 1
     plt.bar([i + bar_width*ind for i in index],
         data,
         bar_width,
@@ -54,6 +52,7 @@ if sys.stdin.isatty():
 try:
     data = sys.stdin.read()
     data = json.loads(data)
+    index = [ 1.2*i for i in list(range(len(data))) ]
     plot(data)
 except Exception as e:
     print(data)