[Techtalk] Help with memory units in top (or other ways to monitor per process system resource consumption)

Terry tech at futurecourse.com
Fri Jun 12 14:56:02 UTC 2015


Hi Camilla,

On 12/06/2015 01:05, Camilla wrote:
> Hi chixxorrs!
> 
> I am running some data analysis processes on a Linux and I need to monitor
> the system resources that these processes consume.
> I am piping batched outputs from top with a 10s delay into a file and then
> checking that. My problem is that top displays the memory in the VIRT
> column in what I assume is megabytes.
> 
> Is there any way to make top toggle the units (ie make it display the mem
> in bytes)? A look in the man pages suggested the -M option flag, but
> unfortunately that only toggles the units in the memory stats in the top
> header.
> Googling has not returned anything productive.
> 
> The nix flavour of the day is Amazon Linux.
> 
> 
> In short:
> 1. Can I change the memory units in top?
> 2. What other ways could I monitor the resource usage of a particular
> process?
> (Prefer shell tools.)
> 
> Kind regards,
> Camilla

1. If you press 'e' while top is running it cycles through the various
memory display options.  I'm pretty sure kb is the default and the
lowest division it will go.  Pressing 'E' cycles the total memory but
again, kb is the lowest division it will go.

The limiting factor in displaying values in top & top-like applications
is column size.  That's probably why display in bytes is not an option
as it would make the column too wide and mess up the display.

I like atop myself but I think it's subject to the same limitations.
http://www.atoptool.nl/ It's available as a package in Debian.  No clue
about Amazon Linux.

I've used pmap on occasion but again, memory display is in kb. 'pmap -x
<pid>'

Sorry I couldn't be of more help but I've had no cause to need the
memory in bytes. I'm not really clear on what it is you want to
ultimately do with the data you're accumulating so I don't have any
other suggestions for you.   Possible you could script a conversion of
the VIRT column before you do whatever it is you need to do with the data?

-- 
Terry



More information about the Techtalk mailing list