| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2017-2021 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
#ifndef IGA_TIMER_TIMER_HPP |
| 10 |
#define IGA_TIMER_TIMER_HPP |
| 11 |
|
| 12 |
#include <cstdint> |
| 13 |
#include <string> |
| 14 |
|
| 15 |
// Enable this macro by default but comment out calls that print out timer info. |
| 16 |
// Requirement by 3d team. |
| 17 |
#if defined(_DEBUG) || defined(_ENABLETIMER) |
| 18 |
#define MEASURE_COMPILATION_TIME |
| 19 |
#endif |
| 20 |
|
| 21 |
// Timer library for the compiler |
| 22 |
// To collect compile time information, do the following: |
| 23 |
// |
| 24 |
// initTimer() // should be called once before creating any timers |
| 25 |
// ... |
| 26 |
// Update enum TIMERS, |
| 27 |
// Update timerNames array |
| 28 |
// |
| 29 |
// startTimer/stopTimer can be called multiple times |
| 30 |
// |
| 31 |
// To read time, either invoke dumpAllTimers() |
| 32 |
// or invoke other extern functions in Timer.cpp |
| 33 |
// to get individual timer name, ticks, time count. |
| 34 |
// |
| 35 |
|
| 36 |
int createIGANewTimer(const char *timerName); |
| 37 |
|
| 38 |
void initIGATimer(); |
| 39 |
void startIGATimer(int timer); |
| 40 |
void stopIGATimer(int timer); |
| 41 |
void setIGAKernelName(const char *name); |
| 42 |
void dumpAllIGATimers(bool outputTime = false); |
| 43 |
std::string getIGATimerNames(unsigned int idx); |
| 44 |
int64_t getIGATimerTicks(unsigned int idx); |
| 45 |
double getIGATimerCounts(unsigned int idx); |
| 46 |
double getIGATimerUS(unsigned int idx); |
| 47 |
|
| 48 |
typedef enum TIMERS { |
| 49 |
TIMER_TOTAL = 0, |
| 50 |
TIMER_GED = 1, |
| 51 |
TIMER_NUM_TIMERS = 2 |
| 52 |
} TIMERS; |
| 53 |
|
| 54 |
#endif // IGA_TIMER_TIMER_HPP |