[prev in list] [next in list] [prev in thread] [next in thread]
List: openbsd-tech
Subject: systat(1) vmstat memory KB -> MB
From: Mark Lumsden <mark () showcomplex ! com>
Date: 2011-04-29 6:31:37
Message-ID: 20110429063137.GA8148 () d520 ! m ! l
[Download RAW message or body]
This allows the memory stats in vmstat view to be viewed in MB.
ok/comments?
-mark
Index: systat.1
===================================================================
RCS file: /cvs/src/usr.bin/systat/systat.1,v
retrieving revision 1.92
diff -u -p -r1.92 systat.1
--- systat.1 29 Apr 2011 05:48:04 -0000 1.92
+++ systat.1 29 Apr 2011 06:22:17 -0000
@@ -444,6 +444,9 @@ virtual memory, that is, the amount of m
needed if all processes were resident at the same time.
Finally, the last column shows the amount of physical memory
on the free list.
+Pressing
+.Ic M
+displays these statistics in megabytes instead of the default kilobytes.
.Pp
Below the memory display is a list of the average number of processes
(over the last refresh interval) that are runnable
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/systat/main.c,v
retrieving revision 1.59
diff -u -p -r1.59 main.c
--- main.c 5 Apr 2011 07:35:32 -0000 1.59
+++ main.c 29 Apr 2011 06:22:16 -0000
@@ -70,7 +70,8 @@ WINDOW *wnd;
int CMDLINE;
char timebuf[26];
char uloadbuf[TIMEPOS];
-
+int mempref = 1;
+char memchar = 'K';
int ucount(void);
void usage(void);
Index: systat.h
===================================================================
RCS file: /cvs/src/usr.bin/systat/systat.h,v
retrieving revision 1.17
diff -u -p -r1.17 systat.h
--- systat.h 31 Mar 2011 06:12:34 -0000 1.17
+++ systat.h 29 Apr 2011 06:22:17 -0000
@@ -71,6 +71,8 @@ extern int verbose;
extern int nflag;
extern char uloadbuf[];
extern char timebuf[];
+extern int mempref;
+extern char memchar;
struct inpcb;
Index: vmstat.c
===================================================================
RCS file: /cvs/src/usr.bin/systat/vmstat.c,v
retrieving revision 1.73
diff -u -p -r1.73 vmstat.c
--- vmstat.c 19 Nov 2010 18:35:16 -0000 1.73
+++ vmstat.c 29 Apr 2011 06:22:17 -0000
@@ -223,7 +223,8 @@ labelkre(void)
{
int i, j, l;
- mvprintw(MEMROW, MEMCOL, " memory totals (in KB)");
+ mvprintw(MEMROW, MEMCOL, " memory totals (in %cB)",
+ memchar);
mvprintw(MEMROW + 1, MEMCOL, " real virtual free");
mvprintw(MEMROW + 2, MEMCOL, "Active");
mvprintw(MEMROW + 3, MEMCOL, "All");
@@ -376,7 +377,7 @@ showkre(void)
addch(cpuchar[c]);
}
-#define pgtokb(pg) ((pg) * (s.uvmexp.pagesize / 1024))
+#define pgtokb(pg) (((pg) * (s.uvmexp.pagesize / 1024)) / mempref)
putint(pgtokb(s.uvmexp.active), MEMROW + 2, MEMCOL + 7, 8);
putint(pgtokb(s.uvmexp.active + s.uvmexp.swpginuse), /* XXX */
@@ -476,6 +477,15 @@ vm_keyboard_callback(int ch)
case 'z':
if (state == RUN)
getinfo(&s1);
+ break;
+ case 'M':
+ if (mempref == 1) {
+ mempref = 1024;
+ memchar = 'M';
+ } else {
+ mempref = 1;
+ memchar = 'K';
+ }
break;
}
return (keyboard_callback(ch));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic