On Tue, Nov 28, 2023 at 12:22 PM ilya meignan-masson <ilya.meig...@gmail.com>
wrote:

> Hello
> I am also working on a similar project about page caching for databases. I
> am also faced with similar issues as the OP. I have a workload that
> executes for several minutes and the traces that I manage to extract are
> only a few seconds long.
>
> Exactly. OSv's tracepoints have two modes. One is indeed to save them in a
> ring buffer - so you'll see the last N traced events when you read that
> buffer - but other is a mode that just counts the events. What freq.py does
> is to retrieve the count at one second, then retrieve the count the next
> second - and the subtraction is the average number of this even per second.
>
>
> I don't understand your answer. How do you enable either of those modes ?
> I don't see any mention of such modes in the wiki (
> https://github.com/cloudius-systems/osv/wiki/Trace-analysis-using-trace.py).
>
>

The tracing described in this document - at least its beginning, is the
ring buffer "mode" - each trace event is saved to a ring buffer with a size
which should be configurable (I don't remember right now where it's
configured...).

The "counting" mode is different - when a tracepoint is enabled in "count"
mode, each time this event occurs, a counter is incremented and nothing
else. This is super-fast - you can count extremely frequent, even a million
per second, with little or no performance degredation.

We have a script, scripts/freq.py, which makes this easy to use. It needs
the *httpserver* module to be included in the OSv image, and connects to it
to enable counters and then show the counter increment every few seconds
(i.e., the frequency of the event).

For example,

scripts/build -j8 modules=rogue,httpserver
scripts/run

and in another window,

scripts/freq.py localhost sched_switch

(or something like that... I can't test this right now because for some
reason the httpserver module doesn't build on my Fedora 38, I'll need to
check this later)



> /scripts/run.py only includes options to "enable" tracepoints but no way
> to choose between those modes. By default, it seems to me that the default
> is the first mode, recording events.
> In the code, I have not found any definition of a fixed size buffer for
> trace events.
> The only variable that seems relevant is trace_log_size defined in
> include/osv/trace.hh. It corresponds to the size of a ring-buffer for trace
> logging which you are also mentionning. However, this ring buffer seems to
> be used only by the strace functionality and not during "normal" tracing.
> I tried to increase the size of this ring-buffer but no change on the
> number of events collected as I expected.
> Could you enlighten me on this part ?
>

I think this is core/trace.cc, which has
        const size_t size = trace_page_size * std::max(size_t(256), 1024 /
ncpu);

which means up to 256*4096 = 1MB of size. I think you can increase this to
any number you want and recompile. I don't remember why this isn't
documented anywhere or be made easier to configure (it's been years since I
last look at this code...)

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/CANEVyjunJ2QzU8deRnfF%2BCPaAhmfsGiSJ2XHdV6xn0_8edJLSQ%40mail.gmail.com.

Reply via email to