OpenBSD CVS

CVS log for src/usr.bin/top/machine.h


[BACK] Up to [local] / src / usr.bin / top

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.32 / (download) - annotate - [select for diffs], Sat Sep 10 16:58:51 2022 UTC (20 months, 1 week ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, HEAD
Changes since 1.31: +1 -2 lines
Diff to previous 1.31 (colored)

top(1): remove last vestiges of "last pid" support

millert@ removed most of the "last pid" support from top(1) in 1997.
See, e.g. top/machine.c,v1.7:

http://cvsweb.openbsd.org/src/usr.bin/top/machine.c?rev=1.7&content-type=text/x-cvsweb-markup

Let's remove the rest of it:

- Eliminate system_info.last_pid.

- Remove mpid parameter and "last pid" printing code from i_loadave().

Link: https://marc.info/?l=openbsd-tech&m=166277253606823&w=2

ok millert@

Revision 1.31 / (download) - annotate - [select for diffs], Wed Aug 26 16:21:28 2020 UTC (3 years, 8 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.30: +4 -3 lines
Diff to previous 1.30 (colored)

Add "t" to toggle the display of routing tables

Swap the WAIT column with RTABLE (and vice versa);  WAIT is wide enough to
fit RTABLE, somewhat adds additional value to STATE and seems therefore most
appropiate to hide in favour of RTABLE.

Filtering rtables with "T" does not toggle the column, just like filtering
users with "u" does not toggle between user and thread id.

Feedback jmc
OK remi

Revision 1.30 / (download) - annotate - [select for diffs], Sun Aug 23 21:11:55 2020 UTC (3 years, 8 months ago) by kn
Branch: MAIN
Changes since 1.29: +3 -1 lines
Diff to previous 1.29 (colored)

Filter by routing table

"-T-0" for processes outside the default routing table, "-T3" for those in
a specific one;  same semantics as with other filters.

Manual wording and command line flag taken from pgrep(1) being the only way
to identify processes by routing table;  After netstat(1)'s recent addition
of "-R", filtering in top makes for handy tooling around rtable(4).

"looks good to me" millert
OK remi

Revision 1.29 / (download) - annotate - [select for diffs], Thu Jun 25 20:38:41 2020 UTC (3 years, 10 months ago) by kn
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

Remove unused "remaining" member in struct handle

Only ever set or decremented since import with machine.c r1.1 (1997);

While here, simplify the skip semantics behind the scroll functionality.

OK millert

Revision 1.28 / (download) - annotate - [select for diffs], Mon Jan 6 20:05:10 2020 UTC (4 years, 4 months ago) by zhuk
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.27: +2 -1 lines
Diff to previous 1.27 (colored)

Implement scrolling in top(1) using 9 and 0 keys.

Planned improvements: scroll position displaying, using arrow/pgup/pgdown keys.

okay tedu@

Revision 1.27 / (download) - annotate - [select for diffs], Tue Oct 8 20:51:03 2019 UTC (4 years, 7 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

Simplify threads flag handling

Instead of always passing the threads flag which decides whether other
function arguments are used or not, make callers pass those arguments or
NULL depending on the threads flag.

This reflects better how thread IDs are shown in place of user names/IDs.

OK millert

Revision 1.26 / (download) - annotate - [select for diffs], Sun Oct 6 15:08:54 2019 UTC (4 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.25: +5 -4 lines
Diff to previous 1.25 (colored)

Avoid gasting around get_process_info()

get_process_info() returns a pointer to the global handle later only be
used in format_next_process();  treat this struct handle as such without
casting the pointer to caddr_t and back again.

No object change.
OK millert deraadt

Revision 1.25 / (download) - annotate - [select for diffs], Sat Nov 17 23:10:08 2018 UTC (5 years, 6 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.24: +3 -1 lines
Diff to previous 1.24 (colored)

Add new KERN_CPUSTATS sysctl(2) so we can identify offline CPUs.

Because of hw.smt we need a way to determine whether a given CPU is "online"
or "offline" from userspace.  KERN_CPTIME2 is an array, and so cannot be
cleanly extended for this purpose, so add a new sysctl(2) KERN_CPUSTATS
with an extensible struct.  At the moment it's just KERN_CPTIME2 with a
flags member, but it can grow as needed.

KERN_CPUSTATS appears to have been defined by BSDi long ago, but there are
few (if any) packages in the wild still using the symbol so breakage in ports
should be near zero.  No other system inherited the symbol from BSDi, either.

Then, use the new sysctl(2) in systat(1) and top(1):

  - systat(1) draws placeholder marks ('-') instead of percentages for
    offline CPUs in the cpu view.

  - systat(1) omits offline CPU ticks when drawing the "big bar" in
    the vmstat view.  The upshot is that the bar isn't half idle when
    half your logical CPUs are disabled.

  - top(1) does not draw lines for offline CPUs; if CPUs toggle on or
    offline in interactive mode we redraw the display to expand/reduce
    space for the new/missing CPUs.  This is consistent with what some
    top(1) implementations do on Linux.

  - top(1) omits offline CPUs from the totals when CPU totals are
    combined into a single line (the '-1' flag).

Originally prompted by deraadt@.  Discussed endlessly with deraadt@,
ketennis@, and sthen@.  Tested by jmc@ and jca@.  Earlier versions also
discussed with jca@.  Earlier versions tested by jmc@, tb@, and many
others.

docs ok jmc@, kernel bits ok ketennis@, everything ok sthen@,
"Is your stuff in yet?" deraadt@

Revision 1.24 / (download) - annotate - [select for diffs], Fri Oct 5 18:56:57 2018 UTC (5 years, 7 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.23: +0 -2 lines
Diff to previous 1.23 (colored)

Revert KERN_CPTIME2 ENODEV changes in kernel and userspace.

ok kettenis deraadt

Revision 1.23 / (download) - annotate - [select for diffs], Wed Sep 26 17:23:13 2018 UTC (5 years, 7 months ago) by cheloha
Branch: MAIN
Changes since 1.22: +3 -1 lines
Diff to previous 1.22 (colored)

KERN_CPTIME2: set ENODEV if the CPU is offline.

This lets userspace distinguish between idle CPUs and those that are
not schedulable because hw.smt=0.

A subsequent commit probably needs to add documentation for this
to sysctl.2 (and perhaps elsewhere) after the dust settles.

Also included here are changes to systat(1) and top(1) that account
for the ENODEV case and adjust behavior accordingly:

 - systat(1)'s cpu view prints placeholder marks ('-') instead of
   percentages for each state if the given CPU is offline.

 - systat(1)'s vmstat view checks for offline CPUs when computing the
   machine state total and excludes them, so the CPU usage graph
   only represents the states for online CPUs.

 - top(1) does not draw CPU rows for offline CPUs when the view is
   redrawn.  If CPUs "go offline", percentages for each state are
   replaced by placeholder marks ('-'); the view will need to be
   redrawn to remove these rows.  If CPUs "go online" the view will
   need to be redrawn to show these new CPUs.  In "combined CPU" mode,
   the count and the state totals only represent online CPUs.

Ports using KERN_CPTIME2 will need to be updated.  The changes
described above to make systat(1) and top(1) aware of the ENODEV
case *and* gracefully handle a changing HW_NCPUONLINE while the
application is running are not necessarily appropriate for each
and every port.

The changes described above are so extensive in part to demonstrate
one way a program *might* be made robust to changing CPU availability.
In particular, changing hw.smt after boot is an extremely rare event,
and this needs to be weighed when updating ports.

The logic needed to account for the KERN_CPTIME2 ENODEV case is
very roughly:

	if (sysctl(...) == -1) {
		if (errno != ENODEV) {
			/* Actual error occurred. */
		} else {
			/* CPU is offline. */
		}
	} else {
		/* CPU is online and CPU states were set by sysctl(2). */
	}

Prompted by deraadt@.  Basic idea for ENODEV from kettenis@.  Discussed at
length with kettenis@.  Additional testing by tb@.

No complaints from hackers@ after a week.

ok kettenis@, "I think you should commit [now]" deraadt@

Revision 1.22 / (download) - annotate - [select for diffs], Sat Sep 22 16:50:35 2018 UTC (5 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

Use user_from_uid() and uid_from_user() directly.  The wrappers
in username.c are now so simple there is no longer a good reason
to use them.  OK deraadt@

Revision 1.21 / (download) - annotate - [select for diffs], Thu Sep 13 15:23:32 2018 UTC (5 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

Fix warnings caused by user_from_uid() and group_from_gid() now
returning const char *.

Revision 1.20 / (download) - annotate - [select for diffs], Wed May 6 07:53:29 2015 UTC (9 years ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored)

Display thread IDs instead of the name of the process's owner when "-H"
is used.

The rationnal is that when you're looking at threads you're generally
already filtereing by PID and this allow you to see which thread is a
pig.

Written some time ago with mikeb@

ok sthen@, krw@, guenther@

Revision 1.19 / (download) - annotate - [select for diffs], Mon Jan 19 01:53:18 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.18: +2 -1 lines
Diff to previous 1.18 (colored)

like in ps(1), fetch the FSCALE value using sysctl rather than using
the header version
ok guenther

Revision 1.18 / (download) - annotate - [select for diffs], Wed Sep 17 01:56:54 2014 UTC (9 years, 8 months ago) by dlg
Branch: MAIN
Changes since 1.17: +3 -1 lines
Diff to previous 1.17 (colored)

if there are more than 8 cpus, default to combined cpu stats (like
you passed -1 on the command line).

ok kettenis@ tedu@

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jun 5 18:52:53 2012 UTC (11 years, 11 months ago) by brynet
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.16: +2 -1 lines
Diff to previous 1.16 (colored)

Add support for hiding a user's processes in top.

feedback & ok lum@

Revision 1.16 / (download) - annotate - [select for diffs], Sun Apr 10 03:20:59 2011 UTC (13 years, 1 month ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Switch back from KERN_PROC2/kinfo_proc2 to KERN_PROC/kinfo_proc now
that we've got name we want for the API we want

"ZAP!" deraadt@

Revision 1.15 / (download) - annotate - [select for diffs], Tue May 29 00:56:56 2007 UTC (16 years, 11 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Instead of using hand-crafted redraws minimizing screen updates, use curses.
Enables nice things like process highlighting without hurting the brain.
ok deraadt@

Revision 1.14 / (download) - annotate - [select for diffs], Sun Dec 4 23:10:06 2005 UTC (18 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.13: +2 -1 lines
Diff to previous 1.13 (colored)

support for toggling thread viewing.
ok brad, hints from jmc

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jun 8 22:36:43 2005 UTC (18 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

Multi-cpu support for top.  Each cpu now gets its own stats line.
Based on work by todd@ at the hackathon.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Oct 7 06:26:12 2004 UTC (19 years, 7 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.11: +4 -1 lines
Diff to previous 1.11 (colored)

introduce -p option and p command to only show a single process.
From Patrick Latifi. ok deraadt@ millert@

Revision 1.11 / (download) - annotate - [select for diffs], Sun Jun 13 18:49:02 2004 UTC (19 years, 11 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.10: +1 -2 lines
Diff to previous 1.10 (colored)

Typos in comments and a redundant prototype. From Brian Poole via jmc@
ok jmc@

Revision 1.10 / (download) - annotate - [select for diffs], Sun May 9 22:14:15 2004 UTC (20 years ago) by deraadt
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

spaces

Revision 1.9 / (download) - annotate - [select for diffs], Mon Jul 7 21:36:52 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

protos

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jun 15 16:24:44 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

use uid_t and fix some sign compare warnings; OK krw@ and deraadt@

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jun 13 21:52:25 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +33 -35 lines
Diff to previous 1.6 (colored)

readable code

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jul 15 17:20:36 2002 UTC (21 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.5: +29 -1 lines
Diff to previous 1.5 (colored)

license change from William LeFebvre <wnl@groupsys.com>; top is now BSD
licensed.  this same license will show up on his next release as well.

Revision 1.5 / (download) - annotate - [select for diffs], Wed Jun 12 06:07:16 2002 UTC (21 years, 11 months ago) by mpech
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

a real pid_t cleanup.

espie@ ok for make/,
deraadt@ one extra eye,
millert@ ok

Revision 1.4 / (download) - annotate - [select for diffs], Sun Feb 17 19:42:33 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.3: +4 -5 lines
Diff to previous 1.3 (colored)

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)

Revision 1.3 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:55 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.2: +7 -7 lines
Diff to previous 1.2 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Aug 22 07:16:28 1997 UTC (26 years, 9 months ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.1: +13 -7 lines
Diff to previous 1.1 (colored)

First sweep.  Prototype, type fixes, long fixes, mostly compiles with
-Wall.

Revision 1.1 / (download) - annotate - [select for diffs], Thu Aug 14 14:00:23 1997 UTC (26 years, 9 months ago) by downsj
Branch: MAIN

top 3.4, with a few changes.  Still needs more work.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.