summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2003-07-17 23:56:40 +0000
committerjulian <julian@FreeBSD.org>2003-07-17 23:56:40 +0000
commit788547d4cf2856cc0d849f205d6384723345026b (patch)
treeae7325b9fe8cfe61e176452c39b5dd2b7846c026 /contrib
parentab57004058eee4b698f7d9cece99440ad9b49bbb (diff)
downloadFreeBSD-src-788547d4cf2856cc0d849f205d6384723345026b.zip
FreeBSD-src-788547d4cf2856cc0d849f205d6384723345026b.tar.gz
Changes to allow top to decide whether or not to show multiple threads per
process. Option -H enables it and it is toggled at the interactive screen by 'H'. Submitted by: Jung-uk Kim <jkim@niksun.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/top/commands.c1
-rw-r--r--contrib/top/machine.h1
-rw-r--r--contrib/top/top.c23
3 files changed, 20 insertions, 5 deletions
diff --git a/contrib/top/commands.c b/contrib/top/commands.c
index 6af378bc..418dc16 100644
--- a/contrib/top/commands.c
+++ b/contrib/top/commands.c
@@ -71,6 +71,7 @@ sophisticated enough to handle those commands gracefully.\n\n", stdout);
d - change number of displays to show\n\
e - list errors generated by last \"kill\" or \"renice\" command\n\
i - toggle the displaying of idle processes\n\
+H - toggle the displaying of threads\n\
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);
diff --git a/contrib/top/machine.h b/contrib/top/machine.h
index 4f4f6af..62b321c 100644
--- a/contrib/top/machine.h
+++ b/contrib/top/machine.h
@@ -59,6 +59,7 @@ struct process_select
int idle; /* show idle processes */
int self; /* show self */
int system; /* show system processes */
+ int thread; /* show threads */
int uid; /* only this uid (unless uid == -1) */
char *command; /* only this command (unless == NULL) */
};
diff --git a/contrib/top/top.c b/contrib/top/top.c
index 1b88041..5d30e66 100644
--- a/contrib/top/top.c
+++ b/contrib/top/top.c
@@ -192,9 +192,9 @@ char *argv[];
fd_set readfds;
#ifdef ORDER
- static char command_chars[] = "\f qh?en#sdkriIuto";
+ static char command_chars[] = "\f qh?en#sdkriIutHo";
#else
- static char command_chars[] = "\f qh?en#sdkriIut";
+ static char command_chars[] = "\f qh?en#sdkriIutH";
#endif
/* these defines enumerate the "strchr"s of the commands in command_chars */
#define CMD_redraw 0
@@ -214,8 +214,9 @@ char *argv[];
#define CMD_idletog2 13
#define CMD_user 14
#define CMD_selftog 15
+#define CMD_thrtog 16
#ifdef ORDER
-#define CMD_order 16
+#define CMD_order 17
#endif
/* set the buffer for stdout */
@@ -245,6 +246,7 @@ char *argv[];
ps.self = -1;
ps.system = No;
ps.uid = -1;
+ ps.thread = No;
ps.command = NULL;
/* get preset options from the environment */
@@ -270,7 +272,7 @@ char *argv[];
optind = 1;
}
- while ((i = getopt(ac, av, "SIbinquvs:d:U:o:t")) != EOF)
+ while ((i = getopt(ac, av, "SIHbinquvs:d:U:o:t")) != EOF)
{
switch(i)
{
@@ -365,10 +367,14 @@ char *argv[];
ps.self = (ps.self == -1) ? getpid() : -1;
break;
+ case 'H':
+ ps.thread = !ps.thread;
+ break;
+
default:
fprintf(stderr, "\
Top version %s\n\
-Usage: %s [-ISbinqut] [-d x] [-s x] [-o field] [-U username] [number]\n",
+Usage: %s [-HISbinqut] [-d x] [-s x] [-o field] [-U username] [number]\n",
version_string(), myname);
exit(1);
}
@@ -955,6 +961,13 @@ restart:
}
break;
+ case CMD_thrtog:
+ ps.thread = !ps.thread;
+ new_message(MT_standout | MT_delayed,
+ " %sisplaying threads.",
+ ps.thread ? "D" : "Not d");
+ putchar('\r');
+ break;
#ifdef ORDER
case CMD_order:
new_message(MT_standout,
OpenPOWER on IntegriCloud