2 * top.c a slightly modified wmtop.c -- copied from the WindowMaker and gkrelltop
4 * Modified by Brenden Matthews
6 * Modified by Adi Zaimi
8 * Derived by Dan Piponi dan@tanelorn.demon.co.uk
9 * http://www.tanelorn.demon.co.uk
10 * http://wmtop.sourceforge.net
11 * from code originally contained in wmsysmon by Dave Clark
13 * This software is licensed through the GNU General Public License.
19 * Ensure there's an operating system defined. There is *no* default
20 * because every OS has it's own way of revealing CPU/memory usage.
21 * compile with gcc -DOS ...
24 /******************************************/
26 /******************************************/
29 #define CPU_THRESHHOLD 0 /* threshhold for the cpu diff to appear */
46 #include <sys/param.h>
47 #include <sys/types.h>
48 #include <sys/ioctl.h>
53 /******************************************/
55 /******************************************/
59 * XXX: I shouldn't really use this BUFFER_LEN variable but scanf is so
60 * lame and it'll take me a while to write a replacement.
62 #define BUFFER_LEN 1024
64 #define PROCFS_TEMPLATE "/proc/%d/stat"
65 #define PROCFS_TEMPLATE_MEM "/proc/%d/statm"
66 #define PROCFS_CMDLINE_TEMPLATE "/proc/%d/cmdline"
67 #define MAX_SP 10 //number of elements to sort
70 /******************************************/
72 /******************************************/
74 /******************************************/
76 /******************************************/
78 struct sorted_process {
79 struct sorted_process *greater;
80 struct sorted_process *less;
85 * Pointer to head of process list
87 void process_find_top(struct process **, struct process **);