2

I've taken a course about low level programming and as part of it we're tasked with developing our own version of malloc, free and realloc. The functions and the underlying algorithms are done and now i'm supposed to do a fairly detailed performance comparison between the system version and my own.

What i'm wondering is how would you go about profiling (both memory and cpu) these functions? I've looked a bit at both valgrind (i can't seem to get enough detail over time since my performance program exits too quickly) and gperftools (that seems to replace malloc with their own functions).

Any tips?

Andreas
  • 240
  • 3
  • 16
  • 2
    Lots of good suggestions here: [What can I use to profile C++ code in Linux?](http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux) – Paul R Oct 14 '13 at 12:27
  • 2
    The first thing you need is test data: a repeatable series of malloc/free/realloc calls, that you can run against your implementation as well as against the system implementation. As soon as you have that, measuring it should be easy. You can get such a series by running some program, and logging all the calls to your functions for later playback. – Kris Vandermotten Oct 14 '13 at 12:34

0 Answers0