[lttng-dev] Changed scheduling when using lttng

Mats Liljegren liljegren.mats2 at gmail.com
Tue Apr 30 09:19:59 EDT 2013


I've done some code diving now, and I feel stupid...

I thought I could get global buffers in kernel traces using option
--buffers-global, as the help text seemed to indicate this:
$ lttng enable-channel --help
usage: lttng enable-channel NAME[,NAME2,...] [-u|-k] [OPTIONS]

Options:
  -h, --help               Show this help
      --list-options       Simple listing of options
  -s, --session NAME       Apply to session name
  -k, --kernel             Apply to the kernel tracer
  -u, --userspace          Apply to the user-space tracer

Channel options:
      --discard            Discard event when buffers are full (default)
      --overwrite          Flight recorder mode
      --subbuf-size SIZE   Subbuffer size in bytes
                               (default: 4096, kernel default: 262144)
                               Needs to be a power of 2 for
                               kernel and ust tracers
      --num-subbuf NUM     Number of subbufers
                               (default: 4)
                               Needs to be a power of 2 for
                               kernel and ust tracers
      --switch-timer USEC  Switch timer interval in usec (default: 0)
      --read-timer USEC    Read timer interval in usec (UST default:
0, kernel default: 200000)
      --output TYPE        Channel output type (Values: mmap, splice)
      --buffers-uid        Use per UID buffer (-u only)
      --buffers-pid        Use per PID buffer (-u only)
      --buffers-global     Use shared buffer for the whole system (-k only)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  -C, --tracefile-size SIZE
                           Maximum size of of each tracefile within a
stream (in bytes).
  -W, --tracefile-count COUNT
                           Used in conjunction with -C option, this
will limit the number
                           of files created to the specified count.

I look in src/bin/lttng/commands/enable_channels.c, the long option
array will point to opt_buffer_global. The only use for this file
private variable is for a single sanity check. I cannot see any other
use of it. Have I missed something here?

But in this file, function enable_channel(), I see:

                dom.buf_type = LTTNG_BUFFER_GLOBAL;

This is executed for the kernel case. But my buffers are still
allocated per-cpu. What is going on? Where did this configuration go?
What does it do?

If I take this from the other end, I'd like to use the line:
    .alloc = RING_BUFFER_ALLOC_GLOBAL
found in
    lttng-ring-buffer-metadata-client.h
How do I make this happen?

Thanks
   Mats



More information about the lttng-dev mailing list