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

Started adding support for dhat cost summary #71

Merged
merged 5 commits into from
Jan 28, 2024

Conversation

dewert99
Copy link
Contributor

@dewert99 dewert99 commented Jan 8, 2024

I thought it could be useful to allow tools other than Callgrind to produce cost summaries. I implemented a version that mostly works but doesn't properly handle --save-baseline (in this case it always reports no changes). I think that supporting --save-baseline would require even deeper changes so I decided to see if you would be interested in this and if you had any suggestions before going further.

@gamma0987
Copy link
Contributor

Thanks for contributing!

I basically like what you've implemented already. However, some problems I currently see are:

Running dhat in ad-hoc mode prints different stats: There is only a single line, for example

==61299== Total:     170 units in 7 events

instead of

==61299== Total:     5,602,473 bytes in 200,017 blocks
==61299== At t-gmax: 5,600,285 bytes in 200,006 blocks
==61299== At t-end:  5,600,000 bytes in 200,000 blocks
==61299== Reads:     3,221,299 bytes
==61299== Writes:    10,413,043 bytes

The runner::dhat::logfile_parser::LogfileParser should already handle this case correctly and extract the Total line, but this case need to be handled when converting the fields to Costs. You can have a look at what dhat is printing to the log file in the valgrind repo. I just had a rough look over it, so maybe there's more to take into consideration.

I think it would be great to use the PID and Parent PID in the summary. Currently the output is for example:

  PID:              60529
  Parent PID:       60022
  Total bytes:                 4023|4023            (No change)
  Total blocks:                  25|25              (No change)
  At t-gmax bytes:             1771|1771            (No change)
  At t-gmax blocks:              12|12              (No change)
  At t-end bytes:                 0|0               (No change)
  At t-end blocks:                0|0               (No change)
  Reads bytes:                21435|21435           (No change)
  Writes bytes:               13383|13383           (No change)

but I would expect something like that:

  PID:                        60529|50000
  Parent PID:                 60022|40000
  Total bytes:                 4023|4023            (No change)
  Total blocks:                  25|25              (No change)
  At t-gmax bytes:             1771|1771            (No change)
  At t-gmax blocks:              12|12              (No change)
  At t-end bytes:                 0|0               (No change)
  At t-end blocks:                0|0               (No change)
  Reads bytes:                21435|21435           (No change)
  Writes bytes:               13383|13383           (No change)

The pids are only printed if there are multiple processes and log files. But, the pids don't need to be compared or at least don't need a comparison printed.

If you haven't used it already, there is a test case for multiple processes which you can run for example with

cargo build -p iai-callgrind-runner --release
IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools

If we compare dhat stats, I think it's better to not print the Logfile and Outfile

  Total bytes:                18480|18480           (No change)
  Total blocks:                  18|18              (No change)
  At t-gmax bytes:            16292|16292           (No change)
  At t-gmax blocks:               7|7               (No change)
  At t-end bytes:                 0|0               (No change)
  At t-end blocks:                0|0               (No change)
  Reads bytes:             64005299|64005299        (No change)
  Writes bytes:            64013050|64013050        (No change)
  Total:            18480 bytes in 18 blocks
  At t-gmax:        16292 bytes in 7 blocks
  At t-end:         0 bytes in 0 blocks
  Reads:            64005299 bytes
  Writes:           64013050 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/dhat.bench_bubble_sort.worst_case_4000.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/dhat.bench_bubble_sort.worst_case_4000.out

should be:

  Total bytes:                18480|18480           (No change)
  Total blocks:                  18|18              (No change)
  At t-gmax bytes:            16292|16292           (No change)
  At t-gmax blocks:               7|7               (No change)
  At t-end bytes:                 0|0               (No change)
  At t-end blocks:                0|0               (No change)
  Reads bytes:             64005299|64005299        (No change)
  Writes bytes:            64013050|64013050        (No change)

Just a small hint: I've seen some formatting issues in the diff. We are using nightly rustfmt, so you might need to adjust your toolchain accordingly.

@dewert99
Copy link
Contributor Author

dewert99 commented Jan 9, 2024

I implemented most of your suggestions, I wasn't sure if you wanted the PID comparison only for that, but I implemented it for all tools. I removed the Logfile line (except when verbose) but kept the Outfile line since it seems like out-files are tracked separately. I also changed the strategy for zipping old files with new files so that if there are more new files than old files all of the new files get printed. There is also still the issue with save-baseline that I didn't fix.

@gamma0987
Copy link
Contributor

There is also still the issue with save-baseline that I didn't fix.

Did you run the test_lib_bench_tools benchmark as I described it? I haven't noticed any problems with --save-baseline. I've done the following:

  1. I deleted the target/iai directory.
  2. Then I changed something in the benchmark-tests/benches/test_lib_bench_tools.rs file, so I actually get a change later when running this benchmark again. I changed the bad_memory function to iterate only 100 times instead of 100_000
fn bad_memory() {
    for _ in 0..100 {
        let left = Rc::new(RefCell::new(Left(None)));
        let right = Rc::new(Right(Some(Rc::clone(&left))));
        left.borrow_mut().0 = Some(Rc::clone(&right));
    }
}
  1. Then I ran the following to produce a baseline (--save-baseline):
cargo build -p iai-callgrind-runner --release
IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools -- --save-baseline
  1. I reverted the change to the bad_memory function
  2. Then I ran the benchmark again, comparing with the default baseline
cargo build -p iai-callgrind-runner --release
IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools -- --baseline
  1. You should see the changes in the DHAT summary

A problem I have noticed when running the above. When running the benchmark the first time, there was no output for dhat besides the Outfile

