Logo ROOT   6.10/09
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 <assert.h>
20 #include "RooLinkedList.h"
21 
22 #define TRACE_CREATE
23 #define TRACE_DESTROY
24 
25 class RooTrace {
26 public:
27  RooTrace() ;
28  virtual ~RooTrace() {} ;
29 
30  static void create(const TObject* obj) ;
31  static void destroy(const TObject* obj) ;
32 
33 
34  static void createSpecial(const char* name, int size) ;
35  static void destroySpecial(const char* name) ;
36 
37 
38  static void active(Bool_t flag) ;
39  static void verbose(Bool_t flag) ;
40 
41  static void dump() ;
42  static void dump(std::ostream& os, Bool_t sinceMarked=kFALSE) ;
43  static void mark() ;
44 
45  static void callgrind_zero() ;
46  static void callgrind_dump() ;
47 
48 
49  static RooTrace& instance() ;
50 
51  static void printObjectCounts() ;
52 
53 
54 protected:
55 
56  static RooTrace* _instance ;
57 
58  void dump3(std::ostream&, Bool_t sinceMarked) ;
59 
60  void mark3() ;
61  void printObjectCounts3() ;
62 
63  void create2(const TObject* obj) ;
64  void destroy2(const TObject* obj) ;
65 
66  void create3(const TObject* obj) ;
67  void destroy3(const TObject* obj) ;
68 
69  void createSpecial3(const char* name, int size) ;
70  void destroySpecial3(const char* name) ;
71 
72  void addPad(const TObject* ref, Bool_t doPad) ;
73  Bool_t removePad(const TObject* ref) ;
74 
79  std::map<TClass*,int> _objectCount ;
80  std::map<std::string,int> _specialCount ;
81  std::map<std::string,int> _specialSize ;
82 
83  ClassDef(RooTrace,0) // Memory tracer utility for RooFit objects
84 };
85 
86 
87 #endif
Bool_t removePad(const TObject *ref)
RooLinkedList _list
Definition: RooTrace.h:77
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
Definition: RooTrace.cxx:298
bool Bool_t
Definition: RtypesCore.h:59
static RooTrace & instance()
Definition: RooTrace.cxx:50
static RooTrace * _instance
Definition: RooTrace.h:56
std::map< std::string, int > _specialCount
Definition: RooTrace.h:80
static void active(Bool_t flag)
If flag is true, memory tracing is activated.
Definition: RooTrace.cxx:133
void printObjectCounts3()
Definition: RooTrace.cxx:271
#define ClassDef(name, id)
Definition: Rtypes.h:297
Class RooTrace controls the memory tracing hooks in all RooFit objects.
Definition: RooTrace.h:25
void create3(const TObject *obj)
Definition: RooTrace.cxx:183
RooTrace()
Definition: RooTrace.cxx:59
void addPad(const TObject *ref, Bool_t doPad)
static void create(const TObject *obj)
Register creation of object &#39;obj&#39;.
Definition: RooTrace.cxx:68
virtual ~RooTrace()
Definition: RooTrace.h:28
void createSpecial3(const char *name, int size)
Definition: RooTrace.cxx:114
Bool_t _active
Definition: RooTrace.h:75
static void mark()
Put marker in object list, that allows to dump contents of list relative to this marker.
Definition: RooTrace.cxx:206
void create2(const TObject *obj)
Back end function of create(), register creation of object &#39;obj&#39;.
Definition: RooTrace.cxx:155
void destroySpecial3(const char *name)
Definition: RooTrace.cxx:123
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
const Bool_t kFALSE
Definition: RtypesCore.h:92
void dump3(std::ostream &, Bool_t sinceMarked)
Dump contents of object register to stream &#39;os&#39;.
Definition: RooTrace.cxx:245
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
static void destroy(const TObject *obj)
Register deletion of object &#39;obj&#39;.
Definition: RooTrace.cxx:81
void destroy3(const TObject *obj)
Back end function of destroy(), register deletion of object &#39;obj&#39;.
Definition: RooTrace.cxx:195
std::map< std::string, int > _specialSize
Definition: RooTrace.h:81
static void destroySpecial(const char *name)
Definition: RooTrace.cxx:103
RooLinkedList _markList
Definition: RooTrace.h:78
void destroy2(const TObject *obj)
Back end function of destroy(), register deletion of object &#39;obj&#39;.
Definition: RooTrace.cxx:170
static void createSpecial(const char *name, int size)
Definition: RooTrace.cxx:92
Mother of all ROOT objects.
Definition: TObject.h:37
void mark3()
Put marker in object list, that allows to dump contents of list relative to this marker.
Definition: RooTrace.cxx:217
static void printObjectCounts()
Definition: RooTrace.cxx:264
static void dump()
Dump contents of object registry to stdout.
Definition: RooTrace.cxx:227
static void callgrind_dump()
Utility function to trigger dumping of callgrind counters.
Definition: RooTrace.cxx:310
Bool_t _verbose
Definition: RooTrace.h:76
std::map< TClass *, int > _objectCount
Definition: RooTrace.h:79