tools: acrntrace: Using array for saving all analyzer

As we may analyze multi-cases at the same time. It's better to store all the
analyzer in an array. Then we can traverse the array and exec all analyzer one
by one.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
Kaige Fu 2018-06-25 22:59:46 +08:00 committed by lijinxia
parent 2aa0d4074f
commit 2bdd8112bd
1 changed files with 4 additions and 2 deletions

View File

@ -43,7 +43,8 @@ def do_analysis(ifile, ofile, analyzer):
Raises:
NA
"""
analyzer(ifile, ofile)
for alyer in analyzer:
alyer(ifile, ofile)
# pre process to make sure the trace data start and end with VMENTER
def pre_process(ifile, evstr):
@ -75,6 +76,7 @@ def main(argv):
outputfile = ''
opts_short = "hi:o:f:"
opts_long = ["ifile=", "ofile=", "frequency=", "vm_exit"]
analyzer = []
try:
opts, args = getopt.getopt(argv, opts_short, opts_long)
@ -93,7 +95,7 @@ def main(argv):
elif opt in ("-f", "--frequency"):
TSC_FREQ = arg
elif opt == "--vm_exit":
analyzer = analyze_vm_exit
analyzer.append(analyze_vm_exit)
else:
assert False, "unhandled option"