Adding makefile generation time to the infer toplevel script

Summary: @​public
Adding makefile generation time to the infer toplevel script

Reviewed By: @cristianoc

Differential Revision: D2498240
master
Dulma Rodriguez 9 years ago committed by facebook-github-bot-0
parent e2fb879321
commit a4c910cc2c

@ -543,6 +543,7 @@ class Infer:
infer_options += ['-project_root', self.args.project_root] infer_options += ['-project_root', self.args.project_root]
if self.args.multicore == 1: if self.args.multicore == 1:
analysis_start_time = time.time()
analyze_cmd = infer_analyze + infer_options analyze_cmd = infer_analyze + infer_options
exit_status = run_command( exit_status = run_command(
analyze_cmd, analyze_cmd,
@ -551,6 +552,9 @@ class Infer:
'analysis', 'analysis',
self.args.analyzer self.args.analyzer
) )
elapsed = utils.elapsed_time(analysis_start_time)
self.timing['analysis'] = elapsed
self.timing['makefile_generation'] = 0
else: else:
if self.args.analyzer in [ERADICATE, CHECKERS]: if self.args.analyzer in [ERADICATE, CHECKERS]:
@ -566,6 +570,7 @@ class Infer:
os.chdir(multicore_dir) os.chdir(multicore_dir)
analyze_cmd = infer_analyze + ['-makefile', 'Makefile'] analyze_cmd = infer_analyze + ['-makefile', 'Makefile']
analyze_cmd += infer_options analyze_cmd += infer_options
makefile_generation_start_time = time.time()
makefile_status = run_command( makefile_status = run_command(
analyze_cmd, analyze_cmd,
self.args.debug, self.args.debug,
@ -573,11 +578,14 @@ class Infer:
'create_makefile', 'create_makefile',
self.args.analyzer self.args.analyzer
) )
elapsed = utils.elapsed_time(makefile_generation_start_time)
self.timing['makefile_generation'] = elapsed
exit_status += makefile_status exit_status += makefile_status
if makefile_status == os.EX_OK: if makefile_status == os.EX_OK:
make_cmd = ['make', '-k', '-j', str(self.args.multicore)] make_cmd = ['make', '-k', '-j', str(self.args.multicore)]
if not self.args.debug: if not self.args.debug:
make_cmd += ['-s'] make_cmd += ['-s']
analysis_start_time = time.time()
make_status = run_command( make_status = run_command(
make_cmd, make_cmd,
self.args.debug, self.args.debug,
@ -585,6 +593,8 @@ class Infer:
'run_makefile', 'run_makefile',
self.args.analyzer self.args.analyzer
) )
elapsed = utils.elapsed_time(analysis_start_time)
self.timing['analysis'] = elapsed
os.chdir(pwd) os.chdir(pwd)
exit_status += make_status exit_status += make_status
@ -654,6 +664,8 @@ class Infer:
self.stats['int'].update(file_stats) self.stats['int'].update(file_stats)
self.stats['float'] = { self.stats['float'] = {
'capture_time': self.timing.get('capture', 0.0), '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), 'analysis_time': self.timing.get('analysis', 0.0),
'reporting_time': self.timing.get('reporting', 0.0), 'reporting_time': self.timing.get('reporting', 0.0),
} }
@ -671,10 +683,7 @@ class Infer:
def analyze_and_report(self): def analyze_and_report(self):
if self.args.analyzer not in [COMPILE, CAPTURE]: if self.args.analyzer not in [COMPILE, CAPTURE]:
analysis_start_time = time.time()
if self.analyze() == os.EX_OK: if self.analyze() == os.EX_OK:
elapsed = utils.elapsed_time(analysis_start_time)
self.timing['analysis'] = elapsed
reporting_start_time = time.time() reporting_start_time = time.time()
self.report_errors() self.report_errors()
elapsed = utils.elapsed_time(reporting_start_time) elapsed = utils.elapsed_time(reporting_start_time)

@ -43,6 +43,9 @@ public class InferStats {
@JsonProperty(value = "analysis_time") @JsonProperty(value = "analysis_time")
float analysisTime; float analysisTime;
@JsonProperty(value = "makefile_generation_time")
float makefileGenerationTime;
} }
@JsonProperty(value = "int") @JsonProperty(value = "int")
@ -89,4 +92,8 @@ public class InferStats {
return floatFields.analysisTime; return floatFields.analysisTime;
} }
public float getMakefileGenerationTime() {
return floatFields.makefileGenerationTime;
}
} }

Loading…
Cancel
Save