KWStyle - itkTimeProbesCollectorBase.cxx
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkTimeProbesCollectorBase.cxx.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 DEF =========================================================================*/
17
18
19 #include "itkTimeProbesCollectorBase.h"
20 #include <iostream>
21
22 namespace itk
23 {
24
25 TimeProbesCollectorBase
26 ::TimeProbesCollectorBase()
27 {
28 }
29
30
31 EML
32 TimeProbesCollectorBase
33 ::~TimeProbesCollectorBase()
34 {
35 }
36
37
38 EML
39 EML
40 void 
41 TimeProbesCollectorBase
42 ::Start(const char * id)
43 {
44   IdType tid = id;
45   MapType::iterator  pos = m_Probes.find( tid );
46   if ( pos == m_Probes.end() )
47     {
48     m_Probes[ tid ] = TimeProbe();
49     }
50   m_Probes[ tid ].Start(); 
51 }
52
53
54 EML
55 EML
56 EML
57 void 
58 TimeProbesCollectorBase
59 ::Stop(const char * id)
60 {
61   IdType tid = id;
62   MapType::iterator  pos = m_Probes.find( tid );
63   if ( pos == m_Probes.end() )
64     {
65     return;
66     }
67   pos->second.Stop(); 
68 }
69
70
71 EML
72 void 
73 TimeProbesCollectorBase
74 ::Report(void) const
75 {
76   MapType::const_iterator probe = m_Probes.begin();
77   MapType::const_iterator end   = m_Probes.end();
78
79   std::cout.width(20);
80   std::cout <<  " Probe Tag ";
81   std::cout.width(10);
82   std::cout <<  " Starts ";
83   std::cout.width(10);
84   std::cout <<  " Stops  ";
85   std::cout.width(15);
86   std::cout <<  "  Time  ";
87   std::cout << std::endl;
88   
89   while( probe != end )
90     {
91     std::cout.width(20);
92     std::cout <<  probe->first.c_str() << "  ";
93     std::cout.width(10);
94     std::cout <<  probe->second.GetNumberOfStarts() <<  "   ";
95     std::cout.width(10);
96     std::cout <<  probe->second.GetNumberOfStops() <<  "   ";
97     std::cout.width(15);
98     std::cout <<  probe->second.GetMeanTime();
99     std::cout << std::endl;
100     probe++;
101     }
102
103 }
104     
105    
106
107
108 void 
109 TimeProbesCollectorBase
110 ::Clear(void) 
111 {
112   m_Probes.clear();
113 }
114
115
116 // end namespace itk
117
118 EOF
119 EOF,EML

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:50PM
© Kitware Inc.