summaryrefslogtreecommitdiff
path: root/Kernel/i386.h
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/i386.h')
-rw-r--r--Kernel/i386.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/Kernel/i386.h b/Kernel/i386.h
index 4dc56620d4..9b2b3447d4 100644
--- a/Kernel/i386.h
+++ b/Kernel/i386.h
@@ -269,27 +269,29 @@ inline void read_tsc(dword& lsw, dword& msw)
}
struct Stopwatch {
+ union SplitQword {
+ struct {
+ uint32_t lsw;
+ uint32_t msw;
+ };
+ uint64_t qw { 0 };
+ };
public:
Stopwatch(const char* name)
: m_name(name)
{
- read_tsc(m_start_lsw, m_start_msw);
+ read_tsc(m_start.lsw, m_start.msw);
}
~Stopwatch()
{
- dword end_lsw;
- dword end_msw;
- read_tsc(end_lsw, end_msw);
- if (m_start_msw != end_msw) {
- dbgprintf("stopwatch: differing msw, no result for %s\n", m_name);
- }
- dword diff = end_lsw - m_start_lsw;
- dbgprintf("Stopwatch(%s): %u ticks\n", m_name, diff);
+ SplitQword end;
+ read_tsc(end.lsw, end.msw);
+ uint64_t diff = end.qw - m_start.qw;
+ dbgprintf("Stopwatch(%s): %q ticks\n", m_name, diff);
}
private:
const char* m_name { nullptr };
- dword m_start_lsw { 0 };
- dword m_start_msw { 0 };
+ SplitQword m_start;
};