3

I'm looking for a tool which can help me to generate a memory accesses graph. I'm trying to optimize a search algorithm (written in c) and it would be very useful to know how the memory accesses are performed in order to optimize the memory accesses pattern.

I heard that cachegrind from valgrind could help me, but I think is not exactly what I'm looking for as I think it doesn't generate a trace of memory accesses and I already know the other information that can show me using the PAPI library.

The graph I want to generate has in the x axis the memory access order and in the y axis the memory address space (absolute or relative memory directions)

Gerard Garcia
  • 125
  • 1
  • 10
  • 1
    FWIW, here's how I would approach that optimization. I would *[use this method](http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux/378024#378024)*. If there is some pattern of memory access causing some instructions to take a high percent of time due to cache misses, the probability of stopping exactly in those locations is equal to that percent. – Mike Dunlavey Jan 15 '12 at 18:30

2 Answers2

0

If you're using gcc or the gnu std C library, the malloc and free hooks might help. https://www.gnu.org/software/libc/manual/html_node/Hooks-for-Malloc.html#Hooks-for-Malloc

sirlark
  • 2,187
  • 2
  • 18
  • 28
0

Some tools in this project do what you want: http://www.inf.usi.ch/faculty/hauswirth/research/TraceVisualization.html I don't know if you can download them anywhere or ask them to share a copy, I used them because I was a student of this professor!

Marco
  • 588
  • 1
  • 4
  • 15