From: Valeriy Savchenko Date: Fri, 22 May 2020 09:51:25 +0000 (+0300) Subject: [analyzer] SumTimerInfo.py: Partially modernize X-Git-Tag: llvmorg-12-init~5359 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=475d1202837071959f3f69d3512c820538d81543;p=platform%2Fupstream%2Fllvm.git [analyzer] SumTimerInfo.py: Partially modernize Differential Revision: https://reviews.llvm.org/D80427 --- diff --git a/clang/utils/analyzer/SumTimerInfo.py b/clang/utils/analyzer/SumTimerInfo.py index 5d86f76..eed17e0 100644 --- a/clang/utils/analyzer/SumTimerInfo.py +++ b/clang/utils/analyzer/SumTimerInfo.py @@ -6,8 +6,6 @@ Script to Summarize statistics in the scan-build output. Statistics are enabled by passing '-internal-stats' option to scan-build (or '-analyzer-stats' to the analyzer). """ -from __future__ import absolute_import, division, print_function - import sys if __name__ == '__main__': @@ -17,64 +15,65 @@ if __name__ == '__main__': sys.exit(-1) f = open(sys.argv[1], 'r') - Time = 0.0 - TotalTime = 0.0 - MaxTime = 0.0 - Warnings = 0 - Count = 0 - FunctionsAnalyzed = 0 - ReachableBlocks = 0 - ReachedMaxSteps = 0 - NumSteps = 0 - NumInlinedCallSites = 0 - NumBifurcatedCallSites = 0 - MaxCFGSize = 0 + time = 0.0 + total_time = 0.0 + max_time = 0.0 + warnings = 0 + count = 0 + functions_analyzed = 0 + reachable_blocks = 0 + reached_max_steps = 0 + num_steps = 0 + num_inlined_call_sites = 0 + num_bifurcated_call_sites = 0 + max_cfg_size = 0 + for line in f: - if ("Analyzer Total Time" in line): + if "Analyzer total time" in line: s = line.split() - Time = Time + float(s[6]) - Count = Count + 1 - if (float(s[6]) > MaxTime): - MaxTime = float(s[6]) - if ("warning generated." in line) or ("warnings generated" in line): + time = time + float(s[6]) + count = count + 1 + if float(s[6]) > max_time: + max_time = float(s[6]) + if "warning generated." in line or "warnings generated" in line: s = line.split() - Warnings = Warnings + int(s[0]) + warnings = warnings + int(s[0]) if "The # of functions analysed (as top level)" in line: s = line.split() - FunctionsAnalyzed = FunctionsAnalyzed + int(s[0]) + functions_analyzed = functions_analyzed + int(s[0]) if "The % of reachable basic blocks" in line: s = line.split() - ReachableBlocks = ReachableBlocks + int(s[0]) + reachable_blocks = reachable_blocks + int(s[0]) if "The # of times we reached the max number of steps" in line: s = line.split() - ReachedMaxSteps = ReachedMaxSteps + int(s[0]) + reached_max_steps = reached_max_steps + int(s[0]) if "The maximum number of basic blocks in a function" in line: s = line.split() - if MaxCFGSize < int(s[0]): - MaxCFGSize = int(s[0]) + if max_cfg_size < int(s[0]): + max_cfg_size = int(s[0]) if "The # of steps executed" in line: s = line.split() - NumSteps = NumSteps + int(s[0]) + num_steps = num_steps + int(s[0]) if "The # of times we inlined a call" in line: s = line.split() - NumInlinedCallSites = NumInlinedCallSites + int(s[0]) + num_inlined_call_sites = num_inlined_call_sites + int(s[0]) if "The # of times we split the path due \ to imprecise dynamic dispatch info" in line: s = line.split() - NumBifurcatedCallSites = NumBifurcatedCallSites + int(s[0]) + num_bifurcated_call_sites = num_bifurcated_call_sites + int(s[0]) if ") Total" in line: s = line.split() - TotalTime = TotalTime + float(s[6]) + total_time = total_time + float(s[6]) - print("TU Count %d" % (Count)) - print("Time %f" % (Time)) - print("Warnings %d" % (Warnings)) - print("Functions Analyzed %d" % (FunctionsAnalyzed)) - print("Reachable Blocks %d" % (ReachableBlocks)) - print("Reached Max Steps %d" % (ReachedMaxSteps)) - print("Number of Steps %d" % (NumSteps)) - print("Number of Inlined calls %d (bifurcated %d)" % ( - NumInlinedCallSites, NumBifurcatedCallSites)) - print("MaxTime %f" % (MaxTime)) - print("TotalTime %f" % (TotalTime)) - print("Max CFG Size %d" % (MaxCFGSize)) + print(f"TU count {count}") + print(f"Time {time}") + print(f"Warnings {warnings}") + print(f"Functions analyzed {functions_analyzed}") + print(f"Reachable blocks {reachable_blocks}") + print(f"Reached max steps {reached_max_steps}") + print(f"Number of steps {num_steps}") + print(f"Number of inlined calls {num_inlined_call_sites} " + f"(bifurcated {num_bifurcated_call_sites})") + print(f"Max time {max_time}") + print(f"Total time {total_time}") + print(f"Max CFG Size {max_cfg_size}")