Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165250676
D25377.id73404.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D25377.id73404.diff
View Options
Index: bin/ps/extern.h
===================================================================
--- bin/ps/extern.h
+++ bin/ps/extern.h
@@ -48,6 +48,7 @@
char *arguments(KINFO *, VARENT *);
char *command(KINFO *, VARENT *);
char *cputime(KINFO *, VARENT *);
+char *cpunum(KINFO *, VARENT *);
int donlist(void);
char *elapsed(KINFO *, VARENT *);
char *elapseds(KINFO *, VARENT *);
Index: bin/ps/keyword.c
===================================================================
--- bin/ps/keyword.c
+++ bin/ps/keyword.c
@@ -85,6 +85,7 @@
UINT, "u", 0},
{"cpu", "CPU", NULL, "cpu-usage", 0, kvar, KOFF(ki_estcpu), UINT, "d",
0},
+ {"cpu#", "C", NULL, "on-cpu", 0, cpunum, 0, CHAR, NULL, 0},
{"cputime", "", "time", NULL, 0, NULL, 0, CHAR, NULL, 0},
{"dsiz", "DSIZ", NULL, "data-size", 0, kvar, KOFF(ki_dsize), PGTOK,
"ld", 0},
Index: bin/ps/print.c
===================================================================
--- bin/ps/print.c
+++ bin/ps/print.c
@@ -550,6 +550,19 @@
return (printtime(k, ve, secs, psecs));
}
+char *
+cpunum(KINFO *k, VARENT *ve __unused)
+{
+ char *cpu;
+
+ if (k->ki_p->ki_stat == SRUN && k->ki_p->ki_oncpu != NOCPU) {
+ asprintf(&cpu, "%d", k->ki_p->ki_oncpu);
+ } else {
+ asprintf(&cpu, "%d", k->ki_p->ki_lastcpu);
+ }
+ return (cpu);
+}
+
char *
systime(KINFO *k, VARENT *ve)
{
Index: bin/ps/ps.1
===================================================================
--- bin/ps/ps.1
+++ bin/ps/ps.1
@@ -312,6 +312,9 @@
be very young) it is possible for the sum of all
.Cm %cpu
fields to exceed 100%.
+.It Cm cpu#
+The processor number on which the process is executing (visible only on SMP
+systems).
.It Cm %mem
The percentage of real memory used by this process.
.It Cm class
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 8, 4:33 AM (17 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36210060
Default Alt Text
D25377.id73404.diff (1 KB)
Attached To
Mode
D25377: ps(1): reuse keyword "cpu" to show CPU number
Attached
Detach File
Event Timeline
Log In to Comment