[+] QueryClockTimeNS
[+] QueryClockTimeFrequency
This commit is contained in:
parent
dfecf10f1d
commit
0a1db024e8
@ -49,6 +49,10 @@ namespace Aurora::Time
|
||||
*/
|
||||
AUKN_SYM AuPair<AuUInt64, AuUInt64> GetClockUserAndKernelTimeNS(EClock clock);
|
||||
|
||||
AUKN_SYM AuUInt64 QueryClockTimeNS(EClock clock);
|
||||
|
||||
AUKN_SYM AuUInt64 QueryClockFrequency(EClock clock);
|
||||
|
||||
/**
|
||||
* @brief frequency in jiffies per second
|
||||
*/
|
||||
|
@ -483,6 +483,12 @@ namespace Aurora::Time
|
||||
return {};
|
||||
}
|
||||
|
||||
if (swizzle == AuPair<AuUInt64, AuUInt64> {})
|
||||
{
|
||||
SysPushErrorGeneric();
|
||||
return {};
|
||||
}
|
||||
|
||||
return { swizzle.second, swizzle.first };
|
||||
}
|
||||
}
|
@ -52,7 +52,6 @@ namespace Aurora::Time
|
||||
ADD_CLOCK(ThreadKernel, eThreadKernelTime, ThreadKernelClockJiffies, ThreadKernelClockNS, ThreadKernelClockMS);
|
||||
ADD_CLOCK(ThreadUser, eThreadUserTime, ThreadUserClockJiffies, ThreadUserClockNS, ThreadUserClockMS);
|
||||
|
||||
#undef FILE_AND_USR_DIR_STEP
|
||||
#undef ADD_CLOCK
|
||||
|
||||
AUKN_SYM AuSPtr<IClock> GetClockFromEnum(EClock clock)
|
||||
@ -80,4 +79,54 @@ namespace Aurora::Time
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
AUKN_SYM AuUInt64 QueryClockTimeNS(EClock clock)
|
||||
{
|
||||
switch (clock)
|
||||
{
|
||||
case EClock::eWall:
|
||||
return CurrentClockNS();
|
||||
case EClock::eSteady:
|
||||
return SteadyClockNS();
|
||||
case EClock::eProcessTime:
|
||||
return ProcessClockNS();
|
||||
case EClock::eProcessUserTime:
|
||||
return ProcessUserClockNS();
|
||||
case EClock::eProcessKernelTime:
|
||||
return ProcessKernelClockNS();
|
||||
case EClock::eThreadTime:
|
||||
return ThreadClockNS();
|
||||
case EClock::eThreadUserTime:
|
||||
return ThreadUserClockNS();
|
||||
case EClock::eThreadKernelTime:
|
||||
return ThreadKernelClockNS();
|
||||
default:
|
||||
SysPushErrorArg("Invalid clock");
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
AUKN_SYM AuUInt64 QueryClockFrequency(EClock clock)
|
||||
{
|
||||
switch (clock)
|
||||
{
|
||||
case EClock::eWall:
|
||||
return FILE_AND_USR_DIR_STEP;
|
||||
case EClock::eSteady:
|
||||
return SteadyClockJiffies();
|
||||
case EClock::eProcessTime:
|
||||
case EClock::eProcessUserTime:
|
||||
case EClock::eProcessKernelTime:
|
||||
return ProcessClockJiffies();
|
||||
case EClock::eThreadTime:
|
||||
case EClock::eThreadUserTime:
|
||||
case EClock::eThreadKernelTime:
|
||||
return ThreadClockJiffies();
|
||||
default:
|
||||
SysPushErrorArg("Invalid clock");
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
#undef FILE_AND_USR_DIR_STEP
|
||||
}
|
Loading…
Reference in New Issue
Block a user