#8391: Temporary ugly fix: Change 'top' to 'prstat' on Solaris for 'getusage.py'
------------------------+---------------------------------------------------
Reporter: drkirkby | Owner: drkirkby
Type: defect | Status: new
Priority: major | Milestone:
Component: solaris | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------+---------------------------------------------------
The file 'getusage.py' has two main functions.
* top() - Display the output of the 'top' command for the current
process.
* get_memory_usage() - Display the memory usage in MB.
The implementation on Solaris is particularly poor for many reasons.
* The Sage function 'top()' calls the external command 'top' on Solaris,
despite the fact that 'top' has never been part of the Solaris operating
system. (The command has to be installed, but is not standard.)
* The Sage function get_memory_usage() calls the function top(), so
obviously breaks get_memory_usage() fails if the command 'top' is not
installed.
* 'top' is not very accurate on modern Solaris versions - is was OK 10+
years ago, but not now.
* You need root access to install 'top'.
* The ticket #6028 created by Micheal Abshoff with the title
"get_memory_usage() sucks performance wise on Solaris" gives a gentle hint
at one more problem.
* Running the Sage doctests brings a system to an almost standstill if
top is not installed. The non-existent 'top' is run multiple times in a
loop in an attempt to overcome some race condition.
* I believe not having 'top' is causing doctest failures, which brings
the system to an almost standstill as documented at #7153.
'''Overall, the usage of 'top' in Solaris is a disaster.''' The proper way
to get the memory usage is to use a system call, but it is going to take
some effort to sort out how to do so and is not high on the list of
priorities.
A command with similar functionality to 'top', but greater accuracy is
'/usr/bin/prstat' which comes as part of all recent versions of Solaris.
The output looks similar to that of 'top'
{{{
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
604 drkirkby 189M 106M cpu2 59 0 537:45:37 11% Xorg/1
28286 drkirkby 78M 19M sleep 32 0 244:22:50 5.2% zenity/1
15753 drkirkby 553M 517M sleep 49 0 46:10:43 0.5% VirtualBox/24
14951 drkirkby 345M 161M sleep 48 0 0:07:45 0.3% firefox-bin/20
22223 drkirkby 163M 80M sleep 59 0 0:06:58 0.0% gnome-
terminal/2
731 drkirkby 106M 26M sleep 59 0 0:14:12 0.0% gnome-
netstatus/2
719 drkirkby 113M 34M sleep 59 0 0:08:23 0.0% wnck-applet/1
7703 drkirkby 6328K 3144K cpu3 49 0 0:00:00 0.0% prstat/1
730 drkirkby 107M 26M sleep 59 0 0:09:18 0.0% mixer_applet2/1
741 root 1636K 1080K sleep 59 0 0:12:55 0.0% gnome-
netstatus/1
663 drkirkby 94M 35M sleep 59 0 0:06:55 0.0% metacity/1
294 root 4804K 2056K sleep 59 0 0:00:00 0.0% dbus-daemon/1
153 root 6396K 2824K sleep 59 0 0:00:00 0.0% picld/4
385 root 5140K 1576K sleep 59 0 0:00:00 0.0% automountd/2
270 root 4596K 1420K sleep 59 0 0:00:02 0.0% cron/1
Total: 141 processes, 389 lwps, load averages: 1.79, 1.70, 1.66
}}}
Hence I propose to replace the call to 'top' with one to 'prstat'. Despite
I know this is not the correct way to determine memory usage, using
'prstat' is at least better than the current implementation using 'top'
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8391>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.