Logo ROOT  
Reference Guide
RooTrace.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooTrace.h,v 1.16 2007/05/11 09:11:30 verkerke Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_TRACE
17#define ROO_TRACE
18
19#include "RooLinkedList.h"
20#include <map>
21#include <string>
22
23#define TRACE_CREATE
24#define TRACE_DESTROY
25
26class RooTrace {
27public:
28 RooTrace() ;
29 virtual ~RooTrace() {} ;
30
31 static void create(const TObject* obj) ;
32 static void destroy(const TObject* obj) ;
33
34
35 static void createSpecial(const char* name, int size) ;
36 static void destroySpecial(const char* name) ;
37
38
39 static void active(Bool_t flag) ;
40 static void verbose(Bool_t flag) ;
41
42 static void dump() ;
43 static void dump(std::ostream& os, Bool_t sinceMarked=kFALSE) ;
44 static void mark() ;
45
46 static void callgrind_zero() ;
47 static void callgrind_dump() ;
48
49
50 static RooTrace& instance() ;
51
52 static void printObjectCounts() ;
53
54
55protected:
56
58
59 void dump3(std::ostream&, Bool_t sinceMarked) ;
60
61 void mark3() ;
62 void printObjectCounts3() ;
63
64 void create2(const TObject* obj) ;
65 void destroy2(const TObject* obj) ;
66
67 void create3(const TObject* obj) ;
68 void destroy3(const TObject* obj) ;
69
70 void createSpecial3(const char* name, int size) ;
71 void destroySpecial3(const char* name) ;
72
73 void addPad(const TObject* ref, Bool_t doPad) ;
74 Bool_t removePad(const TObject* ref) ;
75
80 std::map<TClass*,int> _objectCount ;
81 std::map<std::string,int> _specialCount ;
82 std::map<std::string,int> _specialSize ;
83
84 ClassDef(RooTrace,0) // Memory tracer utility for RooFit objects
85};
86
87
88#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:37
Class RooTrace controls the memory tracing hooks in all RooFit objects.
Definition: RooTrace.h:26
static void destroySpecial(const char *name)
Definition: RooTrace.cxx:103
RooTrace()
Definition: RooTrace.cxx:59
static void active(Bool_t flag)
If flag is true, memory tracing is activated.
Definition: RooTrace.cxx:133
static void dump()
Dump contents of object registry to stdout.
Definition: RooTrace.cxx:227
std::map< TClass *, int > _objectCount
Definition: RooTrace.h:80
static RooTrace * _instance
Definition: RooTrace.h:57
void dump3(std::ostream &, Bool_t sinceMarked)
Dump contents of object register to stream 'os'.
Definition: RooTrace.cxx:245
Bool_t _active
Definition: RooTrace.h:76
Bool_t removePad(const TObject *ref)
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
Definition: RooTrace.cxx:298
std::map< std::string, int > _specialSize
Definition: RooTrace.h:82
void addPad(const TObject *ref, Bool_t doPad)
static void printObjectCounts()
Definition: RooTrace.cxx:264
static void createSpecial(const char *name, int size)
Definition: RooTrace.cxx:92
static void destroy(const TObject *obj)
Register deletion of object 'obj'.
Definition: RooTrace.cxx:81
static RooTrace & instance()
Definition: RooTrace.cxx:50
static void mark()
Put marker in object list, that allows to dump contents of list relative to this marker.
Definition: RooTrace.cxx:206
void mark3()
Put marker in object list, that allows to dump contents of list relative to this marker.
Definition: RooTrace.cxx:217
Bool_t _verbose
Definition: RooTrace.h:77
void create2(const TObject *obj)
Back end function of create(), register creation of object 'obj'.
Definition: RooTrace.cxx:155
virtual ~RooTrace()
Definition: RooTrace.h:29
std::map< std::string, int > _specialCount
Definition: RooTrace.h:81
void create3(const TObject *obj)
Definition: RooTrace.cxx:183
void destroySpecial3(const char *name)
Definition: RooTrace.cxx:123
static void create(const TObject *obj)
Register creation of object 'obj'.
Definition: RooTrace.cxx:68
void printObjectCounts3()
Definition: RooTrace.cxx:271
RooLinkedList _markList
Definition: RooTrace.h:79
void destroy2(const TObject *obj)
Back end function of destroy(), register deletion of object 'obj'.
Definition: RooTrace.cxx:170
static void callgrind_dump()
Utility function to trigger dumping of callgrind counters.
Definition: RooTrace.cxx:310
static void verbose(Bool_t flag)
If flag is true, a message will be printed at each object creation or deletion.
Definition: RooTrace.cxx:143
void destroy3(const TObject *obj)
Back end function of destroy(), register deletion of object 'obj'.
Definition: RooTrace.cxx:195
void createSpecial3(const char *name, int size)
Definition: RooTrace.cxx:114
RooLinkedList _list
Definition: RooTrace.h:78
Mother of all ROOT objects.
Definition: TObject.h:37
static const std::string name("name")