Add a hdr_interval_recorder example to README
giltene opened this issue · 5 comments
It would be useful to have a simple example of using hdr_interval_recorder (recording, sampling, producing log output from sample) in the README, since it's [presumably] a common use pattern.
Did you get a chance to look at the hiccup.c and hdr_decoder.c examples linked from the bottom of the page? I went with a full working example rather than a few code snippets. I can update the readme to make it clearer what the examples cover or would it be more useful to inline some of the code?
hiccup.c is a good example, I agree. But it also highlights the complexity of the current recorder API (needing to provide an update function in "user" code, exposing the internal histograms and needing to initialize them separately). Perhaps the real thing here is a wish for simpler, more encapsulated recorder. One that would encapsulate the internal details and only expose histograms when sampling an interval histogram from the recorder, or potentially to an update function if an advanced use case. I'd definitely want a direct value recording API on the recorder, aimed at the common case of recording values (without needing to provide a function).
That makes sense, it should be possible to add most (all) of that by layering on top on what is already there. I'll have a hack at it this week.
Have a look at the API now, see if that is closer to what you are looking for.
Assuming this is okay, closing.