tlsnotary / tlsn

Rust implementation of the TLSNotary protocol
https://tlsnotary.org
285 stars 75 forks source link

Add memory profiling to benchmarks #462

Open sinui0 opened 8 months ago

valo commented 2 months ago

I believe I can contribute in this. We can use valgrind DHAT (https://valgrind.org/docs/manual/dh-manual.html#dh-manual.overview) tool to profile the memory. Here is the output of running valgrind --tool=dhat ./target/release/examples/interactive:

==110432== Total:     5,142,194,819 bytes in 6,534,290 blocks
==110432== At t-gmax: 515,650,506 bytes in 69,816 blocks
==110432== At t-end:  214,519,160 bytes in 235 blocks
==110432== Reads:     12,516,152,734 bytes
==110432== Writes:    8,497,412,743 bytes

It takes 2 minutes to run the interactive example through this tool, so it adds quite a bit of execution overhead. Given that I think the memory profiling should be an option flag.

Do you think that will be useful? Should I add this as a flag in the benches crate? May be even parse the total counters and add it to the metrics.csv?

Here is the detail profile in a DHAT viewer:

image

sinui0 commented 2 months ago

Interesting, thanks for looking into this.

Yes it would be helpful to have it as a flag in the benches. To start with we probably just want to measure peak usage for a single configuration.