jkang
jkang

Reputation: 549

Getting a trace of memory address accesses using Valgrind

I have a microbenchmark which I'm using to generate memory traffic. I've profiled the application and it seems to constantly hit in L1 cache. I have a Core i5-7260U.

I want to understand the actual memory access pattern by tracing the memory accesses of my app. I think Valgrind can do this but a Google search hasn't shown any results. Is there a way to use Valgrind to trace all memory accesses?

It's a simple C++ program that I'm compiling using gcc with -g and -O3.

Upvotes: 1

Views: 33

Answers (1)

jkang
jkang

Reputation: 549

Answering for anyone else wondering this:

valgrind has a tool called lackey (https://valgrind.org/docs/manual/lk-manual.html) which has an option --trace-mem=yes that will perform a memory trace:

valgrind --tool=lackey --trace-mem=yes --log-file=<log file> <app>

Upvotes: 2

Related Questions