Skip to content

Commit 815b830

Browse files
author
Jan Wilmans
committed
Correctly interpret the timestamps from kernel messages
1 parent 8bbea03 commit 815b830

File tree

8 files changed

+22
-9
lines changed

8 files changed

+22
-9
lines changed

application/CobaltFusion/Timer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ void Timer::Reset()
4040

4141
double Timer::Get()
4242
{
43-
return GetTimeSince(GetTicks());
43+
return GetTimeSinceOrigin(GetTicks());
4444
}
4545

46-
double Timer::GetTimeSince(long long ticks)
46+
double Timer::GetTimeSinceOrigin(long long ticks)
4747
{
4848
// double-checked locking, prevents pessimizing the happy-path
4949
if (!m_init)

application/DebugViewpp/MainFrame.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,11 @@ void CMainFrame::Pause()
13991399
m_logSources.Remove(m_pGlobalReader);
14001400
m_pGlobalReader = nullptr;
14011401
}
1402+
if (m_pKernelReader != nullptr)
1403+
{
1404+
m_logSources.Remove(m_pKernelReader);
1405+
m_pKernelReader = nullptr;
1406+
}
14021407
m_logSources.AddMessage("<paused>");
14031408
}
14041409

application/DebugViewppLib/Debugview_kernel_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "DebugViewppLib/Debugview_kernel_client.h"
77

88
constexpr const char* DRIVER_SERVICE_NAME = "debugviewdriver";
9-
constexpr const char* DRIVER_DISPLAY_NAME = "DebugViewPP Kernel Message Driver";
9+
constexpr const char* DRIVER_DISPLAY_NAME = "DbgView Kernel Message Driver";
1010
const std::string driverPath = "dbgv.sys";
1111

1212
void InstallKernelMessagesDriver()

application/DebugViewppLib/KernelReader.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ KernelReader::KernelReader(Timer& timer, ILineBuffer& linebuffer) :
6464
{
6565
SetDescription(L"Kernel Message Reader");
6666
InstallKernelMessagesDriver();
67-
AddMessage(0, "kernel", "Started capturing kernel messages");
6867
Signal();
6968
StartListening();
7069
StartThread();

application/DebugViewppLib/LogSource.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,11 @@ void LogSource::AddInternal(const std::string& message) const
9292
m_linebuffer.Add(m_timer.Get(), Win32::GetSystemTimeAsFileTime(), 0, "[internal]", message, this);
9393
}
9494

95+
double LogSource::GetTimeSinceOrigin(long long ticks) const
96+
{
97+
return m_timer.GetTimeSinceOrigin(ticks);
98+
}
99+
100+
95101
} // namespace debugviewpp
96102
} // namespace fusion

application/include/CobaltFusion/Timer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Timer
1919

2020
void Reset();
2121
double Get();
22-
double GetTimeSince(long long);
22+
double GetTimeSinceOrigin(long long);
2323

2424
private:
2525
double m_timerUnit;

application/include/DebugViewppLib/Debugview_kernel_client.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ void UninstallKernelMessagesDriver();
3838
#pragma pack(1)
3939
typedef struct
4040
{
41-
DWORD dwIndex;
42-
FILETIME liSystemTime;
43-
LARGE_INTEGER liPerfCounter;
44-
CHAR strData[0];
41+
DWORD dwIndex;
42+
FILETIME liSystemTime;
43+
LARGE_INTEGER liPerfCounter;
44+
CHAR strData[0];
4545
} LOG_ITEM, *PLOG_ITEM;
4646
#pragma pack()
4747

application/include/DebugViewppLib/LogSource.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ class LogSource : public fusion::noncopyable
6464
// used by FileReader
6565
void Add(const std::string& message);
6666

67+
// get the relative time since the start of the session given the QWORD of the performance counter
68+
double GetTimeSinceOrigin(long long ticks) const;
69+
6770
private:
6871
bool m_autoNewLine = true;
6972
ILineBuffer& m_linebuffer;

0 commit comments

Comments
 (0)