| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vmstat.c,v 1.81.8.2 2019/01/30 13:46:25 martin Exp $ */ | | 1 | /* $NetBSD: vmstat.c,v 1.81.8.3 2023/12/11 12:29:30 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1983, 1989, 1992, 1993 | | 4 | * Copyright (c) 1983, 1989, 1992, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | #ifndef lint | | 33 | #ifndef lint |
34 | #if 0 | | 34 | #if 0 |
35 | static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; | | 35 | static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; |
36 | #endif | | 36 | #endif |
37 | __RCSID("$NetBSD: vmstat.c,v 1.81.8.2 2019/01/30 13:46:25 martin Exp $"); | | 37 | __RCSID("$NetBSD: vmstat.c,v 1.81.8.3 2023/12/11 12:29:30 martin Exp $"); |
38 | #endif /* not lint */ | | 38 | #endif /* not lint */ |
39 | | | 39 | |
40 | /* | | 40 | /* |
41 | * Cursed vmstat -- from Robert Elz. | | 41 | * Cursed vmstat -- from Robert Elz. |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #include <sys/param.h> | | 44 | #include <sys/param.h> |
45 | #include <sys/uio.h> | | 45 | #include <sys/uio.h> |
46 | #include <sys/namei.h> | | 46 | #include <sys/namei.h> |
47 | #include <sys/sysctl.h> | | 47 | #include <sys/sysctl.h> |
48 | #include <sys/evcnt.h> | | 48 | #include <sys/evcnt.h> |
49 | | | 49 | |
50 | #include <uvm/uvm_extern.h> | | 50 | #include <uvm/uvm_extern.h> |
| @@ -644,39 +644,36 @@ vmstat_time(char *args) | | | @@ -644,39 +644,36 @@ vmstat_time(char *args) |
644 | } | | 644 | } |
645 | | | 645 | |
646 | void | | 646 | void |
647 | vmstat_zero(char *args) | | 647 | vmstat_zero(char *args) |
648 | { | | 648 | { |
649 | if (display_mode == RUN) | | 649 | if (display_mode == RUN) |
650 | getinfo(&s1); | | 650 | getinfo(&s1); |
651 | } | | 651 | } |
652 | | | 652 | |
653 | /* calculate number of users on the system */ | | 653 | /* calculate number of users on the system */ |
654 | static int | | 654 | static int |
655 | ucount(void) | | 655 | ucount(void) |
656 | { | | 656 | { |
657 | static int onusers = -1; | | | |
658 | int nusers = 0; | | 657 | int nusers = 0; |
659 | struct utmpentry *ehead; | | 658 | struct utmpentry *ehead; |
660 | | | 659 | |
661 | nusers = getutentries(NULL, &ehead); | | 660 | nusers = getutentries(NULL, &ehead); |
662 | | | 661 | |
663 | if (nusers != onusers) { | | 662 | if (nusers == 1) |
664 | if (nusers == 1) | | 663 | mvprintw(STATROW, STATCOL + 8, " "); |
665 | mvprintw(STATROW, STATCOL + 8, " "); | | 664 | else |
666 | else | | 665 | mvprintw(STATROW, STATCOL + 8, "s"); |
667 | mvprintw(STATROW, STATCOL + 8, "s"); | | 666 | |
668 | } | | | |
669 | onusers = nusers; | | | |
670 | return (nusers); | | 667 | return (nusers); |
671 | } | | 668 | } |
672 | | | 669 | |
673 | static float | | 670 | static float |
674 | cputime(int indx) | | 671 | cputime(int indx) |
675 | { | | 672 | { |
676 | double t; | | 673 | double t; |
677 | int i; | | 674 | int i; |
678 | | | 675 | |
679 | t = 0; | | 676 | t = 0; |
680 | for (i = 0; i < CPUSTATES; i++) | | 677 | for (i = 0; i < CPUSTATES; i++) |
681 | t += cur.cp_time[i]; | | 678 | t += cur.cp_time[i]; |
682 | if (t == 0.0) | | 679 | if (t == 0.0) |