This function's purpose is to provide a mapping from a 'friendly' human readable text string to an index into internal data structures.
| 229 | // This function's purpose is to provide a mapping from a 'friendly' human readable text string |
| 230 | // to an index into internal data structures. |
| 231 | size_t |
| 232 | CpuStatTimer::getUniqueID( const std::string& label, cl_uint groupID ) |
| 233 | { |
| 234 | // I expect labelID will hardly ever grow beyond 30, so it's not of any use |
| 235 | // to keep this sorted and do a binary search |
| 236 | |
| 237 | labelPair sItem = std::make_pair( label, groupID ); |
| 238 | |
| 239 | stringVector::iterator iter; |
| 240 | iter = std::find( labelID.begin(), labelID.end(), sItem ); |
| 241 | |
| 242 | if( iter != labelID.end( ) ) |
| 243 | return std::distance( labelID.begin( ), iter ); |
| 244 | |
| 245 | labelID.push_back( sItem ); |
| 246 | |
| 247 | return labelID.size( ) - 1; |
| 248 | |
| 249 | } |
| 250 | |
| 251 | cl_double |
| 252 | CpuStatTimer::getMean( size_t id ) const |