From: Jonathan Rajotte Date: Thu, 23 May 2019 18:02:26 +0000 (-0400) Subject: Fix: python binding: expose domain buffer type X-Git-Tag: v2.11.0-rc2~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1872cc330fe6c67a77aff5f8bb022981f946ae49;p=lttng-tools.git Fix: python binding: expose domain buffer type On enable_channel the domain buffer type is used to create a temporary channel. This currently fail for kernel channel since the buffer type is not exposed at the binding level and default to LTTNG_BUFFER_PER_PID. Channel for the kernel domain can only be created in LTTNG_BUFFER_GLOBAL mode. Exposing the buffer type also allow userpsace channel to use the per uid buffering scheme. The current bindings are in a rough state. This is to at least get them to work with kernel domain. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/extras/bindings/swig/python/lttng.i.in b/extras/bindings/swig/python/lttng.i.in index 7418d01d6..780ee01b5 100644 --- a/extras/bindings/swig/python/lttng.i.in +++ b/extras/bindings/swig/python/lttng.i.in @@ -44,6 +44,15 @@ enum lttng_domain_type { LTTNG_DOMAIN_UST = 2, }; +%rename("BUFFER_PER_PID") LTTNG_BUFFER_PER_PID; +%rename("BUFFER_PER_UID") LTTNG_BUFFER_PER_UID; +%rename("BUFFER_GLOBAL") LTTNG_BUFFER_GLOBAL; +enum lttng_buffer_type { + LTTNG_BUFFER_PER_PID, + LTTNG_BUFFER_PER_UID, + LTTNG_BUFFER_GLOBAL, +}; + %rename("EVENT_ALL") LTTNG_EVENT_ALL; %rename("EVENT_TRACEPOINT") LTTNG_EVENT_TRACEPOINT; %rename("EVENT_PROBE") LTTNG_EVENT_PROBE; @@ -179,18 +188,20 @@ enum lttng_event_context_type { int i; for(i=0; itype ) { case 1: - sprintf(temp, "lttng.Domain; type(DOMAIN_KERNEL)"); + sprintf(domain_type, "type(DOMAIN_KERNEL)"); break; case 2: - sprintf(temp, "lttng.Domain; type(DOMAIN_UST)"); + sprintf(domain_type, "type(DOMAIN_UST)"); break; default: - sprintf(temp, "lttng.Domain; type(%i)", $self->type); + sprintf(domain_type, "type(%i)", $self->type); break; } + + switch ( $self->buf_type ) { + case LTTNG_BUFFER_PER_UID: + sprintf(buffer_type, "buf_type(BUFFER_PER_UID)"); + break; + case LTTNG_BUFFER_PER_PID: + sprintf(buffer_type, "buf_type(BUFFER_PER_PID)"); + break; + case LTTNG_BUFFER_GLOBAL: + sprintf(buffer_type, "buf_type(BUFFER_GLOBAL)"); + break; + default: + sprintf(buffer_type, "buf_type(%i)", $self->buf_type); + break; + } + + sprintf(temp, "lttng.Domain; %s, %s", + domain_type, + buffer_type + ); return &temp[0]; } }