return 0;
}
-int marker_format_event(LttTrace *trace, GQuark channel, GQuark name,
- const char *format)
+static
+int marker_format_tf_event(LttTrace *trace, LttTracefile *tf,
+ GQuark channel, GQuark name, const char *format)
{
struct marker_info *info;
struct marker_data *mdata;
char *fquery;
char *fcopy;
- GArray *group;
-
- group = g_datalist_id_get_data(&trace->tracefiles, channel);
- if (!group)
- return -ENOENT;
- g_assert(group->len > 0);
- mdata = g_array_index (group, LttTracefile, 0).mdata;
+ mdata = tf->mdata;
fquery = marker_get_format_from_name(mdata, name);
if (fquery) {
if (strcmp(fquery, format) != 0)
return 0;
}
-int marker_id_event(LttTrace *trace, GQuark channel, GQuark name, guint16 id,
- uint8_t int_size, uint8_t long_size, uint8_t pointer_size,
- uint8_t size_t_size, uint8_t alignment)
+int marker_format_event(LttTrace *trace, GQuark channel, GQuark name,
+ const char *format)
{
- struct marker_data *mdata;
- struct marker_info *info, *head;
- int found = 0;
GArray *group;
-
- g_debug("Add channel %s event %s %hu\n", g_quark_to_string(channel),
- g_quark_to_string(name), id);
+ int i, ret;
+ LttTracefile *tf;
group = g_datalist_id_get_data(&trace->tracefiles, channel);
if (!group)
return -ENOENT;
g_assert(group->len > 0);
- mdata = g_array_index (group, LttTracefile, 0).mdata;
+ for (i = 0; i < group->len; i++) {
+ tf = &g_array_index (group, LttTracefile, i);
+ ret = marker_format_tf_event(trace, tf, channel, name, format);
+ if (ret)
+ g_error("Error in marker_format_event");
+ }
+ return 0;
+}
+
+int marker_id_tf_event(LttTrace *trace, LttTracefile *tf,
+ GQuark channel, GQuark name, guint16 id,
+ uint8_t int_size, uint8_t long_size, uint8_t pointer_size,
+ uint8_t size_t_size, uint8_t alignment)
+{
+ struct marker_data *mdata;
+ struct marker_info *info, *head;
+ int found = 0;
+
+ mdata = tf->mdata;
if (mdata->markers->len <= id)
mdata->markers = g_array_set_size(mdata->markers,
return 0;
}
+int marker_id_event(LttTrace *trace, GQuark channel, GQuark name, guint16 id,
+ uint8_t int_size, uint8_t long_size, uint8_t pointer_size,
+ uint8_t size_t_size, uint8_t alignment)
+{
+ GArray *group;
+ int i, ret;
+ LttTracefile *tf;
+
+ g_debug("Add channel %s event %s %hu\n", g_quark_to_string(channel),
+ g_quark_to_string(name), id);
+
+ group = g_datalist_id_get_data(&trace->tracefiles, channel);
+ if (!group)
+ return -ENOENT;
+ g_assert(group->len > 0);
+ for (i = 0; i < group->len; i++) {
+ tf = &g_array_index (group, LttTracefile, i);
+ ret = marker_id_tf_event(trace, tf, channel, name, id, int_size, long_size,
+ pointer_size, size_t_size, alignment);
+ if (ret)
+ g_error("Error in marker_id_event");
+ }
+ return 0;
+}
+
struct marker_data *allocate_marker_data(void)
{
struct marker_data *data;
unsigned int i;
LttTracefile *tf;
- if (group->len > 0)
- destroy_marker_data(g_array_index (group, LttTracefile, 0).mdata);
for(i=0; i<group->len; i++) {
tf = &g_array_index (group, LttTracefile, i);
- if(tf->cpu_online)
+ if(tf->cpu_online) {
+ destroy_marker_data(tf->mdata);
ltt_tracefile_close(tf);
+ }
}
g_array_free(group, TRUE);
}
DIR *dir = opendir(root_path);
struct dirent *entry;
struct stat stat_buf;
- int ret, i;
- struct marker_data *mdata;
+ int ret;
gchar path[PATH_MAX];
int path_len;
gchar rel_path[PATH_MAX];
gchar *rel_path_ptr;
LttTracefile tmp_tf;
+ struct marker_data **mdata;
if(dir == NULL) {
perror(root_path);
g_debug("Tracefile name is %s and number is %u",
g_quark_to_string(name), num);
- mdata = NULL;
tmp_tf.cpu_online = 1;
tmp_tf.cpu_num = num;
tmp_tf.name = name;
group = g_array_sized_new (FALSE, TRUE, sizeof(LttTracefile), 10);
g_datalist_id_set_data_full(&trace->tracefiles, name,
group, ltt_tracefile_group_destroy);
- mdata = allocate_marker_data();
- if (!mdata)
- g_error("Error in allocating marker data");
}
/* Add the per cpu tracefile to the named group */
if(num+1 > old_len)
group = g_array_set_size(group, num+1);
- g_assert(group->len > 0);
- if (!mdata)
- mdata = g_array_index (group, LttTracefile, 0).mdata;
-
g_array_index (group, LttTracefile, num) = tmp_tf;
g_array_index (group, LttTracefile, num).event.tracefile =
&g_array_index (group, LttTracefile, num);
- for (i = 0; i < group->len; i++)
- g_array_index (group, LttTracefile, i).mdata = mdata;
+ mdata = &g_array_index (group, LttTracefile, num).mdata;
+ *mdata = allocate_marker_data();
+ if (!*mdata)
+ g_error("Error in allocating marker data");
}
}