[lttng-dev] [BABELTRACE PATCH] Use default if there is no clock declaration

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Mon Feb 13 09:26:42 EST 2012


* Mathieu Desnoyers (mathieu.desnoyers at efficios.com) wrote:
> * Juha Niskanen (juniskane at gmail.com) wrote:
> > In absence of clock description in metadata, use a default clock
> > source which increments once per nanosecond.
> > 
> > Without this patch, the converter crashes when given old traces
> > that are lacking clock description block.
> 
> Merged (with tiny cosmetic fixes). Thanks !

FYI, with commit:

commit 02dc4610b1dccefaf545ba77378857ee6188ea33
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date:   Mon Feb 13 09:03:55 2012 -0500

    lib: open trace error handling fix
    
    When a trace from a trace collection path fails, consider this as a hard
    error. Print errors to stderr rather than stdout.
    
    The end goal is to never show an output if any of the trace specified
    (or trace within a trace collection) fails to open.
    
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>

opening unrelated traces into the same trace context will fail, because
those trace cannot be correlated. This will therefore not allow
Babeltrace to view LTTng-UST/LTTng-modules traces taken from older
2.0 prereleases.

I am adding a --clock-force-correlate to allow the user to force
babeltrace to accept those older traces, letting babeltrace assume that
correlation is OK. See:

commit 82ace6d6d97ecb15d093232c76c5d4a3c31e6948
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date:   Mon Feb 13 09:26:53 2012 -0500

    Add --clock-force-correlate option
    
    For support of older 2.0-pre traces.
    
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>

Thanks,

Mathieu




> 
> Mathieu
> 
> > 
> > Signed-off-by: Juha Niskanen <juniskane at gmail.com>
> > ---
> >  .../ctf/metadata/ctf-visitor-generate-io-struct.c  |   29 +++++++++++++++----
> >  1 files changed, 23 insertions(+), 6 deletions(-)
> > 
> > diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
> > index 2d3361c..8de2cae 100644
> > --- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
> > +++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
> > @@ -2302,6 +2302,20 @@ error:
> >  }
> >  
> >  static
> > +void clock_default_monotonic(struct ctf_trace *trace)
> > +{
> > +	struct ctf_clock *clock;
> > +
> > +	clock = g_new0(struct ctf_clock, 1);
> > +	/* Default clock frequency is set to 1000000000 */
> > +	clock->freq = 1000000000ULL;
> > +	clock->name = g_quark_from_string("monotonic");
> > +
> > +	trace->single_clock = clock;
> > +	g_hash_table_insert(trace->clocks, (gpointer) (unsigned long) clock->name, clock);
> > +}
> > +
> > +static
> >  void clock_free(gpointer data)
> >  {
> >  	struct ctf_clock *clock = data;
> > @@ -2516,12 +2530,15 @@ retry:
> >  			 * declarations need to query clock hash table,
> >  			 * so clock need to be treated first.
> >  			 */
> > -			cds_list_for_each_entry(iter, &node->u.root.clock, siblings) {
> > -				ret = ctf_clock_visit(fd, depth + 1, iter,
> > -						      trace);
> > -				if (ret) {
> > -					fprintf(fd, "[error] %s: clock declaration error\n", __func__);
> > -					goto error;
> > +			if (cds_list_empty(&node->u.root.clock))
> > +				clock_default_monotonic(trace);
> > +			else {
> > +				cds_list_for_each_entry(iter, &node->u.root.clock, siblings) {
> > +					ret = ctf_clock_visit(fd, depth + 1, iter, trace);
> > +					if (ret) {
> > +						fprintf(fd, "[error] %s: clock declaration error\n", __func__);
> > +						goto error;
> > +					}
> >  				}
> >  			}
> >  			env_clock_done = 1;
> > -- 
> > 1.7.4.1
> > 
> > 
> > _______________________________________________
> > 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
> 
> _______________________________________________
> 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