Equalizer  2.0.0
Parallel Rendering Framework
statisticSampler.h
1 
2 /* Copyright (c) 2009-2016, Stefan Eilemann <eile@equalizergraphics.com>
3  * Daniel Nachbaur <danielnachbaur@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EQ_STATISTICSAMPLER_H
20 #define EQ_STATISTICSAMPLER_H
21 
22 #include <eq/types.h>
23 #include <eq/fabric/statistic.h> // member
24 
25 namespace eq
26 {
34 template< typename Owner > class StatisticSampler
35 {
36 public:
45  StatisticSampler( const Statistic::Type type, Owner* owner,
46  const uint32_t frameNumber = LB_UNDEFINED_UINT32 )
47  : _owner( owner )
48  {
49  LBASSERT( owner );
50  LBASSERT( owner->getID() != 0 );
51  LBASSERT( owner->getSerial() != CO_INSTANCE_INVALID );
52  statistic.type = type;
53  statistic.frameNumber = frameNumber;
54  statistic.resourceName[0] = '\0';
55  statistic.startTime = 0;
56  statistic.endTime = 0;
57 
58  if( statistic.frameNumber == LB_UNDEFINED_UINT32 )
59  statistic.frameNumber = owner->getCurrentFrame();
60  }
61 
64  {
65  LBASSERTINFO( statistic.startTime <= statistic.endTime, statistic );
66  }
67 
68  Statistic statistic;
69 
70 protected:
71  Owner* const _owner;
72 };
73 
74 }
75 
76 #endif // EQ_STATISTICSAMPLER_H
Utility to sample an statistics event.
Statistic statistic
The statistics event.
virtual ~StatisticSampler()
Destruct and finish statistics sampling.
The Equalizer client library.
Definition: eq/agl/types.h:23
StatisticSampler(const Statistic::Type type, Owner *owner, const uint32_t frameNumber=LB_UNDEFINED_UINT32)
Construct a new statistics sampler.