MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / GetTiming

Function GetTiming

Library/MemLogLibDefault/MemLogLib.c:62–88  ·  view source on GitHub ↗

Inits mem log. @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. **/

Source from the content-addressed store, hash-verified

60
61**/
62CHAR8*
63GetTiming(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

Callers 1

MemLogVAFunction · 0.70

Calls 4

DivU64x64RemainderFunction · 0.85
MultU64x32Function · 0.85
AsmReadTscFunction · 0.50
AsciiSPrintFunction · 0.50

Tested by

no test coverage detected