Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files 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 "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 
75  Bool_t _active ;
76  Bool_t _verbose ;
77  RooLinkedList _list ;
78  RooLinkedList _markList ;
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