Description: logzone is a set of classes to facilitate monitoring of
Zones in Swarm.  It is available from the swarm.org archive or from
the authors website at http://www.in-berlin.de/~rws/swarm.html

Tested with aquarium-0.03.  To build liblogzone.a, extract source and
make.  To use it, put liblogzone.a into your Makefile APPLIBS variable.

========Class hierarchy ======================

LoggingZone        - replacement for Zone

<MemLogConsumer>   - protocol
+---ASCIIMemLogger - text output
+---KISSMemLogger  - tabular output into a GUI window
+---RMemLogger     - (TODO) output capable as R input

INTERNAL:
(MemLogClassData)  - helper
(QSort)            - enhanced (Swarm)-QSort
(TextItemWithStr)  - specialized (Swarm)-TextItem

========Usages: ==============================

(0) default: sorted cumulative info in a graphics window
  ...
  initSwarm (argc, argv);

  logzone = [LoggingZone create: globalZone];

  observerSwarm = [AquariumObserverSwarm create: logzone];
  ...

(1) send alloc info (non-cumulative) to a file/stdout
  ...
  initSwarm (argc, argv);

  logzone = [LoggingZone createBegin: globalZone];
  [logzone setAsciiFilename: 0]; // to stdout
  logzone = [logzone createEnd];
  
  observerSwarm = [AquariumObserverSwarm create: logzone];
  ...

(2) set a refined logger, e.g. log cumulative info separated by commata
  to a file (make cum. the default for ascii?)
  
  logzone = [LoggingZone createBegin: globalZone];
  logger = [AsciiMemLogger createBegin: globalZone];
  [logger setCumulative];
  [logger setFilename: "testlog"];
  [logger setRecordDelim: "\n" dataDelim: ","];
  logger = [logger createEnd];
  [logzone setMemLogConsumer: logger];
  logzone = [logzone createEnd];
 
(3) log scratchZone/globalZone by replacing it with a LoggingZone

  logzone = [LoggingZone createBegin: globalZone];
  [logzone setAsciiFilename: 0]; // to stdout
  // WARNING: using a more complicated logger may result in infinite loops.
  scratchZone = [logzone createEnd];
 
(4) TODO: log in R format

(5) TODO: log in other formats (contributions!) or more graphically sophisticated

========== Analyzing with awk: =======================
Here is an example of an awk script to cumulate alloc info from
ASCII output.

BEGIN { arr[0]=0 }
{
if ( $3 in arr )
{
	if ( $2 ~ /\+/ ) 
		arr[$3] = arr[$3]+1 
	else 
		arr[$3] = arr[$3]-1
}
else
{
	if ( $2 ~ /\+/ ) 
		arr[$3] = 1
}
}
END { for ( i in arr ) print i,arr[i] }


Please send patches to:
ralf@ark.in-berlin.de
