[ps_mem] - RH man page scan (#989490)

Jaromír Cápík jcapik at fedoraproject.org
Wed Aug 14 13:56:07 UTC 2013


commit 11047e58f72cb75b967e0dc9f885c029d6434d58
Author: Jaromir Capik <jcapik at redhat.com>
Date:   Wed Aug 14 15:55:42 2013 +0200

    - RH man page scan (#989490)

 ps_mem-ennobling-the-s-switch.patch |   49 +++++++++++++++++++++++++++++++++++
 ps_mem.1                            |   40 ++++++++++++++++++++++++++++
 ps_mem.spec                         |   18 +++++++++++-
 3 files changed, 105 insertions(+), 2 deletions(-)
---
diff --git a/ps_mem-ennobling-the-s-switch.patch b/ps_mem-ennobling-the-s-switch.patch
new file mode 100644
index 0000000..ccc83c4
--- /dev/null
+++ b/ps_mem-ennobling-the-s-switch.patch
@@ -0,0 +1,49 @@
+From 0736aab9093ae3043f8e2b11ecc23924ac2b7e01 Mon Sep 17 00:00:00 2001
+From: Jaromir Capik <jcapik at redhat.com>
+Date: Mon, 12 Aug 2013 14:48:03 +0200
+Subject: [PATCH] ps_mem.py: Ennobling the -s switch
+
+Previously the longopt variant of the -s switch
+didn't make much sense. This commit changes the
+--split-args switch to the --show-cmdline switch
+and adds the switch in the help/usage message
+since it was completely missing there.
+---
+ scripts/ps_mem.py | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/scripts/ps_mem.py b/scripts/ps_mem.py
+index 92be618..b30dc30 100755
+--- a/scripts/ps_mem
++++ b/scripts/ps_mem
+@@ -139,7 +139,7 @@ proc = Proc()
+ 
+ def parse_options():
+     try:
+-        long_options = ['split-args', 'help']
++        long_options = ['show-cmdline', 'help']
+         opts, args = getopt.getopt(sys.argv[1:], "shp:w:", long_options)
+     except getopt.GetoptError:
+         sys.stderr.write(help())
+@@ -151,7 +151,7 @@ def parse_options():
+     watch = None
+ 
+     for o, a in opts:
+-        if o in ('-s', '--split-args'):
++        if o in ('-s', '--show-cmdline'):
+             split_args = True
+         if o in ('-h', '--help'):
+             sys.stdout.write(help())
+@@ -176,7 +176,8 @@ def help():
+     '\n'\
+     '-h                                 Show this help\n'\
+     '-w <N>                             Measure and show process memory every N seconds\n'\
+-    '-p <pid>[,pid2,...pidN]            Only show memory usage PIDs in the specified list\n'
++    '-p <pid>[,pid2,...pidN]            Only show memory usage PIDs in the specified list\n' \
++    '-s, --show-cmdline                 Show cmdline\n'
+ 
+     return help_msg
+ 
+-- 
+1.8.3.1
+
diff --git a/ps_mem.1 b/ps_mem.1
new file mode 100644
index 0000000..b69e872
--- /dev/null
+++ b/ps_mem.1
@@ -0,0 +1,40 @@
+.\" Simple man page to ps_mem.py script
+.\" Contact fholec at redhat.com
+.TH ps_mem 1 "31 July 2013" "" ""
+.SH NAME
+ps_mem \- Memory profiling tool
+.SH SYNOPSIS
+.B ps_mem
+[\-h|\-\-help] [\-s|\-\-show\-cmdline] [\-p PID] [\-w N]
+.SH DESCRIPTION
+The ps_mem tool can determine how much RAM is used per program (not per process).
+.br
+.PP
+In detail it reports:
+.br
+.PP
+.RS
+sum(private RAM for program processes) + sum(Shared RAM for program processes).
+.br
+.RE
+.PP
+The shared RAM is problematic to calculate, and the tool automatically selects the most accurate method available for the running kernel.
+.SH OPTIONS
+.TP
+\-h \-\-help
+Show help message
+.TP
+\-s \-\-show\-cmdline
+Show complete program path with options
+.TP
+\-p PID
+Show memory consumption of process with specified PID
+.TP
+\-w N
+Report memory consumption every N seconds
+.\".SH SEE ALSO
+.\"
+.\".SH BUGS
+.\"No known bugs for this template, except you might want to replace the quotes if you copy from my blog.
+.SH AUTHOR
+Pádraig Brady <P at draigBrady.com>
diff --git a/ps_mem.spec b/ps_mem.spec
index cb3cc19..9dc2023 100644
--- a/ps_mem.spec
+++ b/ps_mem.spec
@@ -1,7 +1,7 @@
 
 Name:           ps_mem
 Version:        3.1
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Memory profiling tool
 Group:          Applications/System
 License:        LGPLv2
@@ -9,6 +9,9 @@ URL:            https://github.com/pixelb/scripts
 
 Source0:        https://raw.github.com/pixelb/scripts/961ff24c805a474080520403409872b04e18f4d9/scripts/ps_mem.py
 Source1:        http://www.gnu.org/licenses/lgpl-2.1.txt
+Source2:        ps_mem.1
+
+Patch0:         ps_mem-ennobling-the-s-switch.patch
 
 BuildArch:      noarch
 
@@ -25,22 +28,33 @@ selects the most accurate method available for the running kernel.
 
 
 %prep
+%setup -q -T -c %{name}-%{version}
+
 cp -p %{SOURCE0} %{name}
 cp -p %{SOURCE1} LICENSE
+cp -p %{SOURCE2} %{name}.1
 
 # force python3
 sed -i "s|/usr/bin/env python|%{__python3}|" %{name}
 
+%patch0 -p2
+
+
 %install
-install -Dpm755 %{name} %{buildroot}%{_bindir}/%{name}
+install -Dpm755 %{name}   %{buildroot}%{_bindir}/%{name}
+install -Dpm644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
 
 
 %files
 %doc LICENSE
 %{_bindir}/%{name}
+%{_mandir}/man1/%{name}.1*
 
 
 %changelog
+* Wed Aug 14 2013 Jaromir Capik <jcapik at redhat.com> - 3.1-4
+- RH man page scan (#989490)
+
 * Thu Jul 25 2013 Jaromir Capik <jcapik at redhat.com> - 3.1-3
 - Patching shebang to force python3 (#987036)
 


More information about the scm-commits mailing list