Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timing information to CodeChecker runs #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion run_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,15 @@ def check_project(project, project_dir, config, num_jobs):
cmd += " --saargs %s " % filename
cmd += " --skip %s " % skippath
cmd += collect_args("analyze_args", conf_sources)
run_command(cmd, print_error=True, env=env)

cmd = '/usr/bin/time -v -- ' + cmd
_, _, analyze_stderr = run_command(cmd, print_error=True, env=env)

timestat_lines = analyze_stderr.splitlines()[-23:]

timestat_path = os.path.join(run_config['result_path'], 'time_stats')
with open(timestat_path, 'w') as timestat_file:
timestat_file.write('\n'.join(timestat_lines))

print("%s [%s] Done. Storing results..." % (timestamp(), name))
cmd = "CodeChecker store '%s' --url '%s' -n %s " \
Expand Down Expand Up @@ -388,6 +396,7 @@ def process_success(path, statistics=None):
match = stat.regex.search(line)
if match:
stat.counter[match.group(1)] += 1

return statistics


Expand Down Expand Up @@ -494,6 +503,14 @@ def post_process_project(project, project_dir, config, printer):
sum(failure_stats["unreachable"].counter.values())
stats["Lines of code"] = project.get("LOC", '?')

timestat_path = os.path.join(run_config['result_path'], 'time_stats')

with open(timestat_path) as timestat_file:
for timestat_line in timestat_file.readlines():
stat_name = timestat_line.split(': ')[0].strip()
stat_value = timestat_line.split(': ')[1].strip()
stats[stat_name] = stat_value

project_stats[run_config["name"]] = stats

printer.extend_with_project(project["name"], project_stats)
Expand Down