| 11 | #undef WIN32_LEAN_AND_MEAN |
| 12 | |
| 13 | uint64_t GetProcessTimeCounter() |
| 14 | { |
| 15 | uint64_t nCounter = 0; |
| 16 | do |
| 17 | { |
| 18 | // TODO: |
| 19 | // this implement maybe not correct |
| 20 | // Microsoft saids we can't get the frequency of the cpu |
| 21 | // thus we can't calculate the elapsed time of a process |
| 22 | //ULONG64 nCycleTime = 0; |
| 23 | //if (!QueryProcessCycleTime(GetCurrentProcess(), &nCycleTime)) |
| 24 | //{ |
| 25 | // break; |
| 26 | //} |
| 27 | //nCounter = nCycleTime; |
| 28 | |
| 29 | // TODO: |
| 30 | // this implementation maybe not correct either :( |
| 31 | // what we want is process time counter, |
| 32 | // but performance counter give us the general system counter |
| 33 | LARGE_INTEGER stCounter; |
| 34 | if (!QueryPerformanceCounter(&stCounter)) |
| 35 | { |
| 36 | break; |
| 37 | } |
| 38 | nCounter = stCounter.QuadPart; |
| 39 | |
| 40 | } while (false); |
| 41 | return nCounter; |
| 42 | } |
| 43 | |
| 44 | uint64_t GetProcessTimeFrequency() |
| 45 | { |
no outgoing calls
no test coverage detected