test_lib_bench_tools::bench_group::bench_bubble_sort worst_case_4000:setup_worst_case_array(4000)
  ======= CALLGRIND =======================================================
  Instructions:           112008034|N/A             (*********)
  L1 Hits:                151998053|N/A             (*********)
  L2 Hits:                        1|N/A             (*********)
  RAM Hits:                       5|N/A             (*********)
  Total read+write:       151998059|N/A             (*********)
  Estimated Cycles:       151998233|N/A             (*********)
  ======= DHAT ============================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/dhat.bench_bubble_sort.worst_case_4000.out
  ======= MASSIF ==========================================================
... MORE OUTPUT

When running the benchmark the second time, the fields were printed twice:

test_lib_bench_tools::bench_group::bad_memory
  ======= CALLGRIND =======================================================
  Baselines:                       |default
  Instructions:            44208591|43469           (+101601 %) [+1017.01x]
  L1 Hits:                 56886493|55984           (+101512 %) [+1016.12x]
  L2 Hits:                      537|0               (+++inf+++) [+++inf+++]
  RAM Hits:                  125003|128             (+97558.6%) [+976.586x]
  Total read+write:        57012033|56112           (+101504 %) [+1016.04x]
  Estimated Cycles:        61264283|60464           (+101224 %) [+1013.24x]
Performance has regressed: Instructions (44208591 > 43469) regressed by +101601% (>+5.00000)
Performance has regressed: Estimated Cycles (61264283 > 60464) regressed by +101224% (>+10.0000)
  ======= DHAT ============================================================
  Total bytes:              5602473|8073            (+69297.7%) [+693.977x]
  Total blocks:              200017|217             (+92073.7%) [+921.737x]
  At t-gmax bytes:          5600285|5885            (+95062.0%) [+951.620x]
  At t-gmax blocks:          200006|206             (+96990.3%) [+970.903x]
  At t-end bytes:           5600000|5600            (+99900.0%) [+1000.00x]
  At t-end blocks:           200000|200             (+99900.0%) [+1000.00x]
  Reads bytes:              3221305|24505           (+13045.5%) [+131.455x]
  Writes bytes:            10413047|23447           (+44311.0%) [+444.110x]
  Total:            5602473 bytes in 200017 blocks
  At t-gmax:        5600285 bytes in 200006 blocks
  At t-end:         5600000 bytes in 200000 blocks
  Reads:            3221305 bytes
  Writes:           10413047 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/dhat.bad_memory.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/dhat.bad_memory.out
  ======= MEMCHECK ========================================================
... MORE OUTPUT

I wasn't sure if you wanted the PID comparison only for that, but I implemented it for all tools. I removed the Logfile line (except when verbose) but kept the Outfile line since it seems like out-files are tracked separately.

I think we should concentrate on dhat at first. The other tools actually don't print much which is comparable. massif for example doesn't produce any utilisable log output. The error summary maybe when running memcheck, helgrind or drd but we can postpone that.

I think the formatting and printing of DHAT stats is different enough from the other tools to use an own formatter in runner::dhat::format. You can have a look at the runner::tool::ToolConfigs::parse method as an example and maybe use it as a blueprint for runner::tool::ToolConfigs::print.

That's all I've discovered at the moment.

@dewert99
Copy link
Contributor Author

Sorry I should have been more clear about the problem with --save-baseline
To run into the issue I did the following:

  1. run cargo build -p iai-callgrind-runner --release and delete target/iai
  2. Change benchmark-tests/benches/test_lib_bench_tools.rs from:
#[library_benchmark]
fn bench_bubble_sort_allocate() -> i32 {
    black_box(bubble_sort_allocate(black_box(4000), black_box(2000)))
}

to:

#[library_benchmark]
fn bench_bubble_sort_allocate() -> i32 {
    black_box(bubble_sort_allocate(black_box(8000), black_box(2000)))
}
  1. run IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools -- --save-baseline which produced the output:
dewert@EWE08-U:~/Repos/iai-callgrind$ IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools -- --save-baseline
   Compiling benchmark-tests v0.1.0 (/home/dewert/Repos/iai-callgrind/benchmark-tests)
    Finished bench [optimized + debuginfo] target(s) in 6.79s
     Running benches/test_lib_bench_tools.rs (target/release/deps/test_lib_bench_tools-3920ab357dc8a1a1)
test_lib_bench_tools::bench_group::bench_bubble_sort_allocate
  ======= CALLGRIND =======================================================
  Baselines:                default|default
  Instructions:           416032156|N/A             (*********)
  L1 Hits:                544018254|N/A             (*********)
  L2 Hits:                       20|N/A             (*********)
  RAM Hits:                     524|N/A             (*********)
  Total read+write:       544018798|N/A             (*********)
  Estimated Cycles:       544036694|N/A             (*********)
  ======= DHAT ============================================================
  Total bytes:                34474|34474           (No change)
  Total blocks:                  18|18              (No change)
  At t-gmax bytes:            32301|32301           (No change)
  At t-gmax blocks:               7|7               (No change)
  At t-end bytes:                 0|0               (No change)
  At t-end blocks:                0|0               (No change)
  Reads bytes:            255998421|255998421       (No change)
  Writes bytes:           256013793|256013793       (No change)
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/dhat.bench_bubble_sort_allocate.out.base@default
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.log.base@default
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.out.base@default
  ======= EXP-BBV =========================================================
^C
  1. Revert the change to benchmark-tests/benches/test_lib_bench_tools.rs
  2. Run IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools -- --save-baseline again, which gave the output:
dewert@EWE08-U:~/Repos/iai-callgrind$ IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools -- --save-baseline
   Compiling benchmark-tests v0.1.0 (/home/dewert/Repos/iai-callgrind/benchmark-tests)
    Finished bench [optimized + debuginfo] target(s) in 6.72s
     Running benches/test_lib_bench_tools.rs (target/release/deps/test_lib_bench_tools-3920ab357dc8a1a1)
test_lib_bench_tools::bench_group::bench_bubble_sort_allocate
  ======= CALLGRIND =======================================================
  Baselines:                default|default
  Instructions:           104017156|416032156       (-74.9978%) [-3.99965x]
  L1 Hits:                136010522|544018254       (-74.9989%) [-3.99982x]
  L2 Hits:                        2|20              (-90.0000%) [-10.0000x]
  RAM Hits:                     274|524             (-47.7099%) [-1.91241x]
  Total read+write:       136010798|544018798       (-74.9989%) [-3.99982x]
  Estimated Cycles:       136020122|544036694       (-74.9980%) [-3.99968x]
  ======= DHAT ============================================================
  Total bytes:                18474|18474           (No change)
  Total blocks:                  18|18              (No change)
  At t-gmax bytes:            16301|16301           (No change)
  At t-gmax blocks:               7|7               (No change)
  At t-end bytes:                 0|0               (No change)
  At t-end blocks:                0|0               (No change)
  Reads bytes:             64014421|64014421        (No change)
  Writes bytes:            64013793|64013793        (No change)
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/dhat.bench_bubble_sort_allocate.out.base@default
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.log.base@default
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.out.base@default
  ======= EXP-BBV =========================================================
^C

The issue is that in both cases the DHAT cost summery reported (No change), but on the first run it should have reported (*********) and on the second run it should have reported the changes compared to the first run.

The issue is caused by the fact that dhat generates its cost summary by comparing log_path to log_path.as_base_path() and when using --save-baseline these are the same. The old log file that we would need to compare against has already been overwritten by the time that the LogFileParser gets run so we would need deeper architectural changes to fix this.

@gamma0987
Copy link
Contributor

oh yeah. You're right concerning the different runs. --save-baseline in general needs a little bit of different handling than a usual run. That's why there are lib_bench::SaveBaselineBenchmark, lib_bench::BaselineBenchmark and so on.

If you haven't discovered it already, there's a method tool::ToolConfigs::run_loaded_vs_base, which handles the --load-baseline case and is called in lib_bench::LoadBaselineBenchmark::run. An additional method ToolConfigs::run_save_baseline (called in lib_bench::SaveBaselineBenchmark::run) with an adjusted procedure (you could take the ToolConfigs::run method as a basic template) should do the very basics. If there are common parts in the different run methods, we can still refactor later.

I hope that helps. Keep asking if there is something else or you need any further help.

@dewert99 dewert99 marked this pull request as ready for review January 13, 2024 01:44
@gamma0987
Copy link
Contributor

Sorry, some linting errors ahead. We're running the clippy lints from the stable toolchain in the CI. There was also a change to MSRV 1.66 from 1.60 recently and you may need to rebase onto main.

@gamma0987
Copy link
Contributor

The schema file for summary.json must be updated. This is not yet described anywhere. This is how it works:

# In the root directory of `iai-callgrind`. This produces the schema file `summary.schema.json`
cargo run --package iai-callgrind-runner --release --features schema --bin schema-gen
prettier --write summary.schema.json
mv summary.schema.json iai-callgrind-runner/schemas/summary.v1.schema.json

@gamma0987
Copy link
Contributor

The test run failed because there is a file expected with the name callgrind.benchmark-tests-exit.Ir event type.flamegraph.Ir.svg. This is related to the change of the Display impl for api::EventKind. The file names for flamegraphs should contain the string representation of EventKind, the exact name of the EventKind and not the ones used in the output of the callgrind stats (Ir == Instructions, ...). Why was this change necessary?

@dewert99
Copy link
Contributor Author

This change made it easier to make the runner::format::format_vertical function independent of what type of keys were used in the CostsSummary. I could revert the change to EventKind: Display and create at new CostsSummaryDisplay trait to use instead. Alternatively I could change the flamegraph filenames to use the Debug implementation instead.

@gamma0987
Copy link
Contributor

Ok, I see. I think using the Debug impl of EventKind for flamegraph filenames is the way to go then. Putting this into a function like EventKind::to_name or similar would be great.

iai-callgrind-runner/src/api.rs Outdated Show resolved Hide resolved
iai-callgrind-runner/src/runner/tool/logfile_parser.rs Outdated Show resolved Hide resolved
iai-callgrind-runner/src/runner/tool/logfile_parser.rs Outdated Show resolved Hide resolved
@gamma0987
Copy link
Contributor

gamma0987 commented Jan 17, 2024

Calculating the CostsSummary isn't trivial in the presence of multiple logfiles and processes. We actually have to deal with process trees and comparing these trees. We need to tackle the same problem in #28 (on which I already started to work on), so for the sake of simplicity you can sort (multiple) LogfileSummary by pid and then compare the two vecs one by one calculating the diffs. This procedure should cover most of the use cases.

@gamma0987
Copy link
Contributor

gamma0987 commented Jan 17, 2024

There's something else going wrong when I run the benchmark the first time:

❯ cargo build -p iai-callgrind-runner --release
❯ rm target/iai -rf
❯ IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools
test_lib_bench_tools::bench_group::bench_bubble_sort_allocate
  ======= CALLGRIND =======================================================
  Instructions:           104026488|N/A             (*********)
  L1 Hits:                136021382|N/A             (*********)
  L2 Hits:                        2|N/A             (*********)
  RAM Hits:                     277|N/A             (*********)
  Total read+write:       136021661|N/A             (*********)
  Estimated Cycles:       136031087|N/A             (*********)
  ======= DHAT ============================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/dhat.bench_bubble_sort_allocate.out
  ======= MASSIF ==========================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.out
  ======= EXP-BBV =========================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/exp-bbv.bench_bubble_sort_allocate.out.pc
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/exp-bbv.bench_bubble_sort_allocate.out.bb
  ======= MEMCHECK ========================================================
  ======= DRD =============================================================
  ======= HELGRIND ========================================================
test_lib_bench_tools::bench_group::bench_subprocess with_modifier:
  ======= CALLGRIND =======================================================
  Instructions:                5186|N/A             (*********)
  L1 Hits:                     7074|N/A             (*********)
  L2 Hits:                       35|N/A             (*********)
  RAM Hits:                     261|N/A             (*********)
  Total read+write:            7370|N/A             (*********)
  Estimated Cycles:           16384|N/A             (*********)
  ======= DHAT ============================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.with_modifier/dhat.bench_subprocess.with_modifier.out.403405
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.with_modifier/dhat.bench_subprocess.with_modifier.out.403255
test_lib_bench_tools::bench_group::bench_subprocess without_modifier:
  ======= CALLGRIND =======================================================
  Instructions:                5186|N/A             (*********)
  L1 Hits:                     7074|N/A             (*********)
  L2 Hits:                       35|N/A             (*********)
  RAM Hits:                     261|N/A             (*********)
  Total read+write:            7370|N/A             (*********)
  Estimated Cycles:           16384|N/A             (*********)
  ======= DHAT ============================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.without_modifier/dhat.bench_subprocess.without_modifier.out
test_lib_bench_tools::bench_group::bench_bubble_sort empty:vec! []
  ======= CALLGRIND =======================================================
  Instructions:                  34|N/A             (*********)
  L1 Hits:                       54|N/A             (*********)
  L2 Hits:                        1|N/A             (*********)
  RAM Hits:                       4|N/A             (*********)
  Total read+write:              59|N/A             (*********)
  Estimated Cycles:             199|N/A             (*********)
  ======= DHAT ============================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/dhat.bench_bubble_sort.empty.out
  ======= MASSIF ==========================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/massif.bench_bubble_sort.empty.out
  ======= EXP-BBV =========================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/exp-bbv.bench_bubble_sort.empty.out.bb
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/exp-bbv.bench_bubble_sort.empty.out.pc
  ======= MEMCHECK ========================================================
  ======= DRD =============================================================
  ======= HELGRIND ========================================================
test_lib_bench_tools::bench_group::bench_bubble_sort worst_case_4000:setup_worst_case_array(4000)
  ======= CALLGRIND =======================================================
  Instructions:           112008034|N/A             (*********)
  L1 Hits:                151998053|N/A             (*********)
  L2 Hits:                        1|N/A             (*********)
  RAM Hits:                       5|N/A             (*********)
  Total read+write:       151998059|N/A             (*********)
  Estimated Cycles:       151998233|N/A             (*********)
  ======= DHAT ============================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/dhat.bench_bubble_sort.worst_case_4000.out
  ======= MASSIF ==========================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/massif.bench_bubble_sort.worst_case_4000.out
  ======= EXP-BBV =========================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/exp-bbv.bench_bubble_sort.worst_case_4000.out.bb
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/exp-bbv.bench_bubble_sort.worst_case_4000.out.pc
  ======= MEMCHECK ========================================================
  ======= DRD =============================================================
  ======= HELGRIND ========================================================
test_lib_bench_tools::bench_group::bad_memory
  ======= CALLGRIND =======================================================
  Instructions:            44208591|N/A             (*********)
  L1 Hits:                 56886433|N/A             (*********)
  L2 Hits:                      598|N/A             (*********)
  RAM Hits:                  125002|N/A             (*********)
  Total read+write:        57012033|N/A             (*********)
  Estimated Cycles:        61264493|N/A             (*********)
  ======= DHAT ============================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/dhat.bad_memory.out
  ======= MEMCHECK ========================================================
  ======= MASSIF ==========================================================
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/massif.bad_memory.out

I'm missing two things: The DHAT summary output and the Logfile: ... lines for tools other than Callgrind or DHAT.

@gamma0987
Copy link
Contributor

I just noticed there's more missing: Here's the output from the main branch when I run it the first time:

❯ IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools
test_lib_bench_tools::bench_group::bench_bubble_sort_allocate
  ======= CALLGRIND =======================================================
  Instructions:           104026488|N/A             (*********)
  L1 Hits:                136021382|N/A             (*********)
  L2 Hits:                        2|N/A             (*********)
  RAM Hits:                     277|N/A             (*********)
  Total read+write:       136021661|N/A             (*********)
  Estimated Cycles:       136031087|N/A             (*********)
  ======= DHAT ============================================================
  Total:            18489 bytes in 18 blocks
  At t-gmax:        16301 bytes in 7 blocks
  At t-end:         0 bytes in 0 blocks
  Reads:            64013302 bytes
  Writes:           64013061 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/dhat.bench_bubble_sort_allocate.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/dhat.bench_bubble_sort_allocate.out
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.out
  ======= EXP-BBV =========================================================
  Details:          # Thread 1
                    #   Total intervals: 1 (Interval Size 100000000)
                    #   Total instructions: 104462822
                    #   Total reps: 429
                    #   Unique reps: 3
                    #   Total fldcw instructions: 0
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/exp-bbv.bench_bubble_sort_allocate.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/exp-bbv.bench_bubble_sort_allocate.out.pc
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/exp-bbv.bench_bubble_sort_allocate.out.bb
  ======= MEMCHECK ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/memcheck.bench_bubble_sort_allocate.log
  ======= DRD =============================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/drd.bench_bubble_sort_allocate.log
  ======= HELGRIND ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/helgrind.bench_bubble_sort_allocate.log
test_lib_bench_tools::bench_group::bench_subprocess with_modifier:
  ======= CALLGRIND =======================================================
  Instructions:                5186|N/A             (*********)
  L1 Hits:                     7074|N/A             (*********)
  L2 Hits:                       35|N/A             (*********)
  RAM Hits:                     261|N/A             (*********)
  Total read+write:            7370|N/A             (*********)
  Estimated Cycles:           16384|N/A             (*********)
  ======= DHAT ============================================================
  Command:          target/release/deps/test_lib_bench_tools-32442c855a81728f --iai-run bench_group 1 0 test_lib_bench_tools::bench_group::bench_subprocess
  PID:              534344
  Parent PID:       533873
  Total:            4023 bytes in 25 blocks
  At t-gmax:        1771 bytes in 12 blocks
  At t-end:         0 bytes in 0 blocks
  Reads:            21438 bytes
  Writes:           13385 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.with_modifier/dhat.bench_subprocess.with_modifier.log.534344
  Command:          target/release/benchmark-tests-sort
  PID:              534345
  Parent PID:       534344
  Total:            19296 bytes in 16 blocks
  At t-gmax:        16109 bytes in 5 blocks
  At t-end:         0 bytes in 0 blocks
  Reads:            64010536 bytes
  Writes:           64011377 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.with_modifier/dhat.bench_subprocess.with_modifier.log.534345
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.with_modifier/dhat.bench_subprocess.with_modifier.out.534344
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.with_modifier/dhat.bench_subprocess.with_modifier.out.534345
test_lib_bench_tools::bench_group::bench_subprocess without_modifier:
  ======= CALLGRIND =======================================================
  Instructions:                5186|N/A             (*********)
  L1 Hits:                     7074|N/A             (*********)
  L2 Hits:                       35|N/A             (*********)
  RAM Hits:                     261|N/A             (*********)
  Total read+write:            7370|N/A             (*********)
  Estimated Cycles:           16384|N/A             (*********)
  ======= DHAT ============================================================
  Total:            19296 bytes in 16 blocks
  At t-gmax:        16109 bytes in 5 ==534348==
  Total:            4023 bytes in 25 blocks
  At t-gmax:        1771 bytes in 12 blocks
  At t-end:         0 bytes in 0 blocks
  Reads:            21438 bytes
  Writes:           13385 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.without_modifier/dhat.bench_subprocess.without_modifier.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.without_modifier/dhat.bench_subprocess.without_modifier.out
test_lib_bench_tools::bench_group::bench_bubble_sort empty:vec! []
  ======= CALLGRIND =======================================================
  Instructions:                  34|N/A             (*********)
  L1 Hits:                       54|N/A             (*********)
  L2 Hits:                        1|N/A             (*********)
  RAM Hits:                       4|N/A             (*********)
  Total read+write:              59|N/A             (*********)
  Estimated Cycles:             199|N/A             (*********)
  ======= DHAT ============================================================
  Total:            2480 bytes in 17 blocks
  At t-gmax:        1736 bytes in 3 blocks
  At t-end:         0 bytes in 0 blocks
  Reads:            21302 bytes
  Writes:           13052 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/dhat.bench_bubble_sort.empty.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/dhat.bench_bubble_sort.empty.out
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/massif.bench_bubble_sort.empty.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/massif.bench_bubble_sort.empty.out
  ======= EXP-BBV =========================================================
  Details:          # Thread 1
                    #   Total intervals: 0 (Interval Size 100000000)
                    #   Total instructions: 436351
                    #   Total reps: 429
                    #   Unique reps: 3
                    #   Total fldcw instructions: 0
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/exp-bbv.bench_bubble_sort.empty.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/exp-bbv.bench_bubble_sort.empty.out.bb
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/exp-bbv.bench_bubble_sort.empty.out.pc
  ======= MEMCHECK ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/memcheck.bench_bubble_sort.empty.log
  ======= DRD =============================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/drd.bench_bubble_sort.empty.log
  ======= HELGRIND ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/helgrind.bench_bubble_sort.empty.log
test_lib_bench_tools::bench_group::bench_bubble_sort worst_case_4000:setup_worst_case_array(4000)
  ======= CALLGRIND =======================================================
  Instructions:           112008034|N/A             (*********)
  L1 Hits:                151998053|N/A             (*********)
  L2 Hits:                        1|N/A             (*********)
  RAM Hits:                       5|N/A             (*********)
  Total read+write:       151998059|N/A             (*********)
  Estimated Cycles:       151998233|N/A             (*********)
  ======= DHAT ============================================================
  Total:            18480 bytes in 18 blocks
  At t-gmax:        16292 bytes in 7 blocks
  At t-end:         0 bytes in 0 blocks
  Reads:            64005302 bytes
  Writes:           64013052 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/dhat.bench_bubble_sort.worst_case_4000.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/dhat.bench_bubble_sort.worst_case_4000.out
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/massif.bench_bubble_sort.worst_case_4000.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/massif.bench_bubble_sort.worst_case_4000.out
  ======= EXP-BBV =========================================================
  Details:          # Thread 1
                    #   Total intervals: 1 (Interval Size 100000000)
                    #   Total instructions: 112448746
                    #   Total reps: 429
                    #   Unique reps: 3
                    #   Total fldcw instructions: 0
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/exp-bbv.bench_bubble_sort.worst_case_4000.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/exp-bbv.bench_bubble_sort.worst_case_4000.out.bb
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/exp-bbv.bench_bubble_sort.worst_case_4000.out.pc
  ======= MEMCHECK ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/memcheck.bench_bubble_sort.worst_case_4000.log
  ======= DRD =============================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/drd.bench_bubble_sort.worst_case_4000.log
  ======= HELGRIND ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/helgrind.bench_bubble_sort.worst_case_4000.log
test_lib_bench_tools::bench_group::bad_memory
  ======= CALLGRIND =======================================================
  Instructions:            44208591|N/A             (*********)
  L1 Hits:                 56886433|N/A             (*********)
  L2 Hits:                      598|N/A             (*********)
  RAM Hits:                  125002|N/A             (*********)
  Total read+write:        57012033|N/A             (*********)
  Estimated Cycles:        61264493|N/A             (*********)
  ======= DHAT ============================================================
  Total:            5602473 bytes in 200017 blocks
  At t-gmax:        5600285 bytes in 200006 blocks
  At t-end:         5600000 bytes in 200000 blocks
  Reads:            3221302 bytes
  Writes:           10413045 bytes
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/dhat.bad_memory.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/dhat.bad_memory.out
  ======= MEMCHECK ========================================================
  Details:          HEAP SUMMARY:
                        in use at exit: 5,600,000 bytes in 200,000 blocks
                      total heap usage: 200,017 allocs, 17 frees, 5,602,473 bytes allocated

                    5,600,000 (3,200,000 direct, 2,400,000 indirect) bytes in 100,000 blocks are definitely lost in loss record 2 of 2
                       at 0x4841828: malloc (vg_replace_malloc.c:442)
                       by 0x115C33: alloc (alloc.rs:99)
                       by 0x115C33: alloc_impl (alloc.rs:181)
                       by 0x115C33: allocate (alloc.rs:241)
                       by 0x115C33: exchange_malloc (alloc.rs:330)
                       by 0x115C33: new<alloc::rc::RcBox<core::cell::RefCell<test_lib_bench_tools::Left>>> (boxed.rs:218)
                       by 0x115C33: new<core::cell::RefCell<test_lib_bench_tools::Left>> (rc.rs:372)
                       by 0x115C33: iai_callgrind::bench::bad_memory (test_lib_bench_tools.rs:69)
                       by 0x116175: test_lib_bench_tools::bad_memory::wrapper (test_lib_bench_tools.rs:58)
                       by 0x11B7C1: test_lib_bench_tools::main (macros.rs:370)
                       by 0x116CE2: call_once<fn(), ()> (function.rs:251)
                       by 0x116CE2: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:121)
                       by 0x11D1C8: std::rt::lang_start::{{closure}} (rt.rs:166)
                       by 0x135A2A: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:286)
                       by 0x135A2A: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:483)
                       by 0x135A2A: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:447)
                       by 0x135A2A: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:137)
                       by 0x135A2A: {closure#2} (rt.rs:148)
                       by 0x135A2A: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:483)
                       by 0x135A2A: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:447)
                       by 0x135A2A: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:137)
                       by 0x135A2A: std::rt::lang_start_internal (rt.rs:148)
                       by 0x11B99B: main (in /home/lenny/workspace/programming/iai-callgrind/target/release/deps/test_lib_bench_tools-32442c855a81728f)

                    LEAK SUMMARY:
                       definitely lost: 3,200,000 bytes in 100,000 blocks
                       indirectly lost: 2,400,000 bytes in 100,000 blocks
                         possibly lost: 0 bytes in 0 blocks
                       still reachable: 0 bytes in 0 blocks
                            suppressed: 0 bytes in 0 blocks

                    For lists of detected and suppressed errors, rerun with: -s
  Error Summary:    2 errors from 2 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/memcheck.bad_memory.log
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/massif.bad_memory.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/massif.bad_memory.out

I actually expected that only the DHAT output differs and shows a summary output. However, I guess the root of the problem is the same.

@gamma0987
Copy link
Contributor

We're getting closer :) However, the second, third, ... run doesn't compare DHAT to the previous run

❯ IAI_CALLGRIND_RUNNER=$(readlink -e target/release/iai-callgrind-runner) cargo bench -p benchmark-tests --bench test_lib_bench_tools
test_lib_bench_tools::bench_group::bench_bubble_sort_allocate
  ======= CALLGRIND =======================================================
  Instructions:           104026488|104026488       (No change)
  L1 Hits:                136021382|136021382       (No change)
  L2 Hits:                        2|2               (No change)
  RAM Hits:                     277|277             (No change)
  Total read+write:       136021661|136021661       (No change)
  Estimated Cycles:       136031087|136031087       (No change)
  ======= DHAT ============================================================
  Total bytes:                18489|N/A             (*********)
  Total blocks:                  18|N/A             (*********)
  At t-gmax bytes:            16301|N/A             (*********)
  At t-gmax blocks:               7|N/A             (*********)
  At t-end bytes:                 0|N/A             (*********)
  At t-end blocks:                0|N/A             (*********)
  Reads bytes:             64013305|N/A             (*********)
  Writes bytes:            64013063|N/A             (*********)
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/dhat.bench_bubble_sort_allocate.out
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/massif.bench_bubble_sort_allocate.out
  ======= EXP-BBV =========================================================
  Details:          # Thread 1
                    #   Total intervals: 1 (Interval Size 100000000)
                    #   Total instructions: 104462822
                    #   Total reps: 429
                    #   Unique reps: 3
                    #   Total fldcw instructions: 0
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/exp-bbv.bench_bubble_sort_allocate.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/exp-bbv.bench_bubble_sort_allocate.out.pc
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/exp-bbv.bench_bubble_sort_allocate.out.bb
  ======= MEMCHECK ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/memcheck.bench_bubble_sort_allocate.log
  ======= DRD =============================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/drd.bench_bubble_sort_allocate.log
  ======= HELGRIND ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort_allocate/helgrind.bench_bubble_sort_allocate.log
