ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "Riosfwd.h"
21 #include "RooLinkedList.h"
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
Bool_t removePad(const TObject *ref)
RooLinkedList _list
Definition: RooTrace.h:78
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
Definition: RooTrace.cxx:298
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
static RooTrace & instance()
Definition: RooTrace.cxx:50
static RooTrace * _instance
Definition: RooTrace.h:57
std::map< std::string, int > _specialCount
Definition: RooTrace.h:81
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:254
Class RooTrace controls the memory tracing hooks in all RooFit objects.
Definition: RooTrace.h:26
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 'obj'.
Definition: RooTrace.cxx:68
virtual ~RooTrace()
Definition: RooTrace.h:29
void createSpecial3(const char *name, int size)
Definition: RooTrace.cxx:114
Bool_t _active
Definition: RooTrace.h:76
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 'obj'.
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
void dump3(std::ostream &, Bool_t sinceMarked)
Dump contents of object register to stream 'os'.
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 'obj'.
Definition: RooTrace.cxx:81
void destroy3(const TObject *obj)
Back end function of destroy(), register deletion of object 'obj'.
Definition: RooTrace.cxx:195
std::map< std::string, int > _specialSize
Definition: RooTrace.h:82
static void destroySpecial(const char *name)
Definition: RooTrace.cxx:103
#define name(a, b)
Definition: linkTestLib0.cpp:5
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 createSpecial(const char *name, int size)
Definition: RooTrace.cxx:92
Mother of all ROOT objects.
Definition: TObject.h:58
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
TObject * obj
Bool_t _verbose
Definition: RooTrace.h:77
std::map< TClass *, int > _objectCount
Definition: RooTrace.h:80