61 lines
1.8 KiB
C++
61 lines
1.8 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: Main.cpp
|
|
Date: 2022-2-18
|
|
Author: Reece
|
|
***/
|
|
#include <AuroraRuntime.hpp>
|
|
#include <gtest/gtest.h>
|
|
|
|
TEST(A, A)
|
|
{
|
|
AuLogDbg("Process time (ms): {}", AuTime::ProcessClockMS());
|
|
AuLogDbg("Thread time (ms): {}", AuTime::ThreadClockMS());
|
|
AuLogDbg("Wall Time (ms): {}", AuTime::CurrentClockMS());
|
|
|
|
AuTime::tm time = AuTime::ToCivilTime(AuTime::CurrentClockMS());
|
|
AuLogDbg("[UTC] The time is: hh::mm {:02}:{:02}", time.hour, time.min);
|
|
AuLogDbg("[UTC] The date/time is: {} (no milliseconds)", AuLocale::TimeDateToISO8601(time));
|
|
}
|
|
|
|
TEST(Benchmark, Steady)
|
|
{
|
|
SysBenchmark("SteadyClockNS");
|
|
|
|
AuUInt c {};
|
|
for (int i = 0; i < 100'000'000; i++)
|
|
{
|
|
c += AuTime::SteadyClockNS();
|
|
}
|
|
}
|
|
|
|
TEST(Benchmark, CurrentClockNS)
|
|
{
|
|
SysBenchmark("CurrentClockNS (wall)");
|
|
|
|
AuUInt c {};
|
|
for (int i = 0; i < 100'000'000; i++)
|
|
{
|
|
c += AuTime::CurrentClockNS();
|
|
}
|
|
}
|
|
|
|
TEST(CheckClockPresence, CheckClockPresence)
|
|
{
|
|
ASSERT_TRUE(bool(AuTime::GetClockFromEnum(AuTime::EClock::eProcessTime)));
|
|
ASSERT_TRUE(bool(AuTime::GetClockFromEnum(AuTime::EClock::eThreadTime)));
|
|
ASSERT_TRUE(bool(AuTime::GetClockFromEnum(AuTime::EClock::eWall)));
|
|
ASSERT_TRUE(bool(AuTime::GetClockFromEnum(AuTime::EClock::eSteady)));
|
|
ASSERT_TRUE(bool(AuTime::GetClockFromEnum(AuTime::EClock::eProcessUserTime)));
|
|
ASSERT_TRUE(bool(AuTime::GetClockFromEnum(AuTime::EClock::eProcessKernelTime)));
|
|
ASSERT_TRUE(bool(AuTime::GetClockFromEnum(AuTime::EClock::eThreadUserTime)));
|
|
ASSERT_TRUE(bool(AuTime::GetClockFromEnum(AuTime::EClock::eThreadKernelTime)));
|
|
}
|
|
|
|
void RunTests()
|
|
{
|
|
Aurora::RuntimeStartInfo info;
|
|
info.console.fio.bEnableLogging = false;
|
|
Aurora::RuntimeStart(info);
|
|
} |