Skip to content

Commit 18d44cc

Browse files
KaigeFulijinxia
authored andcommitted
tools: acrnalyze: Make the result easier to read
Originally, we don't format the output of analyser well. It is hard to read the result. This patch make every entry of the result align with the corresponding title to make it easier for users to read. Without patch: Event NR_Exit NR_Exit/Sec Time Consumed(cycles) Time Percentage VMEXIT_INTERRUPT_WINDOW 78090 130.15 40 0.01 VMEXIT_CR_ACCESS 0 0.00 0 0.00 VMEXIT_APICV_ACCESS 0 0.00 0 0.00 VMEXIT_EXCEPTION_OR_NMI 0 0.00 0 0.00 VMEXIT_RDTSC 0 0.00 0 0.00 ... Vector Count NR_Exit/Sec 0x000000f0 82337 137.23 0x000000ef 247713 412.85 With patch: Event NR_Exit NR_Exit/Sec Time Consumed(cycles) Time percentage VMEXIT_APICV_WRITE 13352 22.25 14331304 0.00 VMEXIT_WRMSR 309085 515.14 241166212 0.02 VMEXIT_INTERRUPT_WINDOW 78090 130.15 76841734 0.01 ... Vector Count NR_Exit/Sec 0x000000f0 82337 137.23 0x000000ef 247713 412.85 Signed-off-by: Kaige Fu <kaige.fu@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com> Acked-by: Yan, Like <like.yan@intel.com>
1 parent 08dd698 commit 18d44cc

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

tools/acrntrace/scripts/irq_analyze.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ def generate_report(ofile, freq):
8080

8181
rt_sec = float(rt_cycle) / (float(freq) * 1000 * 1000)
8282

83-
print ("\nVector \t\tCount \tNR_Exit/Sec")
83+
print ("%-8s\t%-8s\t%-8s" % ("Vector", "Count", "NR_Exit/Sec"))
8484
f_csv.writerow(['Vector', 'NR_Exit', 'NR_Exit/Sec'])
8585
for e in IRQ_EXITS.keys():
8686
pct = float(IRQ_EXITS[e]) / rt_sec
87-
print ("0x%08x \t %d \t%.2f" % (e, IRQ_EXITS[e], pct))
88-
f_csv.writerow([e, IRQ_EXITS[e], '%.2f' % pct])
87+
print ("0x%08x\t%-8d\t%-8.2f" % (e, IRQ_EXITS[e], pct))
88+
f_csv.writerow(['0x%08x' % e, IRQ_EXITS[e], '%.2f' % pct])
8989

9090
except IOError as err:
9191
print ("Output File Error: " + str(err))

tools/acrntrace/scripts/vmexit_analyze.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ def generate_report(ofile, freq):
171171
'%.3f' % (rt_sec),
172172
'%d' % (freq)])
173173

174-
print ("Event \tNR_Exit \tNR_Exit/Sec \tTime Consumed \tTime Percentage")
174+
print ("%-28s\t%-12s\t%-12s\t%-24s\t%-16s" % ("Event", "NR_Exit",
175+
"NR_Exit/Sec", "Time Consumed(cycles)", "Time percentage"))
175176
f_csv.writerow(['Exit_Reason',
176177
'NR_Exit',
177178
'NR_Exit/Sec',
@@ -182,16 +183,16 @@ def generate_report(ofile, freq):
182183
ev_freq = float(NR_EXITS[event]) / rt_sec
183184
pct = float(TIME_IN_EXIT[event]) * 100 / float(rt_cycle)
184185

185-
print ("%s \t%d \t%.2f \t%d \t%2.2f" %
186+
print ("%-28s\t%-12d\t%-12.2f\t%-24d\t%-16.2f" %
186187
(event, NR_EXITS[event], ev_freq, TIME_IN_EXIT[event], pct))
187188
row = [event, NR_EXITS[event], '%.2f' % ev_freq, TIME_IN_EXIT[event],
188189
'%2.2f' % (pct)]
189190
f_csv.writerow(row)
190191

191192
ev_freq = float(TOTAL_NR_EXITS) / rt_sec
192193
pct = float(total_exit_time) * 100 / float(rt_cycle)
193-
print("Total \t%d \t%.2f \t%d \t%2.2f"
194-
% (TOTAL_NR_EXITS, ev_freq, total_exit_time, pct))
194+
print("%-28s\t%-12d\t%-12.2f\t%-24d\t%-16.2f"
195+
% ("Total", TOTAL_NR_EXITS, ev_freq, total_exit_time, pct))
195196
row = ["Total", TOTAL_NR_EXITS, '%.2f' % ev_freq, total_exit_time,
196197
'%2.2f' % (pct)]
197198
f_csv.writerow(row)

0 commit comments

Comments
 (0)