C++ – getrusage function on embedded linux

getrusage function on embedded linux… here is a solution to the problem.

getrusage function on embedded linux

I

have a benchmark application where I evaluate the C++ framework.

I’m looking for time and memory consumption. On Linux, to get the memory occupied by the current program, I use the getrusage function. It works perfectly on my machine.

When I cross-compile this application to ARM architecture and run my code on my embedded device (which also runs linux), the memory function returns 0. The app works fine on the embedded device, just the memory function returns me 0.

Any idea of any possible solutions?

Solution

Linux versions prior to 2.6.31.14 do not support the ru_maxrss field for struct usage. Linux versions starting with 2.6.32 can. I guess the version you are running in the embedded system is earlier than the version running on the desktop.

Related Problems and Solutions