Find the answer to your Linux question:
Results 1 to 8 of 8
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Program to view maximum RAM used


    I have been looking, with no success, for any sort of program or app that can record the amount of RAM used, during an extended period of time. I mainly intend to use it to see how much RAM and SWAP memory is used while I run huge data sets through a pipeline, which takes so long I can not be watching the memory usage all the time. Is there anything like this out there? I figured there would be but have not come across anything yet.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    4,031
    Hi and welcome

    if you want to keep it simple and on the command line, then atop or sar are for you.
    Both can keep history of performance metrics, whcih you then can go through.

    If you want some more comfort and trace multiple machines, then maybe a graphite setup is for you.
    Essentially: A daemon collects metrics, sends them to a central place and you use a web interface to look at them.

    At my workplace we use OpenTSDB, but this needs multiple machines and has a rather complicated setup.
    You must always face the curtain with a bow.

  3. #3
    Linux Newbie Rava's Avatar
    Join Date
    Jul 2007
    Location
    hacking 127.0.0.1
    Posts
    132
    As alternative, you can use "free" with an added line for date/time stamp info. I also add "_____" to fill up the line to COLUMNS 80 as a way of optical column divider.
    (This could be altered into the real COLUMNS that terminal has, but then you would need a function or for / until construct to full up the needed characters which would make the script too slow for my likes. )

    But since you want the output in a file, the divider line defaulting to 80 is a reasonable value.

    Here examples of the alias I use:
    Code:
    root@porteus:/mnt# type fx
    fx is aliased to `echo $(date +%d.%m.%Y\ %H:%M:%S) ____________________________________________________________;free -m'
    root@porteus:/mnt# fx
    11.06.2015 14:22:49 ____________________________________________________________
                 total       used       free     shared    buffers     cached
    Mem:          3393       3226        167          0         16        745
    -/+ buffers/cache:       2464        929
    Swap:         2726        208       2517
    root@porteus:/mnt# fx
    11.06.2015 19:56:40 ____________________________________________________________
                 total       used       free     shared    buffers     cached
    Mem:          3393       3199        193          0         14        409
    -/+ buffers/cache:       2775        618
    Swap:         2047        716       1331
    Please know that free prints the most relevant free memory info in the line starting with "-/+ buffers/cache"
    The number in the row of "used memory" in the last output is 2775 MB including buffers and cache, and the really "free memory" is the one just after that, in my example 618 MB.
    Meaning, currently there is 193 MB free aka unused memory, but when we add the memory currently used for buffers and cache that the kernel will free when a programs needs more memory, the then available and therefore also "free" memory amounts to 618 MB.

    It sure is also possible to only print the info you need instead of the full "free -m" output as I did above.
    Last edited by Rava; 06-11-2015 at 06:02 PM. Reason: clarification
    Cheers!
    yours truly, Rava

  4. $spacer_open
    $spacer_close
  5. #4
    Have you tried "htop" and see if there's a way to write the output to a file? I took a deeper look and this seems promising: stackoverflow.com/questions/17534591/htop-output-to-human-readable-file. I haven't tried it yet though.


    -- "Push The Outer Linux"

  6. #5
    Linux Newbie Rava's Avatar
    Join Date
    Jul 2007
    Location
    hacking 127.0.0.1
    Posts
    132
    ^

    The htop author answered (it's the first answer there) and said that it's no use using htop.

    When you want top info, use this

    top -bn1

    E.g. the first 9 lines with the header line would be like so:
    top -bn1|head -n16|tail -n10

    When you want to just know about free, use that.
    Cheers!
    yours truly, Rava

  7. #6
    Easy Peasy

    Code:
    $ inxi -tm
    Processes: Memory: MB / % used - Used/Total: 323.4/2012.9MB - top 5 active
               1: mem: 261.32MB (12.9%) command: iceweasel pid: 2989
               2: mem: 34.65MB (1.7%) command: gtk-redshift (started by: python3) pid: 2378
               3: mem: 28.45MB (1.4%) command: spacefm pid: 2376
               4: mem: 25.29MB (1.2%) command: python pid: 2389
               5: mem: 24.20MB (1.2%) command: roxterm pid: 11152
    https://code.google.com/p/inxi/wiki/Installation

    It works in Puppy. Slackware, Deb based, Rpm based, distros. Just make sure bash version is 4 or newer. Not 3. Works on busy box. Should work in porteus but I cannot say for sure since I don't run it.

  8. #7
    Linux Newbie Rava's Avatar
    Join Date
    Jul 2007
    Location
    hacking 127.0.0.1
    Posts
    132
    ^
    Porteus is pure Slackware, just a Live system with loadable and unloadable modules instead of orthodoc installed files / programs.

    Anyhow, looks neat. I needed 2 missing dependencies, but now inxi --recommends tells me all needed is there.
    Cheers!
    yours truly, Rava

  9. #8
    Linux User
    Join Date
    Jun 2012
    Location
    SF Bay area
    Posts
    312
    -->
    If you only want to know about memory use at the system level (meaning not per-process), all you need is "sar". You can either run it live to collect data and redirect the output to a file, or you can configure the CRON job to run frequently enough that the data collected acceptable for your purposes.
    Last edited by cnamejj; 08-20-2015 at 07:16 AM. Reason: typo...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •