views:

348

answers:

2

Is there any ready-to-use solution to log the memory consumption from the start of the system? I'd like to log the data to simple text file or some database so I can analyze it later.

I'm working on Linux 2.4-based embedded system. I need to debug the problem related to memory consumption. My application automatically start on every system start. I need the way to get the data with timestamps from regular intervals (as often as possible), so I can track down problem.

The symptoms of my problem: when system starts it launched my main application and GUI to visualize the main parameters of the system. GUI based on GTK+ (X server). If I disable GUI and X server then my application works OK. If I enable GUI and X server it does not work when I have 256 MiB or 512 MiB of physical memory installed on the motherboard. If I have 1 GiB of memory installed then everything is OK.

+1  A: 

You could put something like

vmstat X >> mylogfile

into a startup script. Since your application is already in startup you could just add this line to the end of the initialization script your application is already using. (where X is # of seconds between log messages)

Steve B.
Thanks for the hint, though I need to log the data more often then every second.
bialix
+2  A: 

A small script like

rm memory.log
while true; do free >> memory.log; sleep 1; done
drhirsch
indeed, this is very close to what I need. I can add timestamps myself.
bialix