mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 10:04:42 +00:00
tools: Fix the non-effective option -f --frequency
We use global variable TSC_FREQ defined in config.py in each of the analyzers. And the value set to TSC_FREQ through option -f/--frequency doesn't take effect. This patch fix it by adding one parameter to each of the analyzers and pass the value set by -f/--frequency to it instead of use the global one. Tracked-On: #3085 Signed-off-by: Kaige Fu <kaige.fu@intel.com> Acked-by: Yan, Like <like.yan@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
1f93f7f46c
commit
21b82d8815
@@ -7,7 +7,6 @@ This script defines the function to do the vm_exit analysis
|
||||
|
||||
import csv
|
||||
import struct
|
||||
from config import TSC_FREQ
|
||||
|
||||
TSC_BEGIN = 0
|
||||
TSC_END = 0
|
||||
@@ -163,13 +162,13 @@ def generate_report(ofile, freq):
|
||||
total_exit_time += TIME_IN_EXIT[event]
|
||||
|
||||
print ("Total run time: %d cycles" % (rt_cycle))
|
||||
print ("TSC Freq: %f MHz" % (freq))
|
||||
print ("TSC Freq: %s MHz" % (freq))
|
||||
print ("Total run time: %d sec" % (rt_sec))
|
||||
|
||||
f_csv.writerow(['Run time(cycles)', 'Run time(Sec)', 'Freq(MHz)'])
|
||||
f_csv.writerow(['%d' % (rt_cycle),
|
||||
'%.3f' % (rt_sec),
|
||||
'%d' % (freq)])
|
||||
'%s' % (freq)])
|
||||
|
||||
print ("%-28s\t%-12s\t%-12s\t%-24s\t%-16s" % ("Event", "NR_Exit",
|
||||
"NR_Exit/Sec", "Time Consumed(cycles)", "Time percentage"))
|
||||
@@ -200,11 +199,12 @@ def generate_report(ofile, freq):
|
||||
except IOError as err:
|
||||
print ("Output File Error: " + str(err))
|
||||
|
||||
def analyze_vm_exit(ifile, ofile):
|
||||
def analyze_vm_exit(ifile, ofile, freq):
|
||||
"""do the vm exits analysis
|
||||
Args:
|
||||
ifile: input trace data file
|
||||
ofile: output report file
|
||||
freq: TSC frequency of the host where we capture the trace data
|
||||
Return:
|
||||
None
|
||||
"""
|
||||
@@ -214,4 +214,4 @@ def analyze_vm_exit(ifile, ofile):
|
||||
|
||||
parse_trace_data(ifile)
|
||||
# save report to the output file
|
||||
generate_report(ofile, TSC_FREQ)
|
||||
generate_report(ofile, freq)
|
||||
|
||||
Reference in New Issue
Block a user