wxArt2D
prflcntmean.h
Go to the documentation of this file.
1 /*! \file wx/genart/prflcntmean.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: prflcntmean.h,v 1.7 2005/08/16 16:47:52 titato Exp $
11 */
12 
13 
14 #if(defined(TRACE_H))
15 #pragma message(__FILE__)
16 #endif
17 
18 #if(!defined(PrflCntMean_H))
19 #define PrflCntMean_H
20 
21 ///////////////////////////////////////////////////////////////////////////////
22 //
23 // Test der vorausgesetzten include Dateien
24 //
25 ///////////////////////////////////////////////////////////////////////////////
26 
27 #if(!defined(Prfl_H))
28 #error Please include prfl.h before including prflcntmean.h
29 #endif
30 
31 //! to find minimum and maximum values and sum of all values encountered in some pice of code.
32 /*!
33 
34  Zusammenfassung der Anwendungsdetails der Klasse a2dProfilerMean
35 
36  a2dProfilerMean dient dazu die Verteilung bestimmter Werte zu ermitteln. Die
37  Anwendung ist denkbar einfach. An geeigneter Stelle fügt man folgendes Makro ein:
38 
39  PRFL_CNT_HSTG(HstgName,HstgWert,HstgMin,HstgMax);
40 
41  HstgMin und HstgMax sind die Grenzwerte für die Aufzeichnung. HstgWert ist
42  der aktuelle Wert. HstgName dient zur Identifikation und muß ein gültiger
43  C-Identifier sein. Dem Identifier wird das Präfix prfl_ vorgestellt.
44  Mit diesem Präfix muß er in der Funktion eindeutig sein.
45  Der Identifier sollte nicht länger als 20 Zeichen sein
46 
47  Die Profileinformation wird am Programmende automatisch in die Datei Profile.txt
48  gesichert.
49 
50  Profiling ist nur eingeschaltet, wenn das macro PRFL_ENBL definiert ist
51  oder wenn die Datei PrflEnbl.h includiert wird.
52 
53  siehe auch:
54  prflTmr.h
55  prflCnt.h
56  prfl.h
57 */
58 class A2DGENERALDLLEXP a2dProfilerMean : public a2dProfiler
59 {
60 public:
61  // Standard Erzeugungsoperator
62  a2dProfilerMean( wxString idIn );
63 
64 public:
65  // Wird bei jedem Durchlauf aufgerufen
66  void Cnt( double val )
67  {
68  cnt++;
69  sum += val;
70  if( cnt )
71  {
72  if( val < min ) min = val;
73  if( val > max ) max = val;
74  }
75  else
76  {
77  min = val;
78  max = val;
79  }
80  }
81 
82 public:
83  // Vernichtungsoperator
84  ~a2dProfilerMean ();
85 
86 protected:
87 
88  int
89  cnt;
90  double
91  sum;
92  double
93  min;
94  double
95  max;
96 };
97 
98 //*****************************************************************************
99 //*
100 //* Definition von Macros
101 //*
102 //*****************************************************************************
103 
104 // man könnte die Deklaration und Cnt in {} einschließen, so daß der id nicht
105 // eindeutig zu sein bräuchte. Es schadet aber nix, wenn jeder id eindeutig ist
106 
107 #if(defined(PRFL_ENBL))
108 #define PRFL_CNT_MEAN(id,val) {static a2dProfilerMean prfl_##id(_T(#id)); prfl_##id.Cnt(val);}
109 #else
110 #define PRFL_CNT_MEAN(id,val)
111 #endif
112 
113 #endif // PrflCntMean_H
to find minimum and maximum values and sum of all values encountered in some pice of code...
Definition: prflcntmean.h:58
prflcntmean.h Source File -- Sun Oct 12 2014 17:04:23 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation