Sponsored Content
Top Forums Shell Programming and Scripting Script to record max memory usage of program Post 303021454 by MadeInGermany on Thursday 9th of August 2018 01:34:13 PM
Old 08-09-2018
When a page fault occurs then something is paged in or out, usually from or to the swap space.
If you run
Code:
vmstat 2

you see it listed as si (swap in) or so (swap out).
Here is a suggestion for a bash script that monitors a given PID, and displays the maximum RSS memory (kilobyte of RAM used).
Code:
#!/bin/bash
[[ $1 =~ ^[0-9]+$ ]] || {
  echo "usage:
  ${0}: <pid>"
  exit 1
}
pid=$1
ps -fp $pid
max=0
while :
do
  rss=$(ps -o rss= -p $pid)
  if [[ $rss -gt $max ]]
  then
    max=$rss
    echo "maxRSS (kb): $max"
  fi
  sleep 10
done

This User Gave Thanks to MadeInGermany For This Post:
 

10 More Discussions You Might Find Interesting

1. AIX

ulimits max locked memory virtual memory

Hi, Would any one be so kind to explain me : are ulimits defined for each user seperately ? When ? Specialy what is the impact of : max locked memory and virtual memory on performance of applications for a user. Many thanks. PS : this is what I can see in MAN : ulimit ] ... (5 Replies)
Discussion started by: big123456
5 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

4. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

5. Solaris

restrcit physical memory with zone.max-locked-memory

Is it possible to restrict physical memory in solaris zone with zone.max-locked-memory just like we can do with rcapd ? I do not want to used rcapd (1 Reply)
Discussion started by: fugitive
1 Replies

6. Shell Programming and Scripting

help in high memory usage alert script

can any one please help me to shell script high memory usage alert (6 Replies)
Discussion started by: robo
6 Replies

7. Shell Programming and Scripting

Help creating a timestamp script to record mem usage

Hi, I'm looking into doing a few performance tweaks by adjusting my max memory on a few lpars. I would to create a time stamp script so i could review it for a week and determine how much space i can lower my max memory to so i could reclaim and allocate that memory to where it is needed the... (2 Replies)
Discussion started by: vpundit
2 Replies

8. AIX

Script to check the memory usage in AIX

Hello Everyone, I'm looking for a efficient script that monitors the memory usage on AIX and send email alerts when it reaches certain point. Q) need to get alerts, when the memory usage exceed 90% on AIX? or Q) Need to get alerts when available free Memory is 1G or 10% etc Any idea... (3 Replies)
Discussion started by: System Admin 77
3 Replies

9. Shell Programming and Scripting

Shell script to calculate the max cpu usage from the main script

Hi All, I have a script which does report the cpu usuage, there are few output parameter/fields displayed from the script. My problem is I have monitor the output and decide which cpu number (column 2) has maximum value (column 6). Since the output is displayed/updated every seconds, it's very... (1 Reply)
Discussion started by: Optimus81
1 Replies

10. UNIX for Dummies Questions & Answers

Memory usage per user,percent usage,sytem time in ksh

Let's say i have 20 users logged on Server. How can I know how much memory percent used each of them is using with system time in each user? (2 Replies)
Discussion started by: roy1912
2 Replies
Wiki::Toolkit::Plugin::RSS::Reader(3pm) 		User Contributed Perl Documentation		   Wiki::Toolkit::Plugin::RSS::Reader(3pm)

NAME
Wiki::Toolkit::Plugin::RSS::Reader - retrieve RSS feeds for inclusion in Wiki::Toolkit nodes DESCRIPTION
Use this Wiki::Toolkit plugin to retrieve an RSS feed from a given URL so that you can include it in a wiki node. SYNOPSIS
use Wiki::Toolkit::Plugin::RSS::Reader; my $rss = Wiki::Toolkit::Plugin::RSS::Reader->new( url => 'http://example.com/feed.rss' ); my @items = $rss->retrieve; USAGE
This is a plugin for Wiki::Toolkit, a toolkit for building wikis; therefore please consult the documentation for Wiki::Toolkit for relevant information. This module can, however, be used standalone if you wish. METHODS
"new" my $rss = Wiki::Toolkit::Plugin::RSS::Reader->new([options]); Create a new RSS reader. Valid options are "url" or "file" (a path to an RSS file); only one can be specified. "retrieve" my @items = $rss->retrieve; "retrieve" will return an array of hashes, one for each item in the RSS feed. The hashes contain three items, "title", "link", and "description". If the URL or file you specified cannot be retrieved/read, "retrieve" will return undef rather than blowing up and surprising the person reading your wiki. If you want, you can specify "debug" to be 1 in the options to "new", which will cause the module to croak instead of failing silently. AUTHOR
Earle Martin (EMARTIN@cpan.org) The Wiki::Toolkit team, (http://www.wiki-toolkit.org/) LEGAL
Copyright 2004 Earle Martin. Copyright 2006 the Wiki::Toolkit team. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2009-10-25 Wiki::Toolkit::Plugin::RSS::Reader(3pm)
All times are GMT -4. The time now is 04:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy