X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=extras%2Fbindings%2Fswig%2Fpython%2Flttng.i.in;h=e48bf6d8e57a6e229d4ed76d62ad7f340916e586;hp=0d6d1e952634c0fcc5bbc1ef9045081d87bd558b;hb=965ef48e12ccfb55fed5c1782fb6739ce67dd323;hpb=36907cb5a542b8eb01d95e1990894abd45e98bc0 diff --git a/extras/bindings/swig/python/lttng.i.in b/extras/bindings/swig/python/lttng.i.in index 0d6d1e952..e48bf6d8e 100644 --- a/extras/bindings/swig/python/lttng.i.in +++ b/extras/bindings/swig/python/lttng.i.in @@ -9,12 +9,21 @@ multiple concurrent processes and threads. Tracing across multiple systems is al %module(docstring=DOCSTRING) lttng %include "typemaps.i" +%include "stdint.i" %include "pyabc.i" %{ #define SWIG_FILE_WITH_INIT #include %} +%{ +#if PY_MAJOR_VERSION >= 3 +// The PyInt and PyLong types were unified as of Python 3 +// This makes the typemap code useable with both Python 2 and 3. +#define PyInt_AsSsize_t PyLong_AsSsize_t +#endif +%} + typedef unsigned int uint32_t; typedef int int32_t; typedef unsigned long long uint64_t; @@ -126,10 +135,6 @@ enum lttng_event_context_type { LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10, }; -%rename("CALIBRATE_FUNCTION") LTTNG_CALIBRATE_FUNCTION; -enum lttng_calibrate_type { - LTTNG_CALIBRATE_FUNCTION = 0, -}; @@ -306,6 +311,7 @@ enum lttng_calibrate_type { // ============================================= %rename("create") lttng_create_session(const char *name, const char *path); +%rename("create_snapshot") lttng_create_session_snapshot(const char *name, const char *snapshot_url); %rename("destroy") lttng_destroy_session(const char *name); %rename("_lttng_create_handle") lttng_create_handle(const char *session_name, struct lttng_domain *domain); %rename("_lttng_destroy_handle") lttng_destroy_handle(struct lttng_handle *handle); @@ -325,7 +331,6 @@ enum lttng_calibrate_type { %rename("_lttng_enable_channel") lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel *chan); %rename("_lttng_disable_event") lttng_disable_event(struct lttng_handle *handle, const char *name, const char *channel_name); %rename("_lttng_disable_channel") lttng_disable_channel(struct lttng_handle *handle, const char *name); -%rename("_lttng_calibrate") lttng_calibrate(struct lttng_handle *handle, struct lttng_calibrate *calibrate); %rename("channel_set_default_attr") lttng_channel_set_default_attr(struct lttng_domain *domain, struct lttng_channel_attr *attr); //Redefined functions @@ -344,7 +349,6 @@ int lttng_enable_channel(struct lttng_handle *handle, struct lttng_channel *chan int lttng_disable_event(struct lttng_handle *handle, const char *name, const char *channel_name); int lttng_disable_channel(struct lttng_handle *handle, const char *name); -int lttng_calibrate(struct lttng_handle *handle, struct lttng_calibrate *calibrate); int lttng_register_consumer(struct lttng_handle *handle, const char *socket_path); int lttng_list_sessions(struct lttng_session **sessions); int lttng_list_domains(const char *session_name, struct lttng_domain **domains); @@ -353,14 +357,20 @@ int lttng_list_domains(const char *session_name, struct lttng_domain **domains); %feature("docstring")"create(str name, str path) -> int Create a new tracing session using name and path. -Returns size of returned session payload data or a negative error code." +Returns 0 on success or a negative error code." int lttng_create_session(const char *name, const char *path); +%feature("docstring")"create_snapshot(str name, str snapshot_url) -> int + +Create a new tracing session using name and snapshot_url in snapshot +mode (flight recorder). +Returns 0 on success or a negative error code." +int lttng_create_session_snapshot(const char *name, const char *path); %feature("docstring")"destroy(str name) -> int Tear down tracing session using name. -Returns size of returned session payload data or a negative error code." +Returns 0 on success or a negative error code." int lttng_destroy_session(const char *name); @@ -680,20 +690,6 @@ def disable_channel(handle, name): return _lttng_disable_channel(handle._h, name) except AttributeError: raise TypeError("in method 'disable_channel', argument 1 must be a Handle instance") - - -def calibrate(handle, calibrate): - """ - calibrate(Handle handle, Calibrate calibrate) -> int - - Quantify LTTng overhead. - Returns size of returned session payload data or a negative error code. - """ - - try: - return _lttng_calibrate(handle._h, calibrate) - except AttributeError: - raise TypeError("in method 'calibrate', argument 1 must be a Handle instance") %} @@ -707,7 +703,7 @@ def calibrate(handle, calibrate): %pythoncode %{ class Handle: - """ + """ Manages a handle. Takes two arguments: (str session_name, Domain domain) """ @@ -760,7 +756,6 @@ class Handle: %rename("Domain") lttng_domain; %rename("EventContext") lttng_event_context; %rename("Event") lttng_event; -%rename("Calibrate") lttng_calibrate; %rename("ChannelAttr") lttng_channel_attr; %rename("Channel") lttng_channel; %rename("Session") lttng_session; @@ -938,26 +933,6 @@ struct lttng_event { } }; -struct lttng_calibrate { - enum lttng_calibrate_type type; - char padding[LTTNG_CALIBRATE_PADDING1]; - - %extend { - char *__repr__() { - static char temp[256]; - switch ( $self->type ) { - case 0: - sprintf(temp, "lttng.Calibrate; type(CALIBRATE_FUNCTION)"); - break; - default: - sprintf(temp, "lttng.Calibrate; type(%i)", $self->type); - break; - } - return &temp[0]; - } - } -}; - struct lttng_channel_attr { int overwrite; uint64_t subbuf_size; @@ -984,8 +959,8 @@ struct lttng_channel_attr { sprintf(evout, "%i", $self->output); break; } - sprintf(temp, "lttng.ChannelAttr; overwrite(%i), subbuf_size(%lu), " - "num_subbuf(%lu), switch_timer_interval(%u), " + sprintf(temp, "lttng.ChannelAttr; overwrite(%i), subbuf_size(%"PRIu64"), " + "num_subbuf(%"PRIu64"), switch_timer_interval(%u), " "read_timer_interval(%u), output(%s)", $self->overwrite, $self->subbuf_size, $self->num_subbuf, $self->switch_timer_interval, $self->read_timer_interval,