From a4c910cc2c00ffbe8d55483d85d0d943242d948b Mon Sep 17 00:00:00 2001 From: Dulma Rodriguez Date: Thu, 1 Oct 2015 07:30:53 -0700 Subject: [PATCH] Adding makefile generation time to the infer toplevel script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: @​public Adding makefile generation time to the infer toplevel script Reviewed By: @cristianoc Differential Revision: D2498240 --- infer/bin/inferlib.py | 15 ++++++++++++--- infer/tests/utils/InferStats.java | 7 +++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/infer/bin/inferlib.py b/infer/bin/inferlib.py index d4de709ab..d9585f40d 100644 --- a/infer/bin/inferlib.py +++ b/infer/bin/inferlib.py @@ -543,6 +543,7 @@ class Infer: infer_options += ['-project_root', self.args.project_root] if self.args.multicore == 1: + analysis_start_time = time.time() analyze_cmd = infer_analyze + infer_options exit_status = run_command( analyze_cmd, @@ -551,6 +552,9 @@ class Infer: 'analysis', self.args.analyzer ) + elapsed = utils.elapsed_time(analysis_start_time) + self.timing['analysis'] = elapsed + self.timing['makefile_generation'] = 0 else: if self.args.analyzer in [ERADICATE, CHECKERS]: @@ -566,6 +570,7 @@ class Infer: os.chdir(multicore_dir) analyze_cmd = infer_analyze + ['-makefile', 'Makefile'] analyze_cmd += infer_options + makefile_generation_start_time = time.time() makefile_status = run_command( analyze_cmd, self.args.debug, @@ -573,11 +578,14 @@ class Infer: 'create_makefile', self.args.analyzer ) + elapsed = utils.elapsed_time(makefile_generation_start_time) + self.timing['makefile_generation'] = elapsed exit_status += makefile_status if makefile_status == os.EX_OK: make_cmd = ['make', '-k', '-j', str(self.args.multicore)] if not self.args.debug: make_cmd += ['-s'] + analysis_start_time = time.time() make_status = run_command( make_cmd, self.args.debug, @@ -585,6 +593,8 @@ class Infer: 'run_makefile', self.args.analyzer ) + elapsed = utils.elapsed_time(analysis_start_time) + self.timing['analysis'] = elapsed os.chdir(pwd) exit_status += make_status @@ -654,6 +664,8 @@ class Infer: self.stats['int'].update(file_stats) self.stats['float'] = { 'capture_time': self.timing.get('capture', 0.0), + 'makefile_generation_time': self.timing.get( + 'makefile_generation', 0.0), 'analysis_time': self.timing.get('analysis', 0.0), 'reporting_time': self.timing.get('reporting', 0.0), } @@ -671,10 +683,7 @@ class Infer: def analyze_and_report(self): if self.args.analyzer not in [COMPILE, CAPTURE]: - analysis_start_time = time.time() if self.analyze() == os.EX_OK: - elapsed = utils.elapsed_time(analysis_start_time) - self.timing['analysis'] = elapsed reporting_start_time = time.time() self.report_errors() elapsed = utils.elapsed_time(reporting_start_time) diff --git a/infer/tests/utils/InferStats.java b/infer/tests/utils/InferStats.java index 8b55a7ee8..fd9ff4bf5 100644 --- a/infer/tests/utils/InferStats.java +++ b/infer/tests/utils/InferStats.java @@ -43,6 +43,9 @@ public class InferStats { @JsonProperty(value = "analysis_time") float analysisTime; + + @JsonProperty(value = "makefile_generation_time") + float makefileGenerationTime; } @JsonProperty(value = "int") @@ -89,4 +92,8 @@ public class InferStats { return floatFields.analysisTime; } + public float getMakefileGenerationTime() { + return floatFields.makefileGenerationTime; + } + }