Skip to content

Commit

Permalink
Merge branch 'topic/14' into 'master'
Browse files Browse the repository at this point in the history
Add callgrind support for the performance testsuite

See merge request eng/libadalang/libadalang!1673
  • Loading branch information
thvnx committed Jun 24, 2024
2 parents 0ae5a8e + 3bd1752 commit 6743fb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions testsuite/drivers/base_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,17 @@ def data_file(suffix: str) -> str:
self.result.info["time"] = " ".join(time_list)
self.result.info["memory"] = " ".join(memory_list)

elif mode == "callgrind":
result = run("valgrind", "--tool=callgrind")
# Callgrind outputs the number of executed instructions in its
# trace. Search for the line containing "Collected".
ir = "0"
for line in result.splitlines():
if "Collected" in line:
ir = line.split()[-1]
break
self.result.info["callgrind"] = ir

elif self.env.perf_no_profile:
# If we are asked for this testsuite run not to compute
# profiles, skip to the next mode.
Expand Down
2 changes: 2 additions & 0 deletions testsuite/testsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ def compute_stats(numbers_str: str,
+ compute_stats(entry.info["time"], float, format_time))
print(" memory: "
+ compute_stats(entry.info["memory"], int, format_memory))
if "callgrind" in entry.info:
print(" callgrind's Ir: " + entry.info["callgrind"])


if __name__ == '__main__':
Expand Down

0 comments on commit 6743fb7

Please sign in to comment.