summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorkeramida <keramida@FreeBSD.org>2004-07-08 16:45:55 +0000
committerkeramida <keramida@FreeBSD.org>2004-07-08 16:45:55 +0000
commit600bdc3b5526e0f026e54672896d7ad955b9c8b4 (patch)
tree153fa5f6acfe18876ad4e529cbaf3e596408c2e2 /contrib
parent72f812830f217b50cb5b7e851b69e500996804e5 (diff)
downloadFreeBSD-src-600bdc3b5526e0f026e54672896d7ad955b9c8b4.zip
FreeBSD-src-600bdc3b5526e0f026e54672896d7ad955b9c8b4.tar.gz
Build upon the nice work of Alfred and add sorting capabilities to
the -m "io" mode of top. Approved by: alfred
Diffstat (limited to 'contrib')
-rw-r--r--contrib/top/commands.c6
-rw-r--r--contrib/top/top.c13
2 files changed, 13 insertions, 6 deletions
diff --git a/contrib/top/commands.c b/contrib/top/commands.c
index 418dc16..acb8577 100644
--- a/contrib/top/commands.c
+++ b/contrib/top/commands.c
@@ -76,8 +76,12 @@ I - same as 'i'\n\
k - kill processes; send a signal to a list of processes\n\
n or # - change number of processes to display\n", stdout);
#ifdef ORDER
- fputs("\
+ if (displaymode == DISP_CPU)
+ fputs("\
o - specify sort order (pri, size, res, cpu, time)\n", stdout);
+ else
+ fputs("\
+o - specify sort order (read, write, fault, total)\n", stdout);
#endif
fputs("\
r - renice a process\n\
diff --git a/contrib/top/top.c b/contrib/top/top.c
index 04a8775..9508e47 100644
--- a/contrib/top/top.c
+++ b/contrib/top/top.c
@@ -96,10 +96,11 @@ char *renice_procs();
#ifdef ORDER
extern int (*proc_compares[])();
+extern int (*io_compares[])();
#else
extern int proc_compare();
-#endif
extern int io_compare();
+#endif
time_t time();
caddr_t get_process_info();
@@ -567,15 +568,17 @@ restart:
/* get the current stats */
get_system_info(&system_info);
- if (displaymode == DISP_CPU) {
#ifdef ORDER
+ if (displaymode == DISP_CPU)
compare = proc_compares[order_index];
+ else
+ compare = io_compares[order_index];
#else
+ if (displaymode == DISP_CPU)
compare = proc_compare;
-#endif
- } else {
+ else
compare = io_compare;
- }
+#endif
/* get the current set of processes */
processes =
OpenPOWER on IntegriCloud