test_lib_bench_tools::bench_group::bench_subprocess with_modifier:
  ======= CALLGRIND =======================================================
  Instructions:                5186|5186            (No change)
  L1 Hits:                     7074|7074            (No change)
  L2 Hits:                       35|35              (No change)
  RAM Hits:                     261|261             (No change)
  Total read+write:            7370|7370            (No change)
  Estimated Cycles:           16384|16384           (No change)
  ======= DHAT ============================================================
  Command:          target/release/deps/test_lib_bench_tools-32442c855a81728f --iai-run bench_group 1 0 test_lib_bench_tools::bench_group::bench_subprocess
  PID:              1354560
  Parent PID:       1353728
  Total bytes:                 4023|N/A             (*********)
  Total blocks:                  25|N/A             (*********)
  At t-gmax bytes:             1771|N/A             (*********)
  At t-gmax blocks:              12|N/A             (*********)
  At t-end bytes:                 0|N/A             (*********)
  At t-end blocks:                0|N/A             (*********)
  Reads bytes:                21441|N/A             (*********)
  Writes bytes:               13387|N/A             (*********)
  Command:          target/release/benchmark-tests-sort
  PID:              1354561
  Parent PID:       1354560
  Total bytes:                19296|N/A             (*********)
  Total blocks:                  16|N/A             (*********)
  At t-gmax bytes:            16109|N/A             (*********)
  At t-gmax blocks:               5|N/A             (*********)
  At t-end bytes:                 0|N/A             (*********)
  At t-end blocks:                0|N/A             (*********)
  Reads bytes:             64010539|N/A             (*********)
  Writes bytes:            64011379|N/A             (*********)
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.with_modifier/dhat.bench_subprocess.with_modifier.out.1354560
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.with_modifier/dhat.bench_subprocess.with_modifier.out.1354561
test_lib_bench_tools::bench_group::bench_subprocess without_modifier:
  ======= CALLGRIND =======================================================
  Instructions:                5186|5186            (No change)
  L1 Hits:                     7074|7074            (No change)
  L2 Hits:                       35|35              (No change)
  RAM Hits:                     261|261             (No change)
  Total read+write:            7370|7370            (No change)
  Estimated Cycles:           16384|16384           (No change)
  ======= DHAT ============================================================
  Total bytes:                 4023|N/A             (*********)
  Total blocks:                  25|N/A             (*********)
  At t-gmax bytes:             1771|N/A             (*********)
  At t-gmax blocks:              12|N/A             (*********)
  At t-end bytes:                 0|N/A             (*********)
  At t-end blocks:                0|N/A             (*********)
  Reads bytes:                21441|N/A             (*********)
  Writes bytes:               13387|N/A             (*********)
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_subprocess.without_modifier/dhat.bench_subprocess.without_modifier.out
test_lib_bench_tools::bench_group::bench_bubble_sort empty:vec! []
  ======= CALLGRIND =======================================================
  Instructions:                  34|34              (No change)
  L1 Hits:                       54|54              (No change)
  L2 Hits:                        1|1               (No change)
  RAM Hits:                       4|4               (No change)
  Total read+write:              59|59              (No change)
  Estimated Cycles:             199|199             (No change)
  ======= DHAT ============================================================
  Total bytes:                 2480|N/A             (*********)
  Total blocks:                  17|N/A             (*********)
  At t-gmax bytes:             1736|N/A             (*********)
  At t-gmax blocks:               3|N/A             (*********)
  At t-end bytes:                 0|N/A             (*********)
  At t-end blocks:                0|N/A             (*********)
  Reads bytes:                21305|N/A             (*********)
  Writes bytes:               13054|N/A             (*********)
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/dhat.bench_bubble_sort.empty.out
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/massif.bench_bubble_sort.empty.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/massif.bench_bubble_sort.empty.out
  ======= EXP-BBV =========================================================
  Details:          # Thread 1
                    #   Total intervals: 0 (Interval Size 100000000)
                    #   Total instructions: 436351
                    #   Total reps: 429
                    #   Unique reps: 3
                    #   Total fldcw instructions: 0
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/exp-bbv.bench_bubble_sort.empty.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/exp-bbv.bench_bubble_sort.empty.out.bb
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/exp-bbv.bench_bubble_sort.empty.out.pc
  ======= MEMCHECK ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/memcheck.bench_bubble_sort.empty.log
  ======= DRD =============================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/drd.bench_bubble_sort.empty.log
  ======= HELGRIND ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.empty/helgrind.bench_bubble_sort.empty.log
test_lib_bench_tools::bench_group::bench_bubble_sort worst_case_4000:setup_worst_case_array(4000)
  ======= CALLGRIND =======================================================
  Instructions:           112008034|112008034       (No change)
  L1 Hits:                151998053|151998053       (No change)
  L2 Hits:                        1|1               (No change)
  RAM Hits:                       5|5               (No change)
  Total read+write:       151998059|151998059       (No change)
  Estimated Cycles:       151998233|151998233       (No change)
  ======= DHAT ============================================================
  Total bytes:                18480|N/A             (*********)
  Total blocks:                  18|N/A             (*********)
  At t-gmax bytes:            16292|N/A             (*********)
  At t-gmax blocks:               7|N/A             (*********)
  At t-end bytes:                 0|N/A             (*********)
  At t-end blocks:                0|N/A             (*********)
  Reads bytes:             64005305|N/A             (*********)
  Writes bytes:            64013054|N/A             (*********)
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/dhat.bench_bubble_sort.worst_case_4000.out
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/massif.bench_bubble_sort.worst_case_4000.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/massif.bench_bubble_sort.worst_case_4000.out
  ======= EXP-BBV =========================================================
  Details:          # Thread 1
                    #   Total intervals: 1 (Interval Size 100000000)
                    #   Total instructions: 112448746
                    #   Total reps: 429
                    #   Unique reps: 3
                    #   Total fldcw instructions: 0
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/exp-bbv.bench_bubble_sort.worst_case_4000.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/exp-bbv.bench_bubble_sort.worst_case_4000.out.bb
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/exp-bbv.bench_bubble_sort.worst_case_4000.out.pc
  ======= MEMCHECK ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/memcheck.bench_bubble_sort.worst_case_4000.log
  ======= DRD =============================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/drd.bench_bubble_sort.worst_case_4000.log
  ======= HELGRIND ========================================================
  Error Summary:    0 errors from 0 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bench_bubble_sort.worst_case_4000/helgrind.bench_bubble_sort.worst_case_4000.log
