Inits mem log. @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. **/
| 60 | |
| 61 | **/ |
| 62 | CHAR8* |
| 63 | GetTiming(VOID) |
| 64 | { |
| 65 | UINT64 dTStartSec; |
| 66 | UINT64 dTStartMs; |
| 67 | UINT64 dTLastSec; |
| 68 | UINT64 dTLastMs; |
| 69 | UINT64 CurrentTsc; |
| 70 | |
| 71 | mTimingTxt[0] = '\0'; |
| 72 | |
| 73 | if (mMemLog != NULL && mMemLog->TscFreqSec != 0) { |
| 74 | CurrentTsc = AsmReadTsc(); |
| 75 | |
| 76 | dTStartMs = DivU64x64Remainder(MultU64x32(CurrentTsc - mMemLog->TscStart, 1000), mMemLog->TscFreqSec, NULL); |
| 77 | dTStartSec = DivU64x64Remainder(dTStartMs, 1000, &dTStartMs); |
| 78 | |
| 79 | dTLastMs = DivU64x64Remainder(MultU64x32(CurrentTsc - mMemLog->TscLast, 1000), mMemLog->TscFreqSec, NULL); |
| 80 | dTLastSec = DivU64x64Remainder(dTLastMs, 1000, &dTLastMs); |
| 81 | |
| 82 | AsciiSPrint(mTimingTxt, sizeof(mTimingTxt), |
| 83 | "%ld:%03ld %ld:%03ld", dTStartSec, dTStartMs, dTLastSec, dTLastMs); |
| 84 | mMemLog->TscLast = CurrentTsc; |
| 85 | } |
| 86 | |
| 87 | return mTimingTxt; |
| 88 | } |
| 89 | |
| 90 | |
| 91 |
no test coverage detected