wxArt2D
prflcnthstg.h
Go to the documentation of this file.
1 /*! \file wx/genart/prflcnthstg.h
2  \brief profiling classes
3  \author Michael Sögtrop
4  \date Created 08/05/2004
5 
6  Copyright: 2004-2004 (c) Michael Sögtrop
7 
8  Licence: wxWidgets Licence
9 
10  RCS-ID: $Id: prflcnthstg.h,v 1.6 2005/08/16 16:47:52 titato Exp $
11 */
12 
13 ///////////////////////////////////////////////////////////////////////////////
14 
15 #if(defined(TRACE_H))
16 #pragma message(__FILE__)
17 #endif
18 
19 ///////////////////////////////////////////////////////////////////////////////
20 //
21 // Schutz gegen doppelte Einbindung
22 //
23 ///////////////////////////////////////////////////////////////////////////////
24 
25 #if(!defined(PrflCntHstg_H))
26 #define PrflCntHstg_H
27 
28 ///////////////////////////////////////////////////////////////////////////////
29 //
30 // Test der vorausgesetzten include Dateien
31 //
32 ///////////////////////////////////////////////////////////////////////////////
33 
34 #if(!defined(Prfl_H))
35 #error Please include Prfl.h before including PrflCntHstg.h
36 #endif
37 
38 //! histogram profiling
39 /*!
40  Passing the Cnt() will fill the histrogram with the value of some integer variable.
41  In the end you know which value was used how often.
42 
43 
44  Zusammenfassung der Anwendungsdetails der Klasse a2dProfilerHistogram
45 
46  a2dProfilerHistogram dient dazu die Verteilung bestimmter Werte zu ermitteln. Die
47  Anwendung ist denkbar einfach. An geeigneter Stelle fügt man folgendes Makro ein:
48 
49  PRFL_CNT_HSTG(HstgName,HstgWert,HstgMin,HstgMax);
50 
51  HstgMin und HstgMax sind die Grenzwerte für die Aufzeichnung. HstgWert ist
52  der aktuelle Wert. HstgName dient zur Identifikation und muß ein gültiger
53  C-Identifier sein. Dem Identifier wird das Präfix prfl_ vorgestellt.
54  Mit diesem Präfix muß er in der Funktion eindeutig sein.
55  Der Identifier sollte nicht länger als 20 Zeichen sein
56 
57  Die Profileinformation wird am Programmende automatisch in die Datei Profile.txt
58  gesichert.
59 
60  Profiling ist nur eingeschaltet, wenn das macro PRFL_ENBL definiert ist
61  oder wenn die Datei PrflEnbl.h includiert wird.
62 
63  siehe auch:
64  prflTmr.h
65  prflCnt.h
66  prfl.h
67 */
69 {
70 public:
71  //! constructor
72  a2dProfilerHistogram( wxString idIn, int hstgMinIn, int hstgMaxIn );
73 
74  //! destructor
76 
77 public:
78 
79  //! called when pssing the code where it is placed.
80  void Cnt( int hstg )
81  {
82  if( hstg < hstgMin ) cntLess++;
83  else if( hstg > hstgMax ) cntAbv++;
84  else cnt[hstg - hstgMin]++;
85  }
86 
87 protected:
88 
89  int
90  hstgMin,
91  hstgMax;
92  unsigned long
93  cntLess,
94  cntAbv,
95  *cnt;
96 };
97 
98 
99 //*****************************************************************************
100 //*
101 //* Definition von Macros
102 //*
103 //*****************************************************************************
104 
105 // man könnte die Deklaration und Cnt in {} einschließen, so daß der id nicht
106 // eindeutig zu sein bräuchte. Es schadet aber nix, wenn jeder id eindeutig ist
107 
108 #if(defined(PRFL_ENBL))
109 #define PRFL_CNT_HSTG(id,hstg,hstgMin,hstgMax) {static a2dProfilerHistogram prfl_##id(#id,hstgMin,hstgMax); prfl_##id.Cnt(hstg);}
110 #else
111 #define PRFL_CNT_HSTG(id,hstg,hstgMin,hstgMax)
112 #endif
113 
114 #endif // PrflCntHstg_H
a2dProfilerHistogram(wxString idIn, int hstgMinIn, int hstgMaxIn)
constructor
Definition: prflcnthstg.cpp:63
histogram profiling
Definition: prflcnthstg.h:68
~a2dProfilerHistogram()
destructor
Definition: prflcnthstg.cpp:82
void Cnt(int hstg)
called when pssing the code where it is placed.
Definition: prflcnthstg.h:80
prflcnthstg.h Source File -- Sun Oct 12 2014 17:04:23 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation