diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-09-29 15:31:28 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-09-29 15:35:53 +0200 |
| commit | 3f173d0b6c85ce5fffdcbe3da3b01eef8192033e (patch) | |
| tree | 0c57769fd4b584b260b31af5d79cb5c5c8eed734 /src/benchmark.py | |
| parent | 059d263a6b944c4cfc5a5a0f2716e6a85116cfc1 (diff) | |
| download | allocbench-3f173d0b6c85ce5fffdcbe3da3b01eef8192033e.tar.gz allocbench-3f173d0b6c85ce5fffdcbe3da3b01eef8192033e.zip | |
catch if cmd aborts
perf stat does not propagate if the measured cmd aborts.
To solve thing in a universal way we register a SIGABRT handler
which creates the file aborted
Diffstat (limited to 'src/benchmark.py')
| -rw-r--r-- | src/benchmark.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/benchmark.py b/src/benchmark.py index 798cbd6..f2aa8a3 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -345,6 +345,7 @@ class Benchmark: env = dict(os.environ) env["LD_PRELOAD"] = env.get("LD_PRELOAD", "") env["LD_PRELOAD"] += " " + f"{src.globalvars.builddir}/print_status_on_exit.so" + env["LD_PRELOAD"] += " " + f"{src.globalvars.builddir}/abort_handler.so" env["LD_PRELOAD"] += " " + alloc["LD_PRELOAD"] if "LD_LIBRARY_PATH" in alloc: @@ -406,7 +407,10 @@ class Benchmark: result = {} - if res.returncode != 0 or "ERROR: ld.so" in res.stderr or "Segmentation fault" in res.stderr: + if any([res.returncode != 0, + "ERROR: ld.so" in res.stderr, + "Segmentation fault" in res.stderr, + os.path.exists("aborted")]): print() print_debug("Stdout:\n" + res.stdout) print_debug("Stderr:\n" + res.stderr) @@ -414,6 +418,8 @@ class Benchmark: print_error("{} failed with exit code {} for {}".format(argv, res.returncode, alloc_name)) elif "ERROR: ld.so" in res.stderr: print_error("Preloading of {} failed for {}".format(alloc["LD_PRELOAD"], alloc_name)) + elif os.path.exists("aborted"): + os.remove("aborted") # parse and store results else: |
