diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-08-09 08:56:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-09 08:56:53 +0100 |
| commit | 408be791647c015c99963cc1b6d710f58d729dec (patch) | |
| tree | 35efb24716c331ee6bbe38e6fb0c8ab90079a373 /dev/misc/BenchKit | |
| parent | 9ac7b512ace3f8a3f5613dbf940484a9fa3c82c2 (diff) | |
refactor! rename `tooling` to `tools`
feat: BenchKit improvements and libMsg authorship refactors.
Diffstat (limited to 'dev/misc/BenchKit')
| -rw-r--r-- | dev/misc/BenchKit/Chrono.h | 5 | ||||
| -rw-r--r-- | dev/misc/BenchKit/X64Chrono.h | 16 |
2 files changed, 14 insertions, 7 deletions
diff --git a/dev/misc/BenchKit/Chrono.h b/dev/misc/BenchKit/Chrono.h index 394f16fd..c6801de5 100644 --- a/dev/misc/BenchKit/Chrono.h +++ b/dev/misc/BenchKit/Chrono.h @@ -10,6 +10,11 @@ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved. #include <CompilerKit/CompilerKit.h> #include <NeKit/Defines.h> +/// @author Amlal El Mahrouss +/// @brief BenchKit Chrono contract. + +#define BENCHKIT_INTERFACE : public ::Kernel::ChronoInterface + namespace Kernel { class ChronoInterface; diff --git a/dev/misc/BenchKit/X64Chrono.h b/dev/misc/BenchKit/X64Chrono.h index 706ce883..358c74d4 100644 --- a/dev/misc/BenchKit/X64Chrono.h +++ b/dev/misc/BenchKit/X64Chrono.h @@ -14,11 +14,13 @@ namespace Kernel { class X64Chrono; struct X64ChronoTraits; +/// @brief BenchKit chrono logic for x64. struct X64ChronoTraits { private: STATIC UInt64 TickImpl_(void) { UInt64 a = 0, d = 0; - __asm__ volatile("rdtsc" : "=a"(a), "=d"(d)); + + asm volatile("rdtsc" : "=a"(a), "=d"(d)); return (d << 32) | a; } @@ -26,7 +28,7 @@ struct X64ChronoTraits { }; /// @brief X86_64 hardware chrono implementation using the `rdtsc` instruction. -class X64Chrono : public ChronoInterface { +class X64Chrono BENCHKIT_INTERFACE { public: X64Chrono() = default; ~X64Chrono() override = default; @@ -34,11 +36,11 @@ class X64Chrono : public ChronoInterface { NE_COPY_DEFAULT(X64Chrono); public: - void Start() override { fStart = X64ChronoTraits::TickImpl_(); } + Void Start() override { fStart = X64ChronoTraits::TickImpl_(); } - void Stop() override { fStop = X64ChronoTraits::TickImpl_(); } + Void Stop() override { fStop = X64ChronoTraits::TickImpl_(); } - void Reset() override { + Void Reset() override { fStart = 0; fStop = 0; } @@ -46,8 +48,8 @@ class X64Chrono : public ChronoInterface { UInt64 GetElapsedTime() const override { return fStop - fStart; } private: - UInt64 fStart = 0; - UInt64 fStop = 0; + UInt64 fStart{}; + UInt64 fStop{}; }; } // namespace Kernel |
