[lttng-dev] [PATCH] A partial rewrite of lttctl
Mathieu Desnoyers
compudj at krystal.dyndns.org
Tue Dec 6 12:04:26 EST 2011
Dear Mr. Thibault,
As shown by the last 2 years of activity on the lttng-dev mailing list,
LTTng 0.x is in maintainance-only mode, which means that I only take
obvious bugfix patches for these old versions.
If you want to work with us on improving the LTTng code-base, please
refer to http://lttng.org/lttng2.0.
If you can split out the obvious bugfixes from the refactoring/rewrite,
I would gladly accept the bugfixes. I'm afraid the
refactoring/rewrite/documentation cannot be pulled into the upstream
repository, as this would consume patch review time that really needs to
be spent on the versions of the project under active development.
If the fact that LTTng 0.x is now in maintainance-only mode comes to you
as a surprise, I would strongly recommend that you subscribe to the
lttng-dev mailing list. For this, please refer to
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Best regards,
Mathieu
* Thibault, Daniel (Daniel.Thibault at drdc-rddc.gc.ca) wrote:
> Below is a patch for git.lttng.org/ltt-control/liblttctl/lttctl.h. I hope I have the patch-submission procedure and mailing list format right.
>
> I have two other large patches to submit, for liblttctl/liblttctl.c and lttctl/lttctl.c (more to follow), both about 1500 lines because the code underwent a very thorough rewrite. The intent in both cases is to document the functions, retrofit a version history, improve the error messages, tighten parameter checking and error handling, and fix a number of bugs (memory leaks and the like). Should I submit them like this one, or deposit them elsewhere?
>
> lttctl.h.diff
> ------
> --- ../ltt-control-0.89-792f03c/liblttctl/lttctl.h 2011-05-12 08:44:27.000000000 -0400
> +++ ../ltt-control-0.89-792f03c.dut/liblttctl/lttctl.h 2011-12-02 15:05:53.959130072 -0500
> @@ -20,28 +20,77 @@
> * You should have received a copy of the GNU Lesser General Public
> * License along with this library; if not, write to the Free Software
> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + *
> + * Version History:
> + * Version 1.0 2009-08-12 Pierre-Marc Fournier pierre-marc.fournier at polymtl.ca
> + * Moved out of git.lttng.org trunk/ltt-control.
> + * Version 1.1 2009-11-12 Mathieu Desnoyers mathieu.desnoyers at efficios.com
> + * Added lttctl_set_channel_switch_timer.
> + * Version 1.2 2010-03-03 Mathieu Desnoyers mathieu.desnoyers at efficios.com
> + * Changed flag from _LIBLTT_H to _LTTCTL_H.
> + * Version 1.3 2011-11-28 Daniel U. Thibault daniel.thibault at drdc-rddc.gc.ca
> + * Retrofitted version history.
> + * Added defines (some imported from lttctlkerninterface.c) which could be handy elsewhere
> + * (pieces of debugfs paths, LTT_BUFFERS_MIN_SIZE, LTT_BUFFERS_MAX_SIZE, ROUNDINTUP macro).
> + * Cosmetic change of the function headers: *name became *tracename.
> */
>
> #ifndef _LTTCTL_H
> #define _LTTCTL_H
>
> +/*
> + * Imported from lttctlkerninterface.c (where they are static const char* const)
> + * The names were prefixed with "LTT_" and suffixed with "_PATH" (as needed) to avoid name collisions
> + */
> +#define LTT_PATH "/ltt"
> +#define LTTD_PATH "/lttd"
> +//To these two we appended "/"
> +#define LTT_CONTROL_PATH "/control/"
> +#define LTT_CHANNEL_PATH "/channel/"
> +//#define LTT_MARKERS_PATH "/markers"
> +//#define LTT_MARKERS_INFO_PATH "/info"
> +#define LTT_MARKERS_ENABLE_PATH "/enable"
> +//These are new:
> +#define LTT_SETUP_TRACE_PATH "/setup_trace"
> +#define LTT_ALLOC_TRACE_PATH "/alloc"
> +#define LTT_DESTROY_TRACE_PATH "/destroy_trace"
> +#define LTT_ENABLE_TRACE_PATH "/enabled"
> +#define LTT_TRACE_TRANSPORT_PATH "/trans"
> +#define LTT_BUFFERS_OVERWRITE_PATH "/overwrite"
> +#define LTT_BUFFERS_NUMBER_PATH "/subbuf_num"
> +#define LTT_BUFFERS_SIZE_PATH "/subbuf_size"
> +#define LTT_BUFFERS_TIMER_PATH "/switch_timer"
> +
> +#define LTT_BUFFERS_MIN_SIZE (0x100)
> +//lttctl.c's struct channel_option uses int for its bufsize (sub-buffer size);
> +//ltt-private.h uses uint32_t for sb_size, the subbuf_size;
> +//A few files use an unsigned long instead (lttctlkerninterface.c, .h)
> +//Note that "unsigned" is "unsigned int" according to the C99 spec
> +//int maxes out with 0x7FFFFFFF, but we want a power of two:
> +#define LTT_BUFFERS_MAX_SIZE (0x40000000)
> +
> +//Based on: Sean Eron Anderson (2005), "Bit Twiddling Hacks: Round up to the next highest power of 2", http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
> +//This (rather clunky) macro can handle ints of all byte widths from char (1 byte) to long long (8 bytes);
> +//It is designed to be invoked on a variable (not an expression), as the standalone line "ROUNDINTUP(variable);"
> +#define ROUNDINTUP(i) { i--; i |= i >> 1; i |= i >> 2; if (sizeof(i) > 1) { i |= i >> 4; if (sizeof(i) > 2) { i |= i >> 8; if (sizeof(i) > 4) { i |= i >> 16; } } } i++; }
> +
> int lttctl_init(void);
> int lttctl_destroy(void);
> -int lttctl_setup_trace(const char *name);
> -int lttctl_destroy_trace(const char *name);
> -int lttctl_alloc_trace(const char *name);
> -int lttctl_start(const char *name);
> -int lttctl_pause(const char *name);
> -int lttctl_set_trans(const char *name, const char *trans);
> -int lttctl_set_channel_enable(const char *name, const char *channel,
> +int lttctl_setup_trace(const char *tracename);
> +int lttctl_destroy_trace(const char *tracename);
> +int lttctl_alloc_trace(const char *tracename);
> +int lttctl_start(const char *tracename);
> +int lttctl_pause(const char *tracename);
> +int lttctl_set_trans(const char *tracename, const char *trans);
> +int lttctl_set_channel_enable(const char *tracename, const char *channel,
> int enable);
> -int lttctl_set_channel_overwrite(const char *name, const char *channel,
> +int lttctl_set_channel_overwrite(const char *tracename, const char *channel,
> int overwrite);
> -int lttctl_set_channel_subbuf_num(const char *name, const char *channel,
> +int lttctl_set_channel_subbuf_num(const char *tracename, const char *channel,
> unsigned subbuf_num);
> -int lttctl_set_channel_subbuf_size(const char *name, const char *channel,
> +int lttctl_set_channel_subbuf_size(const char *tracename, const char *channel,
> unsigned subbuf_size);
> -int lttctl_set_channel_switch_timer(const char *name, const char *channel,
> +int lttctl_set_channel_switch_timer(const char *tracename, const char *channel,
> unsigned switch_timer);
>
> /* Helper functions */
> ------
>
> Daniel U. Thibault
> R & D pour la défense Canada - Valcartier (RDDC Valcartier) / Defence R&D Canada - Valcartier (DRDC Valcartier)
> Système de systèmes (SdS) / System of Systems (SoS)
> Solutions informatiques et expérimentations (SIE) / Computing Solutions and Experimentations (CSE)
> 2459 Boul. Pie XI Nord
> Québec, QC G3J 1X5
> CANADA
> Vox : (418) 844-4000 x4245
> Fax : (418) 844-4538
> NAC: 918V QSDJ
> Gouvernement du Canada / Government of Canada
> <http://www.valcartier.drdc-rddc.gc.ca/>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list