projects
/
lttv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't calculate statistic again if it is already done
[lttv.git]
/
ltt
/
branches
/
poly
/
lttv
/
traceset.c
diff --git
a/ltt/branches/poly/lttv/traceset.c
b/ltt/branches/poly/lttv/traceset.c
index 2192d212342c3747629a9593a918e030c4d52e04..ce96b99a1e16d5fcc6ca3dbde5b99901276c32d0 100644
(file)
--- a/
ltt/branches/poly/lttv/traceset.c
+++ b/
ltt/branches/poly/lttv/traceset.c
@@
-18,6
+18,7
@@
struct _LttvTraceset {
struct _LttvTrace {
LttTrace *t;
LttvAttribute *a;
struct _LttvTrace {
LttTrace *t;
LttvAttribute *a;
+ guint ref_count;
};
};
@@
-32,6
+33,11
@@
LttvTraceset *lttv_traceset_new()
return s;
}
return s;
}
+char * lttv_traceset_name(LttvTraceset * s)
+{
+ return s->filename;
+}
+
LttvTrace *lttv_trace_new(LttTrace *t)
{
LttvTrace *new_trace;
LttvTrace *lttv_trace_new(LttTrace *t)
{
LttvTrace *new_trace;
@@
-39,6
+45,7
@@
LttvTrace *lttv_trace_new(LttTrace *t)
new_trace = g_new(LttvTrace, 1);
new_trace->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
new_trace->t = t;
new_trace = g_new(LttvTrace, 1);
new_trace->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
new_trace->t = t;
+ new_trace->ref_count = 0;
return new_trace;
}
return new_trace;
}
@@
-47,12
+54,16
@@
LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig)
{
int i;
LttvTraceset *s;
{
int i;
LttvTraceset *s;
+ LttvTrace * trace;
s = g_new(LttvTraceset, 1);
s->filename = NULL;
s->traces = g_ptr_array_new();
for(i=0;i<s_orig->traces->len;i++)
{
s = g_new(LttvTraceset, 1);
s->filename = NULL;
s->traces = g_ptr_array_new();
for(i=0;i<s_orig->traces->len;i++)
{
+ 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(
/*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(
@@
-106,6
+117,7
@@
void lttv_trace_destroy(LttvTrace *t)
void lttv_traceset_add(LttvTraceset *s, LttvTrace *t)
{
void lttv_traceset_add(LttvTraceset *s, LttvTrace *t)
{
+ t->ref_count++;
g_ptr_array_add(s->traces, t);
}
g_ptr_array_add(s->traces, t);
}
@@
-125,6
+137,10
@@
LttvTrace *lttv_traceset_get(LttvTraceset *s, unsigned i)
void lttv_traceset_remove(LttvTraceset *s, unsigned i)
{
void lttv_traceset_remove(LttvTraceset *s, unsigned i)
{
+ LttvTrace * t;
+ g_assert(s->traces->len > i);
+ t = (LttvTrace *)s->traces->pdata[i];
+ t->ref_count--;
g_ptr_array_remove_index(s->traces, i);
}
g_ptr_array_remove_index(s->traces, i);
}
@@
-149,3
+165,7
@@
LttTrace *lttv_trace(LttvTrace *t)
return t->t;
}
return t->t;
}
+guint lttv_trace_get_ref_number(LttvTrace * t)
+{
+ return t->ref_count;
+}
This page took
0.02269 seconds
and
4
git commands to generate.