Previously, I introduced DirectoryWatcher but it was woefully untestable. Tight coupling to the file system is something that would be at odds with a microtesting practice as described by “Geepaw” Hill. I agree with him and nearly always avoid extraneous…
Watching a directory: basic intro
Let’s say we want to write a .NET Core class that watches for file changes in a single directory. The implementation should only notify for explicitly subscribed files. For example, if DIR is being watched and DIR\file1.txt is subscribed, we…
Let’s do DHCP: more diagnostic events
While thinking about how to combine latency measurement with diagnostic events in the DHCP server, I noticed a particular gap in the design. Right now the event interfaces look like this: However, if we want to incorporate latency metrics, we…
Low-latency latency measurement
Measuring latency is easy with .NET. Just use a Stopwatch! This is certainly the most commonly recommended way to measure operational timings. But is it the fastest way? It seems almost absurd to ask for a low-latency latency measurement, but…
Let’s do DHCP: diagnostic events
There is always something new to do with the DHCP server sample. Today we will look at how to add diagnostic events. After all, any good server technology intended to run in real world production scenarios needs observability. One approach…
Let’s do DHCP: fuzzing
The DHCP server project is still alive and well. It’s definitely sample code, for demonstration purposes only, and other disclaimers. Even so, it is a technology that processes arbitrary network data, and we ought to worry about malicious input. To…
A faster TryFormat
As part of my ongoing DHCP adventure, I needed to start thinking about string formatting for some of the core data types like MacAddress. After all, these values are likely to make their way into a trace file eventually and…
EventSource and Span: take 3
Previously, we determined that mixing EventSource and Span is costly. Now it’s just a matter of finding the lowest cost. The last approach used an ArrayPool for all ETW strings. But remember that ETW events are capped at 64 KB.…
EventSource and Span: take 2
Last time, we talked about how EventSource and Span don’t really mix. ETW wants a null-terminated string for tracing and Span isn’t set up for that. It turns out this null terminator issue has been explored in some depth by…
EventSource and Span: take 1
Let’s say you’re living the zero-allocation, universal memory .NET life, and you need to trace some char data. The only problem is that you have a Span<char> and EventSource only supports string. What to do? We’ll start with a typical…