MCPcopy Create free account
hub / github.com/clMathLibraries/clSPARSE / clsparseDeviceTimer

Class clsparseDeviceTimer

src/clsparseTimer/clsparseTimer-device.hpp:65–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63bool operator<( const StatData& lhs, const StatData& rhs );
64
65class clsparseDeviceTimer: public clsparseTimer
66{
67 // Typedefs to handle the data that we store
68 typedef std::vector< StatData > StatDataVec;
69 typedef std::vector< StatDataVec > PerEnqueueVec;
70
71 // In order to calculate statistics <std. dev.>, we need to keep a history of our timings
72 std::vector< PerEnqueueVec > timerData;
73
74 // Typedefs to handle the identifiers we use for our timers
75 typedef std::pair< std::string, cl_uint > idPair;
76 typedef std::vector< idPair > idVector;
77 idVector labelID;
78
79 // Between each Start/Stop pair, we need to count how many AddSamples were made.
80 size_t currSample, currRecord;
81
82 // Saved sizes for our vectors, used in Reset() to reallocate vectors
83 StatDataVec::size_type nEvents, nSamples;
84 size_t currID;
85
86 /**
87 * \fn clsparseDeviceTimer()
88 * \brief Constructor for StatisticalTimer that initializes the class
89 * This is private so that user code cannot create their own instantiation. Instead, you
90 * must go through getInstance( ) to get a reference to the class.
91 */
92 clsparseDeviceTimer( );
93
94 /**
95 * \fn ~clsparseDeviceTimer()
96 * \brief Destructor for StatisticalTimer that cleans up the class
97 */
98 ~clsparseDeviceTimer( );
99
100 /**
101 * \fn clsparseDeviceTimer(const StatisticalTimer& )
102 * \brief Copy constructors do not make sense for a singleton, disallow copies
103 */
104 clsparseDeviceTimer( const clsparseDeviceTimer& );
105
106 /**
107 * \fn operator=( const StatisticalTimer& )
108 * \brief Assignment operator does not make sense for a singleton, disallow assignments
109 */
110 clsparseDeviceTimer& operator=( const clsparseDeviceTimer& );
111
112 friend std::ostream& operator<<( std::ostream& os, const clsparseDeviceTimer& s );
113
114 // Calculate the average/mean of data for a given event
115 std::vector< StatData > getMean( size_t id );
116
117 // Calculate the variance of data for a given event
118 // Variance - average of the squared differences between data points and the mean
119 std::vector< StatData > getVariance( size_t id );
120
121 // Sqrt of variance, also in units of the original data
122 std::vector< StatData > getStdDev( size_t id );

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected