Fix dropped kernel messages and stale state between driver loads#413
Open
wjhwjhn wants to merge 1 commit intoCobaltFusion:developfrom
Open
Fix dropped kernel messages and stale state between driver loads#413wjhwjhn wants to merge 1 commit intoCobaltFusion:developfrom
wjhwjhn wants to merge 1 commit intoCobaltFusion:developfrom
Conversation
…apture state on start/stop Raised the KernelReader poll rate from 1Hz to 1kHz, drained the driver ring per poll instead of reading one buffer and returning, and reset verbose/pass-through plus issued DBGV_CLEAR_DISPLAY around capture so state doesn't leak between driver loads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! First of all, thanks for keeping DebugView++ alive — it's been a daily tool for me for a long time.
On my machine I was seeing kernel-mode messages arrive with visible latency, and the occasional message going missing when the driver produced a burst. I spent some time looking at what
KernelReaderdoes today and comparing it with Sysinternals DbgView to understand what was going on, and I wanted to share what I found in case it's useful.The driver doesn't expose an event handle and
DBGV_READ_LOGis a synchronous IOCTL, so both viewers end up polling. A couple of small things inKernelReader's current shape looked like they could probably be tightened up:PolledLogSource::pollFrequencyis in Hz, so the current value1means one poll per second, which seems to explain most of the latency I was seeing. Bumping it to1000(≈1 ms interval) helps a lot, and I addedtimeBeginPeriod(1)/timeEndPeriod(1)so the 1 ms sleep isn't rounded up to the default scheduler tick. That's whywinmmis linked in CMake now — happy to split that out if you'd prefer.Poll()issued a singleDBGV_READ_LOGper tick, so if the driver produced more than one buffer-worth between polls, the rest got dropped. I changed it to drain the ring until the driver reports 0 bytes, which mirrors what DbgView's read loop does (it tight-loops the IOCTL until empty, bounded by a 300 ms budget, before yielding).DBGV_CLEAR_DISPLAYis now sent beforeDBGV_CAPTURE_KERNELso stale events from a previous session aren't replayed into the new one. DbgView does the same on startup.DBGV_UNCAPTURE_KERNEL, andm_pBufis nulled afterfreeto avoid a dangling pointer if start/stop is repeated.I'm very open to changing any of this — I've only been in this code briefly, so if any of the above is wrong about the design intent, or there's a different direction you'd prefer, I'd be happy to revise. Thanks again for taking a look!