Fix a claim in the ring buffer blueprint: the trace file does say how many - #70
Merged
Conversation
… many Merged yesterday and wrong in one place. The blueprint said the trace file does not say that events were lost. It does. Its header carries entries-in-buffer/entries-written, and the second of those two numbers is this processor's kept events plus its overrun, added up when the header is printed. On the capture in section 5 it would read 273/44275. What is actually true is narrower and more useful. Neither way of reading a trace gives you both halves. The trace file says how many, once, at the top, in a header a reader skips on the way to the lines, and marks nothing in the body, so the body reads the same whether nothing was lost or almost everything was. trace_pipe is the other way round: it prints CPU:0 [LOST 44002 EVENTS] at the position the loss happened and has no header at all. The header is also a display option rather than part of the format, so turning context-info off removes the one admission the file makes. The project's own parser had this right the whole time. TraceLog in kxray/models/flat.py reads that banner and its docstring says a trace where the two numbers differ has holes in it that nothing in the body admits to. The blueprint should have agreed with it. Section 3 gains a step 22 for where the header number comes from, section 6 and section 9 are corrected, and the diagram gains the header line and a band that says each way of reading a trace tells you half. Three new citations, R76 to R78, all confirmed against the pinned tree. Invariant 11 is unchanged and still holds: the iterator's missed events flag is never set on an ordinary buffer.
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.
What this fixes
A claim in
trace-ring-buffer, merged in #69, that is wrong.The blueprint said the
tracefile does not say that events were lost. It does. The header of that file carriesentries-in-buffer/entries-written, and the second of those two numbers is not a counter the writer keeps: it is this processor's kept events plus its overrun, added up at the moment the header is printed. On the capture in section 5 it would read273/44275.What is actually true
Narrower, and more useful than what was there before. Neither way of reading a trace gives you both halves of the answer.
The
tracefile says how many, once, at the top, in a header a reader skips on the way to the lines. It marks nothing in the body, so the body reads exactly the same whether nothing was lost or almost everything was. The header is also a display option rather than part of the format, soecho 0 > options/context-inforemoves the one admission the file makes.trace_pipeis the other way round. It printsCPU:0 [LOST 44002 EVENTS]at the position the loss happened, so it says where, and it has no header at all.Two readers of the same buffer, each of which is missing a different half. That is a better sentence than the one it replaces, and it has the advantage of being true.
The project already knew
TraceLoginkxray/models/flat.pyreads that banner intoin_bufferandwritten, has alostproperty that subtracts them, and its docstring says a trace where the two differ has holes in it that nothing in the body of the file admits to. The parser was right and the blueprint disagreed with it.What changed
seq_printfthat prints the header, the addition ofring_buffer_overrun_cpuinto the total, and theCONTEXT_INFOtest that can remove the header.Gates
All of them, locally.
bpc: 5 blueprint(s) clean,refcheck: paths clean, 210 citation(s),baseline: 41 artefact(s), 7968 line(s), 0 unparsed,lintprose: 41 file(s) clean.