Reputation: 960
I have a Linux program that is interspersed with calls to the system API, specifically system("top")
, so I can monitor virtual memory at various points in the program. I print the memory stats 4 times, as well as attempting to print other data in between these calls.
However, when my program is complete, it looks as if the top
command is refreshing the page, so the other data I need to print is being obliterated. I tried to add a number of iterations, as in, system("top -p pid -n 1)
but I had the same problems.
Is there a way to have a call to top
in Linux not refresh the output buffer? I don't know where else to turn. Thanks!
Upvotes: 0
Views: 135
Reputation: 100051
You can open the relevant files in /proc for yourself and present the information as you like.
Upvotes: 1