From: compudj Date: Sat, 19 Jun 2004 19:36:03 +0000 (+0000) Subject: some fixes for global traces X-Git-Tag: v0.12.20~2888 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5e2c04a21b4282bbd5318d53956d556c0946d8dd;p=lttv.git some fixes for global traces git-svn-id: http://ltt.polymtl.ca/svn@601 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/lttv/attribute.c b/ltt/branches/poly/lttv/lttv/attribute.c index 8088f3ba..a862cdf7 100644 --- a/ltt/branches/poly/lttv/lttv/attribute.c +++ b/ltt/branches/poly/lttv/lttv/attribute.c @@ -506,6 +506,7 @@ attribute_interface_init (gpointer g_iface, gpointer iface_data) klass->find_subdir = (LttvIAttribute* (*) (LttvIAttribute *self, LttvAttributeName name)) lttv_attribute_find_subdir; + } diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 1c2a7f4d..cb9bd70a 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -849,6 +849,12 @@ lttv_trace_find_hook(LttTrace *t, char *facility, char *event_type, } +LttvTracesetContextPosition *ltt_traceset_context_position_new() +{ + return g_new(LttvTracesetContextPosition,1); +} + + void lttv_traceset_context_position_save(const LttvTracesetContext *self, LttvTracesetContextPosition *pos) { @@ -907,6 +913,32 @@ void lttv_traceset_context_position_destroy(LttvTracesetContextPosition *pos) } +void lttv_traceset_context_position_copy(LttvTracesetContextPosition *dest, + const LttvTracesetContextPosition *src) +{ + guint nb_trace, nb_tracefile; + guint iter_trace, iter_tracefile; + + nb_trace = dest->nb_trace = src->nb_trace; + dest->t_pos = g_new(LttvTraceContextPosition, nb_trace); + + for(iter_trace = 0 ; iter_trace < nb_trace ; iter_trace++) { + + nb_tracefile = dest->t_pos[iter_trace].nb_tracefile = + src->t_pos[iter_trace].nb_tracefile; + + for(iter_tracefile = 0; iter_tracefile < nb_tracefile; iter_tracefile++) { + dest->t_pos[iter_trace].tf_pos[iter_tracefile] = + ltt_event_position_new(); + ltt_event_position_copy( + dest->t_pos[iter_trace].tf_pos[iter_tracefile], + src->t_pos[iter_trace].tf_pos[iter_tracefile]); + } + } + + dest->timestamp = src->timestamp; +} + gint lttv_traceset_context_ctx_pos_compare(const LttvTracesetContext *self, const LttvTracesetContextPosition *pos) { diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.h b/ltt/branches/poly/lttv/lttv/tracecontext.h index 77f9f63c..3a3f5f61 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.h +++ b/ltt/branches/poly/lttv/lttv/tracecontext.h @@ -282,11 +282,16 @@ void lttv_trace_find_hook(LttTrace *t, char *facility, char *event_type, LttvTracefileContext *lttv_traceset_context_get_current_tfc( LttvTracesetContext *self); +LttvTracesetContextPosition *ltt_traceset_context_position_new(); + void lttv_traceset_context_position_save(const LttvTracesetContext *self, LttvTracesetContextPosition *pos); void lttv_traceset_context_position_destroy(LttvTracesetContextPosition *pos); +void lttv_traceset_context_position_copy(LttvTracesetContextPosition *dest, + const LttvTracesetContextPosition *src); + gint lttv_traceset_context_pos_pos_compare( const LttvTracesetContextPosition *pos1, const LttvTracesetContextPosition *pos2); diff --git a/ltt/branches/poly/lttv/lttv/traceset.c b/ltt/branches/poly/lttv/lttv/traceset.c index c487b64e..fd67c688 100644 --- a/ltt/branches/poly/lttv/lttv/traceset.c +++ b/ltt/branches/poly/lttv/lttv/traceset.c @@ -83,11 +83,8 @@ LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig) trace = g_ptr_array_index(s_orig->traces, i); trace->ref_count++; - /*CHECK this used ltt_trace_copy while it may not be needed. Need to - define how traces and tracesets are shared */ - g_ptr_array_add( - s->traces, - g_ptr_array_index(s_orig->traces, i)); + g_ptr_array_add(s->traces, + trace); } s->a = LTTV_ATTRIBUTE(lttv_iattribute_deep_copy(LTTV_IATTRIBUTE(s_orig->a))); return s; @@ -122,6 +119,14 @@ gint lttv_traceset_save(LttvTraceset *s) void lttv_traceset_destroy(LttvTraceset *s) { + guint i; + + for(i=0;itraces->len;i++) { + LttvTrace *trace = g_ptr_array_index(s->traces, i); + lttv_trace_unref(trace); + if(lttv_trace_get_ref_number(trace) == 0) + lttv_trace_destroy(trace); + } g_ptr_array_free(s->traces, TRUE); g_object_unref(s->a); g_free(s);