janestreet / memtrace

Streaming client for OCaml's Memprof
MIT License
65 stars 13 forks source link

Using memtrace with Sandmark benchmarks #19

Closed shakthimaan closed 2 years ago

shakthimaan commented 2 years ago

I am trying to run memtrace for Sandmark (https://github.com/ocaml-bench/sandmark) benchmarks.

The memtrace.0.2.2 version was installed in the opam switch, and I tried adding the following to benchmarks/decompress/test_decompress.ml as given in the memtrace README:

open Memtrace

Memtrace.trace_if_requested ~context:"test_decompress" ();;

On compilation for 4.14.0, I get the following error:

File "benchmarks/decompress/test_decompress.ml", line 4, characters 0-8:
4 | Memtrace.trace_if_requested ~context:"test_decompress" ();;
    ^^^^^^^^
Error: Syntax error

What is the correct syntax usage for the above?

shakthimaan commented 2 years ago

The open Memtrace was not required. I added the Memtrace.trace_if_requested after the let () =, and the benchmark compiled fine. I added the MEMTRACE=trace.ctf in the dune build step, and I was able to generate the .ctf file for the decompress benchmark for 4.14.0 variant.