Given my recent problems caused by Sage assuming 'top' existed, I 
decided to write some code which gives at least some of the information 
of top (see full usage below). It basically gives data by the system 
level, and by the process level.

drkir...@smudge:[~] $ ./a.out physical_ram_in_MB
8192
drkir...@smudge:[~] $ ./a.out processor_speed
1200
drkir...@smudge:[~] $ ./a.out physical_processors
2

Now find information about PID 1877 (data below is in MB)

drkir...@smudge:[~] $ ./a.out image_size 1877
377.5
drkir...@smudge:[~] $ ./a.out resident_size 1877
188.2

Below is what is implemented so far. Can anyone think of anything else 
useful, that perhaps might be needed for gathering information for bug 
reports? I'll then implement what I can of these, using system calls.

Note I've implement the load averages in two ways:

* System as a whole
* Processors available to Sage, which might have a very different load 
average if its running in a Solaris Zone or as a virtual machine with 
only a limited number of processors available.

My intension is to add something to Sage so this sort of information can 
be found on Solaris. I'll leave it to others to get the data from linux, 
OS X etc. There is more of a need on Solaris, as 'top' which is 
currently called to get memory usage is not universally implemented. 
Also, as a trac item shows, using 'top' causes timeouts in one package 
as this is called thousands of times and takes a second each time.

Dave

drkir...@smudge:[~] $ ./a.out
Usage:
The following 3 commands apply to one single process of a given PID:
./a.out image_size                  PID  (Image size in MB)
./a.out resident_size               PID  (Resident size in MB)
./a.out process_priority            PID  (Priority)

The following 5 commands apply to the system
./a.out physical_ram_in_MB               (RAM, in MB in system)
./a.out processor_speed                  (CPU speed in MHz, rounded to 
the nearest integer)
./a.out physical_processors              (Number of physical CPUs)
./a.out system_load_averages             (1, 5 and 15 minute load 
averages for the system)
./a.out processor_set_load_averages      (Load averages for the 
processors available)
./a.out platform                         (SUNW,Sun-Blade-1500, 
SUNW,Sun-Fire-T200 etc)
./a.out solaris_version                  (The version of Solaris (7, 8, 
9, 10, 11 etc)

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to