| 1 |
/* |
| 2 |
* Copyright (c) 2017, Intel Corporation |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 5 |
* copy of this software and associated documentation files (the "Software"), |
| 6 |
* to deal in the Software without restriction, including without limitation |
| 7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 9 |
* Software is furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice shall be included |
| 12 |
* in all copies or substantial portions of the Software. |
| 13 |
* |
| 14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 21 |
*/ |
| 22 |
#ifndef CMRTLIB_AGNOSTIC_HARDWARE_CM_TIMER_H_ |
| 23 |
#define CMRTLIB_AGNOSTIC_HARDWARE_CM_TIMER_H_ |
| 24 |
|
| 25 |
#include "cm_def_hw.h" |
| 26 |
#include "cm_include.h" |
| 27 |
|
| 28 |
#if MDF_PROFILER_ENABLED |
| 29 |
//! |
| 30 |
//! CM Timer |
| 31 |
//! |
| 32 |
class CmTimer |
| 33 |
{ |
| 34 |
public: |
| 35 |
CmTimer(const char *functionName); |
| 36 |
|
| 37 |
~CmTimer(); |
| 38 |
|
| 39 |
private: |
| 40 |
void Start(); |
| 41 |
|
| 42 |
void Stop(); |
| 43 |
|
| 44 |
float GetTimeinMs(); |
| 45 |
|
| 46 |
void InsertEventStartFlag(); |
| 47 |
|
| 48 |
void InsertEventEndFlag(); |
| 49 |
|
| 50 |
uint64_t m_cycles; |
| 51 |
|
| 52 |
LARGE_INTEGER m_start; |
| 53 |
|
| 54 |
LARGE_INTEGER m_end; |
| 55 |
|
| 56 |
LARGE_INTEGER m_freq; |
| 57 |
|
| 58 |
char *m_funcName; |
| 59 |
}; |
| 60 |
|
| 61 |
#endif // #if MDF_PROFILER_ENABLED |
| 62 |
|
| 63 |
#endif // #ifndef CMRTLIB_AGNOSTIC_HARDWARE_CM_TIMER_H_ |