[lttng-dev] Adding LTTNG_DOMAIN_UNSPECIFIED

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Fri Feb 10 10:28:06 EST 2012


* Thibault, Daniel (Daniel.Thibault at drdc-rddc.gc.ca) wrote:
>    I would like to suggest adding to lttng.h an lttng_domain_type enum value of LTTNG_DOMAIN_UNSPECIFIED = 0.
> 
> enum lttng_domain_type {
> +	LTTNG_DOMAIN_UNSPECIFIED              = 0,
> 	LTTNG_DOMAIN_KERNEL                   = 1,
> 
>    This would simplify handling of domain option switches
>    (-k/--kernel, -u/--userspace) in the various commands (add_context,
>    calibrate, etc.).  Instead of a chain of if-else-if checking the
>    command-line options (currently opt_kernel, opt_userspace) one at a
>    time, we could have the command-line interpreter set an opt_domain
>    variable (initially LTTNG_DOMAIN_UNSPECIFIED) as each domain switch
>    is encountered (allowing for easily recognising a multiple-context
>    situation as a (opt_domain != LTTNG_DOMAIN_UNSPECIFIED) test), and
>    later processing could use a switch instead of the aforementioned
>    if-then-else-if chain.  It would make adding the currently planned
>    additional domains easier.

I think it would be a good idea, in general, to keep the "0" values of
enumerations as "unspecified" (or default) behavior, since as we extend
the API structures, those being zero-padded, they will just have a
semantic of "default" behavior with the zero value.

For the API items currently in place in lttng.h, I don't think it is
worth it changing them at this point of the development. But given there
is nothing assigned to the 0 value of enum lttng_domain_type, I think
it's a good opportunity to do it.

David, can you look into this ?

Thanks,

Mathieu

> 
> 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