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 
26 class RooTrace {
27 public:
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 
55 protected:
56 
57  static RooTrace* _instance ;
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
RooTrace::_objectCount
std::map< TClass *, int > _objectCount
Definition: RooTrace.h:80
RooTrace::removePad
Bool_t removePad(const TObject *ref)
RooTrace::instance
static RooTrace & instance()
Definition: RooTrace.cxx:50
RooTrace::_verbose
Bool_t _verbose
Definition: RooTrace.h:77
RooTrace::create
static void create(const TObject *obj)
Register creation of object 'obj'.
Definition: RooTrace.cxx:68
RooTrace::_specialCount
std::map< std::string, int > _specialCount
Definition: RooTrace.h:81
RooTrace::callgrind_zero
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
Definition: RooTrace.cxx:298
RooTrace::active
static void active(Bool_t flag)
If flag is true, memory tracing is activated.
Definition: RooTrace.cxx:133
RooTrace::addPad
void addPad(const TObject *ref, Bool_t doPad)
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
RooTrace::mark
static void mark()
Put marker in object list, that allows to dump contents of list relative to this marker.
Definition: RooTrace.cxx:206
bool
RooTrace::~RooTrace
virtual ~RooTrace()
Definition: RooTrace.h:29
RooTrace::createSpecial3
void createSpecial3(const char *name, int size)
Definition: RooTrace.cxx:114
RooTrace::create3
void create3(const TObject *obj)
Definition: RooTrace.cxx:183
RooTrace::_active
Bool_t _active
Definition: RooTrace.h:76
RooTrace::printObjectCounts3
void printObjectCounts3()
Definition: RooTrace.cxx:271
RooTrace::RooTrace
RooTrace()
Definition: RooTrace.cxx:59
RooTrace::_instance
static RooTrace * _instance
Definition: RooTrace.h:57
RooTrace::_specialSize
std::map< std::string, int > _specialSize
Definition: RooTrace.h:82
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooLinkedList
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
RooTrace::destroySpecial3
void destroySpecial3(const char *name)
Definition: RooTrace.cxx:123
RooTrace::create2
void create2(const TObject *obj)
Back end function of create(), register creation of object 'obj'.
Definition: RooTrace.cxx:155
RooTrace::createSpecial
static void createSpecial(const char *name, int size)
Definition: RooTrace.cxx:92
RooTrace::printObjectCounts
static void printObjectCounts()
Definition: RooTrace.cxx:264
RooTrace::destroySpecial
static void destroySpecial(const char *name)
Definition: RooTrace.cxx:103
RooLinkedList.h
RooTrace::dump3
void dump3(std::ostream &, Bool_t sinceMarked)
Dump contents of object register to stream 'os'.
Definition: RooTrace.cxx:245
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
RooTrace::mark3
void mark3()
Put marker in object list, that allows to dump contents of list relative to this marker.
Definition: RooTrace.cxx:217
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooTrace::_markList
RooLinkedList _markList
Definition: RooTrace.h:79
RooTrace::destroy
static void destroy(const TObject *obj)
Register deletion of object 'obj'.
Definition: RooTrace.cxx:81
name
char name[80]
Definition: TGX11.cxx:110
RooTrace
Class RooTrace controls the memory tracing hooks in all RooFit objects.
Definition: RooTrace.h:26
RooTrace::verbose
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
RooTrace::_list
RooLinkedList _list
Definition: RooTrace.h:78
RooTrace::destroy2
void destroy2(const TObject *obj)
Back end function of destroy(), register deletion of object 'obj'.
Definition: RooTrace.cxx:170
RooTrace::callgrind_dump
static void callgrind_dump()
Utility function to trigger dumping of callgrind counters.
Definition: RooTrace.cxx:310
RooTrace::destroy3
void destroy3(const TObject *obj)
Back end function of destroy(), register deletion of object 'obj'.
Definition: RooTrace.cxx:195
RooTrace::dump
static void dump()
Dump contents of object registry to stdout.
Definition: RooTrace.cxx:227