[+] Exit
[*] Update [*] Formatting
This commit is contained in:
parent
05d9537cbc
commit
d575087487
@ -1 +1 @@
|
||||
Subproject commit a19ae800aa9ba41c185aa4720442fca41732c50d
|
||||
Subproject commit 3d14595d87eab4b056c39e54228df9cb694a0912
|
@ -1 +1 @@
|
||||
Subproject commit 7e1bf30131146ac22e08568657b0be0669f343de
|
||||
Subproject commit 5599da3ab06885d365bab1234459c76f623a7c45
|
65
Tests/Public/18. Hello Exit/Main.cpp
Normal file
65
Tests/Public/18. Hello Exit/Main.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/***
|
||||
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>
|
||||
|
||||
static void AddHooks()
|
||||
{
|
||||
AuExit::ExitHandlerAdd(AuExit::ETriggerLevel::eProblematicEvent,
|
||||
AuMakeShared<AuExit::IExitSubscriberFunctional>(
|
||||
[](AuExit::ETriggerLevel level, const AuExit::ExitInvoker *pInvoker)
|
||||
{
|
||||
AuLogInfo("A problematic event occoured");
|
||||
}));
|
||||
|
||||
AuExit::ExitHandlerAdd(AuExit::ETriggerLevel::eFatalException,
|
||||
AuMakeShared<AuExit::IExitSubscriberFunctional>(
|
||||
[](AuExit::ETriggerLevel level, const AuExit::ExitInvoker *pInvoker)
|
||||
{
|
||||
AuLogInfo("A fatal event occoured");
|
||||
}));
|
||||
|
||||
AuExit::ExitHandlerAdd(AuExit::ETriggerLevel::eSigTerminate,
|
||||
AuMakeShared<AuExit::IExitSubscriberFunctional>(
|
||||
[](AuExit::ETriggerLevel level, const AuExit::ExitInvoker *pInvoker)
|
||||
{
|
||||
AuLogInfo("A terminate event was sent");
|
||||
// You must synchronize / join all spawned threads here
|
||||
// Aurora APIs may become unstable after this point
|
||||
// Yes, we can try to design around and mitigate issues, but it's time to go...
|
||||
}));
|
||||
|
||||
AuExit::ExitHandlerAdd(AuExit::ETriggerLevel::eSafeTermination,
|
||||
AuMakeShared<AuExit::IExitSubscriberFunctional>(
|
||||
[](AuExit::ETriggerLevel level, const AuExit::ExitInvoker *pInvoker)
|
||||
{
|
||||
AuLogInfo("Safe termination of application");
|
||||
}));
|
||||
|
||||
AuLogInfo("Throwing exception...");
|
||||
try
|
||||
{
|
||||
AU_THROW_STRING("hi");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AuLogInfo("Sleeping for 20s. Send a control+c, if you want");
|
||||
AuThreading::Sleep(20'000);
|
||||
}
|
||||
|
||||
void RunTests()
|
||||
{
|
||||
Aurora::RuntimeStartInfo info;
|
||||
info.console.fio.enableLogging = false;
|
||||
Aurora::RuntimeStart(info);
|
||||
|
||||
AddHooks();
|
||||
}
|
38
Tests/Public/20. Hello Time/Main.cpp
Normal file
38
Tests/Public/20. Hello Time/Main.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/***
|
||||
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(Benchmark, CurrentInternalClockMS)
|
||||
{
|
||||
SysBenchmark("CurrentInternalClockMS");
|
||||
|
||||
AuUInt c {};
|
||||
for (int i = 0; i < 100'000'000; i++)
|
||||
{
|
||||
c += AuTime::CurrentInternalClockMS();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Benchmark, CurrentClockMS)
|
||||
{
|
||||
SysBenchmark("CurrentClockMS");
|
||||
|
||||
AuUInt c {};
|
||||
for (int i = 0; i < 100'000'000; i++)
|
||||
{
|
||||
c += AuTime::CurrentClockMS();
|
||||
}
|
||||
}
|
||||
|
||||
void RunTests()
|
||||
{
|
||||
Aurora::RuntimeStartInfo info;
|
||||
info.console.fio.enableLogging = false;
|
||||
Aurora::RuntimeStart(info);
|
||||
}
|
@ -130,7 +130,7 @@ TEST(Loop, Performance)
|
||||
|
||||
...not bad, here's why:
|
||||
Reece, [30/03/2022 19:39]
|
||||
1 whole frame (~20Hhz) of work to blast WaitForMultipleObjectsEx/io_submit/epoll abstraction with a test covering multiple apis 10k times/iterations
|
||||
1 whole frame (~20Hz) of work to blast WaitForMultipleObjectsEx/io_submit/epoll abstraction with a test covering multiple apis 10k times/iterations
|
||||
|
||||
Reece, [30/03/2022 19:39]
|
||||
imagine a scheduling thread working on 10k unique kernel work objects per frame
|
||||
@ -148,7 +148,7 @@ TEST(Loop, Performance)
|
||||
by "like" i mean 10k iterations * 4 apis that can dispatch a callback or yield to kernel
|
||||
|
||||
Reece, [30/03/2022 19:42]
|
||||
best practices say you dont fucking spam resources. 40k is a hell of a lot more than, idk, checking a file read transaction a few tens-to-hundreds of times a second on an serializer thread that's not-io bound
|
||||
best practices say you dont fucking spam resources. 40k is a hell of a lot more than, idk, checking a file read transaction a few tens-to-hundreds of times a second on an serializer thread that's not io-bound
|
||||
|
||||
|
||||
Further data:
|
||||
@ -217,7 +217,6 @@ TEST(Loop, Performance)
|
||||
|
||||
semaA->AddOne(); // account for initial starting count of 1
|
||||
}
|
||||
printf(".");
|
||||
}
|
||||
|
||||
void RunTests()
|
||||
|
Loading…
Reference in New Issue
Block a user