Skip to content

Devlog ​

Field notes from building Nusku: what changed, what broke, and what I learned along the way. Every Markdown entry added to the devlog folder appears below automatically.

Devlog entryEp1 Setting Up The ProjectThis is first task, we should do is building the infrastructure for the tool and the most important one is CliRead more Devlog entryEp2 Working On Infrastructure For The AppSince we are using Zig and the available libraries and packages are limited, we need to implement some of the core infrastructure code that we need for this project.Read more Devlog entryEp3 Architecture And ComponentsAfter we complete the infrastructure code that we need in this project, we can move one to next task which is the architecture of this project, i was thinking how we should do thisRead more Devlog entryEp4 First Components The Fun PartSo our first component is Agent: as we talked about, the agent in short is the component that runs next to a profiled process, collects data, and streams it out.Read more Devlog entryEp5 First Measurement Agent Can DoAfter understanding the 4 core concepts for this project which are Loader, ELF, Object files + BPFRead more Devlog entryEp6 Advance Zig Language Features We NeedBefore continuing with the BPF logic, let's separate the Zig language features from what the profiler is doing. Otherwise you'll end up understanding the profiler concept but gettRead more Devlog entryEp7 How Nusku Collects Cpu SamplesNusku uses CPU sampling to understand where a process spends its execution time.Read more Devlog entryEp8 Parse BPF ELF Objectstoday we will implement a lightweight ELF parser for Nusku.Read more Devlog entryEp9 Unwinding Stacks Inside EbpfIn Ep7 we saw the first version of the on-CPU profiler. The eBPF program was about 80 lines: it asked the kernel for the user stack and the kernel stack, and counted them.Read more Devlog entryEp10 Reorganizing The AgentAfter Ep9 the on-CPU profiler worked, but the agent's code had grown in whatever direction the last feature pushed it. Today is a cleanup episode, but not a cosmetic one: the new lRead more Devlog entryEp11 Counting ForeverAt the end of Ep9 I wrote: "The counts only grow. The agent takes snapshots and uses the difference between two snapshots as a time window. It never deletes anything."Read more Devlog entryEp12 Bugs The Tests FoundEp10 and Ep11 were about design. This one is about bugs: some found by reading the code carefully, and two that only showed up when the tests ran as root against a real kernel. TheRead more Devlog entryEp13 Unwinding Through The VdsoEp12 ended with a lesson from a failing test: a program that reads the clock in a hot path loses the callers of those samples. This episode fixes that, and on the way finds out thaRead more Devlog entryEp14 Using The Agent ApiSuperseded. profile and its hooks were replaced by Run and Watch, pulled with next: see Ep19.Read more Devlog entryEp15 The Agent From Top To BottomTen episodes built the agent piece by piece. This one puts the pieces together: what each layer is, why it is built the way it is, and how a sample and a report travel through all Read more Devlog entryEp16 New Cpus More Libraries And GoThree accuracy steps for the on-CPU profiler, smaller than the last ones but each closing a real gap:Read more Devlog entryEp17 What The Agent Sends To Name An AddressUntil now the agent sent stacks of raw addresses, such as 0x7f3a1245c1a3. A person wants parseheader instead. The work of turning one into the other is called symbolization, and itRead more Devlog entryEp18 The Whole PipelineUntil this episode, Nusku had an agent that collected stacks of raw addresses, and the start of a server. Now the whole path works, and it is one command:Read more Devlog entryEp19 Layers A Pull Api And One ProtocolFor the agent as it is now , see Ep22, the agent's reference. This episode is how it got there.Read more Devlog entryEp20 The Server And The Cli In LayersFor the server as it is now , see Ep23, the server's reference. This episode is how it got there.Read more Devlog entryEp21 The Rules Of The ProjectThis episode is a reference, not a story. It collects the rules Nusku's code follows, so that new code reads like the old, and so that adding a feature means following a recipe insRead more Devlog entryEp22 The Agent A ReferenceEp19 told how the agent was redesigned. Since then, a few things have moved: every layer is now a folder with its facade inside, ebpf became metrics, and the watch reports the wholRead more Devlog entryEp23 The Server A ReferenceEp20 told how the server was split into layers. This episode is the server as it is today, the same way Ep22 is for the agent: to come back to when something has to be added or chaRead more Devlog entryEp24 The Cli A ReferenceEp22 is the agent and Ep23 the server. This is the third part: nusku, the program a person runs, in src/. It is the smallest of the three, and the one that changes most often, sincRead more Devlog entryEp25 Shared A ReferenceThe fourth reference, after the agent , the server and the CLI . shared/ is what more than one of them needs, so none of them owns it: the protocol between the agent and the serveRead more Devlog entryEp26 One Server Two ClientsFor each part on its own, see the references: the agent , the server , the CLI and shared . This episode is how they fit together now that there is a second client, the desktop apRead more Devlog entryEp27 A Live Profile In The AppEp26 ended with the app able to list processes but not profile them. This episode is the profile itself in the app: the views, and the work it took to keep a profile live once a seRead more Devlog entryEp28 Names You Can TrustThe first profile in the app showed 0x12e892c, Unnamed, Unnamed. This episode is everything between an address and a name a person recognizes: which file the address belongs to, whRead more Devlog entryEp29 Reading Dwarf OurselvesA function name says where the time went. A source line says what to change. This episode is the DWARF reader in the server: source files and lines for every frame, and the inlinedRead more Devlog entryEp30 Launching A Program And Saying What We MissedTwo features that make a profile something you can act on. Launching: profile a program from its first instruction instead of racing to attach. Quality: a profile that tells you whRead more Devlog entryEp31 The Cli Catches UpFor a few episodes the app got everything first: lines, inlined frames, quality, launching, time ranges, many profiles at once. This episode brings nusku prof level with it, and adRead more Devlog entryEp32 The Gray LibcA bug report that looked like "names disappear after a while", and was really "names were never asked for twice". How it was found in a running process with gdb, and why the fix maRead more

Built in the open with Zig and eBPF.