test_lib_bench_tools::bench_group::bad_memory
  ======= CALLGRIND =======================================================
  Instructions:            44208591|44208591        (No change)
  L1 Hits:                 56886433|56886433        (No change)
  L2 Hits:                      598|598             (No change)
  RAM Hits:                  125002|125002          (No change)
  Total read+write:        57012033|57012033        (No change)
  Estimated Cycles:        61264493|61264493        (No change)
  ======= DHAT ============================================================
  Total bytes:              5602473|N/A             (*********)
  Total blocks:              200017|N/A             (*********)
  At t-gmax bytes:          5600285|N/A             (*********)
  At t-gmax blocks:          200006|N/A             (*********)
  At t-end bytes:           5600000|N/A             (*********)
  At t-end blocks:           200000|N/A             (*********)
  Reads bytes:              3221305|N/A             (*********)
  Writes bytes:            10413047|N/A             (*********)
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/dhat.bad_memory.out
  ======= MEMCHECK ========================================================
  Details:          HEAP SUMMARY:
                        in use at exit: 5,600,000 bytes in 200,000 blocks
                      total heap usage: 200,017 allocs, 17 frees, 5,602,473 bytes allocated

                    5,600,000 (3,200,000 direct, 2,400,000 indirect) bytes in 100,000 blocks are definitely lost in loss record 2 of 2
                       at 0x4841828: malloc (vg_replace_malloc.c:442)
                       by 0x115C33: alloc (alloc.rs:99)
                       by 0x115C33: alloc_impl (alloc.rs:181)
                       by 0x115C33: allocate (alloc.rs:241)
                       by 0x115C33: exchange_malloc (alloc.rs:330)
                       by 0x115C33: new<alloc::rc::RcBox<core::cell::RefCell<test_lib_bench_tools::Left>>> (boxed.rs:218)
                       by 0x115C33: new<core::cell::RefCell<test_lib_bench_tools::Left>> (rc.rs:372)
                       by 0x115C33: iai_callgrind::bench::bad_memory (test_lib_bench_tools.rs:69)
                       by 0x116175: test_lib_bench_tools::bad_memory::wrapper (test_lib_bench_tools.rs:58)
                       by 0x11B7C1: test_lib_bench_tools::main (macros.rs:370)
                       by 0x116CE2: call_once<fn(), ()> (function.rs:251)
                       by 0x116CE2: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:121)
                       by 0x11D1C8: std::rt::lang_start::{{closure}} (rt.rs:166)
                       by 0x135A2A: call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (function.rs:286)
                       by 0x135A2A: do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panicking.rs:483)
                       by 0x135A2A: try<i32, &(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> (panicking.rs:447)
                       by 0x135A2A: catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> (panic.rs:137)
                       by 0x135A2A: {closure#2} (rt.rs:148)
                       by 0x135A2A: do_call<std::rt::lang_start_internal::{closure_env#2}, isize> (panicking.rs:483)
                       by 0x135A2A: try<isize, std::rt::lang_start_internal::{closure_env#2}> (panicking.rs:447)
                       by 0x135A2A: catch_unwind<std::rt::lang_start_internal::{closure_env#2}, isize> (panic.rs:137)
                       by 0x135A2A: std::rt::lang_start_internal (rt.rs:148)
                       by 0x11B99B: main (in /home/lenny/workspace/programming/iai-callgrind/target/release/deps/test_lib_bench_tools-32442c855a81728f)

                    LEAK SUMMARY:
                       definitely lost: 3,200,000 bytes in 100,000 blocks
                       indirectly lost: 2,400,000 bytes in 100,000 blocks
                         possibly lost: 0 bytes in 0 blocks
                       still reachable: 0 bytes in 0 blocks
                            suppressed: 0 bytes in 0 blocks

                    For lists of detected and suppressed errors, rerun with: -s
  Error Summary:    2 errors from 2 contexts (suppressed: 0 from 0)
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/memcheck.bad_memory.log
  ======= MASSIF ==========================================================
  Logfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/massif.bad_memory.log
  Outfile:          target/iai/benchmark-tests/test_lib_bench_tools/bench_group/bad_memory/massif.bad_memory.out

iai-callgrind-runner/src/runner/tool/format.rs Outdated Show resolved Hide resolved
iai-callgrind-runner/src/runner/summary.rs Outdated Show resolved Hide resolved
@gamma0987
Copy link
Contributor

Could you please don't resolve the reviews. Thanks.

@dewert99
Copy link
Contributor Author

Could you please don't resolve the reviews. Thanks.
Sorry

@dewert99
Copy link
Contributor Author

Would it be world adding a pre-commit script? eg:

cargo +nightly fmt
cargo clippy
cargo run --package iai-callgrind-runner --release --features schema --bin schema-gen
prettier --write summary.schema.json
mv summary.schema.json iai-callgrind-runner/schemas/summary.v1.schema.json

@gamma0987
Copy link
Contributor

Could you please don't resolve the reviews. Thanks.
Sorry

No problem.

Would it be world adding a pre-commit script? eg:

Would be great. The only problem I see is that last mv command and using cargo +stable clippy explicitly. I would prefer to only diff the latest schema and the result from schema-gen instead of moving it in place. I actually would love to have a Justfile for all these little standard project specific commands and 3-liners and also use just to install any pre-commit, pre-push hooks and whatever is necessary to start working on this project.

However, don't make this part of this pr. I'm going through the changes a last time until tomorrow or so, but as far as I can see right now it's working as it should. Thanks for your great work on this pr, so far.

iai-callgrind-runner/src/runner/tool/format.rs Outdated Show resolved Hide resolved
iai-callgrind-runner/src/runner/tool/logfile_parser.rs Outdated Show resolved Hide resolved
iai-callgrind-runner/src/runner/tool/logfile_parser.rs Outdated Show resolved Hide resolved
iai-callgrind-runner/src/runner/tool/logfile_parser.rs Outdated Show resolved Hide resolved
@dewert99 dewert99 requested a review from gamma0987 January 24, 2024 18:01
@gamma0987
Copy link
Contributor

Great! As a last request, please squash the commits from ef53ef9 onwards.

@gamma0987
Copy link
Contributor

Looks like, something went wrong during the squash

@dewert99
Copy link
Contributor Author

Sorry, I tried squashing again, does this seem better?

@gamma0987
Copy link
Contributor

yeah looks better

@gamma0987 gamma0987 merged commit 751fc98 into iai-callgrind:main Jan 28, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants