diff --git a/testsuite/drivers/base_driver.py b/testsuite/drivers/base_driver.py index 8d461e9c9..5dc863594 100644 --- a/testsuite/drivers/base_driver.py +++ b/testsuite/drivers/base_driver.py @@ -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. diff --git a/testsuite/testsuite.py b/testsuite/testsuite.py index 891ea0627..f841fb378 100755 --- a/testsuite/testsuite.py +++ b/testsuite/testsuite.py @@ -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__':