Skip to contentSkip to conversation

XMM: monitor Linux MM inactive/active lists graphically

DISCUSSION Zlatko Calusic 2 participants 2 messages Jun 3, 2001 1 message not in the archive Memory management

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 01060222320301.23925@oscar

#1 lore raw
Quoted 8 lines · Ed Tomlinson

Zlatko,

Do you have your modified xmem available somewhere. Think it might be of interest to a few of us.

TIA
Ed Tomlinson <[email protected]>

For some time I've been trying to make a simple, yet functional web page to put some stuff there. But, HTML hacking and kernel hacking are such a different beasts... :)

XMM is heavily modified XMEM utility that shows graphically size of different Linux page lists: active, inactive_dirty, inactive_clean, code, free and swap usage. It is better suited for the monitoring of Linux 2.4 MM implementation than original (XMEM) utility.

Find it here: <URL:http://linux.inet.hr/>

Signature · 10 lines
Zlatko

P.S. I'm gladly accepting suggestion for a simple tool that would help
in static web site creation/development. I checked genpage, htmlmake
and some other utilities but in every of them I found something that I
didn't like. Tough job, that HTML authoring.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/
#2 lore raw
Quoted 6 lines

XMM is heavily modified XMEM utility that shows graphically size of different Linux page lists: active, inactive_dirty, inactive_clean, code, free and swap usage. It is better suited for the monitoring of Linux 2.4 MM implementation than original (XMEM) utility.

Find it here: <URL:http://linux.inet.hr/>

interesting. I prefer to collect data separately from viewing it, and use the following simple perl script to do so; obviously, it generates a bunch of separate files, one for each metric, suitable for traditional filtering, gnuplot, etc.

#!/bin/perl
use IO::Handle;

require 'sys/syscall.ph';

sub gettimeofday {
    $timeval = pack("LL", ());
    syscall( &SYS_gettimeofday, $timeval, 0) != -1
	or die "gettimeofday: $!";
    ($sec,$usec) = unpack("LL", $timeval);
    return $sec + 1e-6 * $usec;
}

open(S,"</proc/stat") || die("failed to open /proc/stat"); open(M,"</proc/meminfo") || die("failed to open /proc/meminfo"); open(B,"</proc/slabinfo") || die("failed to open /proc/slabinfo");

open(PI,">pi.st"); PI->autoflush(1);
open(PO,">po.st"); PO->autoflush(1);
open(SI,">si.st"); SI->autoflush(1);
open(SO,">so.st"); SO->autoflush(1);
open(CX,">ctx.st"); CX->autoflush(1);
open(MF,">free.st"); MF->autoflush(1);
open(BF,">buf.st"); BF->autoflush(1);
open(AC,">act.st"); AC->autoflush(1);
open(ID,">id.st"); ID->autoflush(1);
open(IC,">ic.st"); IC->autoflush(1);
open(IT,">it.st"); IT->autoflush(1);
open(SW,">swap.st"); SW->autoflush(1);
open(BH,">bh.st"); BH->autoflush(1);
open(IN,">inode.st"); IN->autoflush(1);
open(DE,">dentry.st"); DE->autoflush(1);

$c = 0;
$first = gettimeofday();

while (1) {
      sleep(1);
      $now = gettimeofday() - $first;

      seek(S,0,SEEK_SET);
      while (<S>) {
	  if (/^page\s+(\d+)\s+(\d+)$/) {
	      if ($c) { print PI "$now ",4*($1 - $pi),"\n"; }
	      if ($c) { print PO "$now ",4*($2 - $po),"\n"; }
	      $pi = $1;
	      $po = $2;
	      next;
	  }
	  if (/^swap\s+(\d+)\s+(\d+)$/) {
	      if ($c) { print SI "$now ",4*($1 - $si),"\n"; }
	      if ($c) { print SO "$now ",4*($2 - $so),"\n"; }
	      $si = $1;
	      $so = $2;
	      next;
	  }
	  if (/^ctxt\s+(\d+)$/) {
	      if ($c) { print CX "$now ",$1 - $cx,"\n"; }
	      $cx = $1;
	      next;
	  }
      }
      seek(M,0,SEEK_SET);
      while (<M>) {
	  if (/^MemFree:\s+(\d+) kB$/) {	print MF "$now ",$1,"\n"; next; }
	  if (/^Buffers:\s+(\d+) kB$/) {	print BF "$now ",$1,"\n"; next; }
	  if (/^Active:\s+(\d+) kB$/) {		print AC "$now ",$1,"\n"; next; }
	  if (/^Inact_dirty:\s+(\d+) kB$/) {	print ID "$now ",$1,"\n"; next; }
	  if (/^Inact_clean:\s+(\d+) kB$/) {	print IC "$now ",$1,"\n"; next; }
	  if (/^Inact_target:\s+(\d+) kB$/) {	print IT "$now ",$1,"\n"; next; }
	  if (/^Inact_target:\s+(\d+) kB$/) {	print IT "$now ",$1,"\n"; next; }
	  if (/^Swap:\s+\d+\s+(\d+)/) 	{	print SW "$now ",$1,"\n"; next; }
      }
      seek(B,0,SEEK_SET);
      while (<B>) {
	  if (/^buffer_head\s+(\d+)\s+(\d+)\s+(\d+)/) {	print BH "$now ",$1*$3/1024,"\n"; next; }
	  if (/^inode_cache\s+(\d+)\s+(\d+)\s+(\d+)/) {	print IN "$now ",$1*$3/1024,"\n"; next; }
	  if (/^dentry_cache\s+(\d+)\s+(\d+)\s+(\d+)/) {print DE "$now ",$1*$3/1024,"\n"; next; }
      }
      $c++;
}