data/TWiki/MonitorDotPm.txt
author Colas Nahaboo <colas@nahaboo.net>
Sat, 26 Jan 2008 15:50:53 +0100
changeset 0 414e01d06fd5
permissions -rw-r--r--
RELEASE 4.2.0 freetown
colas@0
     1
---+ Package ==
colas@0
     2
colas@0
     3
%TOC%
colas@0
     4
Monitoring package. Instrument the code like this:
colas@0
     5
colas@0
     6
use Monitor;
colas@0
     7
Monitor::MARK("Description of event");
colas@0
     8
Monitor::MARK("Another event");
colas@0
     9
colas@0
    10
or, to monitor all the calls to a module
colas@0
    11
colas@0
    12
use Monitor;
colas@0
    13
Monitor::MonitorMethod('TWiki::Users');
colas@0
    14
colas@0
    15
or a function
colas@0
    16
colas@0
    17
use Monitor;
colas@0
    18
Monitor::MonitorMethod('TWiki::Users', 'getCanonicalUserID');
colas@0
    19
colas@0
    20
Then set the environment variable TWIKI_MONITOR to a perl true value, and
colas@0
    21
run the script from the command line e.g:
colas@0
    22
$ cd bin
colas@0
    23
$ ./view -topic Myweb/MyTestTopic
colas@0
    24
colas@0
    25
The results will be printed to STDERR at the end of the run. Two times are
colas@0
    26
shown, a time relative to the last MARK and a time relative to the first MARK
colas@0
    27
(which is always set the first time this package is used). The final column
colas@0
    28
is total memory.
colas@0
    29
colas@0
    30
NOTE: it uses /proc - so its linux specific...
colas@0
    31