#define ALIMEMORYWATCHER_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
+
/* $Id$ */
+
//_________________________________________________________________________
-/*Basic Memory Leak utility.
-
- You can use this tiny class to *see* if your program is leaking.
- Usage:
- AliMemoryWatcher memwatcher;
- some program loop on events here {
- if ( nevents % x == 0 )
- {
- // take a sample every x events
- memwatcher.watch(nevents);
- }
- }
- TFile f("out.root","RECREATE");
- memwatcher.write();
- f.Close();
- In the output root file you'll get 3 graphs representing
- the evolAliPHOSon, as a function of the number of events, of :
- - VSIZE is the virtual size (in KBytes) of your program, that is sort of
- the total memory used
- - RSSIZE is the resident size (in KBytes), that is, the part of your
- program which is really in physical memory.
- - TIME is an estimate of time per event (really it's the time elasped
- between two calls to watch method)
- WARNING: this is far from a bulletproof memory report (it's basically
- using UNIX command ps -h -p [PID] -o vsize,rssize to do its job).
- It has only been tested on Linux so far.
-
- But by fitting the VSIZE by a pol1 under ROOT, you'll see right away
- by how much your program is leaking.
-*/
+//Basic Memory Leak utility.
+//
+// You can use this tiny class to *see* if your program is leaking.
+// Usage:
+// AliMemoryWatcher memwatcher;
+// some program loop on events here {
+// if ( nevents % x == 0 )
+// {
+// // take a sample every x events
+// memwatcher.watch(nevents);
+// }
+// }
+// TFile f("out.root","RECREATE");
+// memwatcher.write();
+// f.Close();
+// In the output root file you'll get 3 graphs representing
+// the evolAliPHOSon, as a function of the number of events, of :
+// - VSIZE is the virtual size (in KBytes) of your program, that is sort of
+// the total memory used
+// - RSSIZE is the resident size (in KBytes), that is, the part of your
+// program which is really in physical memory.
+// - TIME is an estimate of time per event (really it's the time elasped
+// between two calls to watch method)
+// WARNING: this is far from a bulletproof memory report (it's basically
+// using UNIX command ps -h -p [PID] -o vsize,rssize to do its job).
+// It has only been tested on Linux so far.
+//
+// But by fitting the VSIZE by a pol1 under ROOT, you'll see right away
+// by how much your program is leaking.
+//
//*-- Author: Laurent Aphecetche(SUBATECH)
+
// --- ROOT system ---
+
#include "TObject.h"
class TH2;
class TGraph;
{
public:
AliMemoryWatcher(UInt_t maxsize=10000);
- AliMemoryWatcher(AliMemoryWatcher& mw);
- AliMemoryWatcher(const AliMemoryWatcher & watcher) {
- // copy ctor: no implementation yet
- Fatal("cpy ctor", "not implemented") ;
- }
+ AliMemoryWatcher(const AliMemoryWatcher& mw);
~AliMemoryWatcher() ;
void Watch(Int_t x);
TGraph* GraphRSSIZE(void);
TGraph* GraphTIME(void);
TH2* Frame(void) const ;
- void Write(void);
+ Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0);
AliMemoryWatcher & operator = (const AliMemoryWatcher &) { return *this; }
private:
Int_t fPID; // PID of the process to watch