Update LTTV to trace format 2.3
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 13 Dec 2008 21:29:32 +0000 (21:29 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 13 Dec 2008 21:29:32 +0000 (21:29 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@3175 04897980-b3bd-0310-b5e0-8ef037075253

48 files changed:
trunk/lttv/configure.in
trunk/lttv/ltt/Makefile.am
trunk/lttv/ltt/event.c
trunk/lttv/ltt/event.h
trunk/lttv/ltt/ltt-private.h
trunk/lttv/ltt/ltt.h
trunk/lttv/ltt/marker.c
trunk/lttv/ltt/marker.h
trunk/lttv/ltt/trace.h
trunk/lttv/ltt/tracefile.c
trunk/lttv/lttv/lttv/Makefile.am
trunk/lttv/lttv/lttv/batchtest.c
trunk/lttv/lttv/lttv/filter.c
trunk/lttv/lttv/lttv/hook.c
trunk/lttv/lttv/lttv/hook.h
trunk/lttv/lttv/lttv/print.c
trunk/lttv/lttv/lttv/state.c
trunk/lttv/lttv/lttv/state.h
trunk/lttv/lttv/lttv/stats.c
trunk/lttv/lttv/lttv/tracecontext.c
trunk/lttv/lttv/lttv/tracecontext.h
trunk/lttv/lttv/modules/gui/Makefile.am
trunk/lttv/lttv/modules/gui/controlflow/Makefile.am
trunk/lttv/lttv/modules/gui/controlflow/drawing.c
trunk/lttv/lttv/modules/gui/detailedevents/Makefile.am
trunk/lttv/lttv/modules/gui/detailedevents/events.c
trunk/lttv/lttv/modules/gui/diskperformance/Makefile.am
trunk/lttv/lttv/modules/gui/diskperformance/diskperformance.c
trunk/lttv/lttv/modules/gui/filter/Makefile.am
trunk/lttv/lttv/modules/gui/histogram/Makefile.am
trunk/lttv/lttv/modules/gui/histogram/histoeventhooks.c
trunk/lttv/lttv/modules/gui/interrupts/Makefile.am
trunk/lttv/lttv/modules/gui/interrupts/interrupts.c
trunk/lttv/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
trunk/lttv/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
trunk/lttv/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c
trunk/lttv/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
trunk/lttv/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h
trunk/lttv/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c
trunk/lttv/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.h
trunk/lttv/lttv/modules/gui/resourceview/Makefile.am
trunk/lttv/lttv/modules/gui/resourceview/drawing.c
trunk/lttv/lttv/modules/gui/resourceview/eventhooks.c
trunk/lttv/lttv/modules/gui/resourceview/eventhooks.h
trunk/lttv/lttv/modules/gui/statistics/Makefile.am
trunk/lttv/lttv/modules/gui/tracecontrol/Makefile.am
trunk/lttv/lttv/modules/gui/tutorial/Makefile.am
trunk/lttv/lttv/modules/text/Makefile.am

index 4c6c363e9221139e399715be437475a5bd90a613..7a2166d6106d2dec7fa991b26e0551f2f63a6463 100644 (file)
@@ -23,7 +23,7 @@
 AC_PREREQ(2.57)
 AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
 #AC_WITH_LTDL  # not needed ?
-AM_INIT_AUTOMAKE(lttv,0.11.6-13112008)
+AM_INIT_AUTOMAKE(lttv,0.12.0-13122008)
 AM_CONFIG_HEADER(config.h)
 AM_PROG_LIBTOOL
 
@@ -46,8 +46,8 @@ AC_CHECK_LIB([util], [forkpty], UTIL_LIBS="-lutil", AC_MSG_ERROR([libutil is
 required in order to compile LinuxTraceToolkit]))
 
 
-# pthread for lttd
-#AC_CHECK_LIB(pthread, pthread_join,[THREAD_LIBS="-lpthread"], AC_MSG_ERROR([LinuxThreads is required in order to compile lttd]))
+# pthread for gdb with dlopen().
+AC_CHECK_LIB(pthread, pthread_join,[THREAD_LIBS="-lpthread"], AC_MSG_ERROR([LinuxThreads is required in order to make sure gdb works fine with lttv-gui]))
 
 # Checks for header files.
 AC_HEADER_STDC
index bb99f3317838b149b0ea54060ee722d913ec6e1d..8f17b098f61af1a6a96f44648a1e6db4a57367ab 100644 (file)
@@ -8,6 +8,7 @@
 
 AM_CFLAGS = $(GLIB_CFLAGS) 
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 
 lib_LTLIBRARIES = liblttvtraceread.la
 liblttvtraceread_la_SOURCES = tracefile.c marker.c event.c
index 42a623181b1f7d8c47071274dc520fd95ef90600..46b68af7e692528935c352f5538e942f69bd5c0a 100644 (file)
@@ -322,13 +322,15 @@ double ltt_event_get_double(LttEvent *e, struct marker_field *f)
 
 /*****************************************************************************
  * The string obtained is only valid until the next read from
- * the same tracefile.
+ * the same tracefile. We reference directly the buffers.
  ****************************************************************************/
-char *ltt_event_get_string(LttEvent *e, struct marker_field *f)
+gchar *ltt_event_get_string(LttEvent *e, struct marker_field *f)
 {
   g_assert(f->type == LTT_TYPE_STRING);
 
-  return (gchar*)g_strdup((gchar*)(e->data + f->offset));
+  //caused memory leaks
+  //return (gchar*)g_strdup((gchar*)(e->data + f->offset));
+  return (gchar*)(e->data + f->offset);
 }
 
 
index 31a49d36a7cbb56b922664c4e25f1c63b8045b10..0741e0edaa3b514fdf6371478d1b5bf50cb11f7d 100644 (file)
@@ -52,7 +52,7 @@ static inline guint16 ltt_event_id(struct LttEvent *event)
        return event->event_id;
 }
 
-static inline LttTime ltt_event_time(struct LttEvent *event)
+static inline LttTime ltt_event_time(const struct LttEvent *event)
 {
        return event->event_time;
 }
index ec3592dd8aaa0f73a31f265874ecb8945656141c..797c57ca183e1c8b403ccd2ccc08115255b26843 100644 (file)
@@ -66,7 +66,7 @@ typedef guint32 uint32_t;
 typedef guint64 uint64_t;
 
 /* Subbuffer header */
-struct ltt_subbuffer_header_2_2 {
+struct ltt_subbuffer_header_2_3 {
        uint64_t cycle_count_begin;     /* Cycle count at subbuffer start */
        uint64_t cycle_count_end;       /* Cycle count at subbuffer end */
        uint32_t magic_number;          /*
@@ -99,7 +99,7 @@ struct ltt_subbuffer_header_2_2 {
        char header_end[0];             /* End of header */
 };
 
-typedef struct ltt_subbuffer_header_2_2 ltt_subbuffer_header_t;
+typedef struct ltt_subbuffer_header_2_3 ltt_subbuffer_header_t;
 
 /*
  * Return header size without padding after the structure. Don't use packed
@@ -144,6 +144,7 @@ struct LttTracefile {
   guint pgid;                         //Usertrace pgid, else 0
   guint64 creation;                   //Usertrace creation, else 0
   LttTrace * trace;                  //trace containing the tracefile
+  struct marker_data *mdata;         // marker id/name/fields mapping
   int fd;                            //file descriptor 
   off_t file_size;                   //file size
   //unsigned block_size;               //block_size
index fd2155df5b4ca3875a92b6adaae8272183abd91b..620a34977cfb5b839ff2c9a6491614950d44d32b 100644 (file)
@@ -68,7 +68,7 @@
    contained information (byte offsets) may vary with the architecture
    associated to the trace. */
    
-#define PREALLOC_EVENTS        512
+#define PREALLOC_EVENTS        28
 
 typedef struct LttTrace LttTrace;
 
index 3737f0aa615f03d7f4cedc4183b853a3b4d47023..89f47be071de9a9c0b903c206fa2630b77883cc3 100644 (file)
@@ -421,46 +421,63 @@ int marker_parse_format(const char *format, struct marker_info *info)
   return 0;
 }
 
-int marker_format_event(LttTrace *trace, GQuark name, const char *format)
+int marker_format_event(LttTrace *trace, GQuark channel, GQuark name,
+  const char *format)
 {
   struct marker_info *info;
+  struct marker_data *mdata;
   char *fquery;
   char *fcopy;
-  
-  fquery = marker_get_format_from_name(trace, name);
+  GArray *group;
+
+  group = g_datalist_id_get_data(&trace->tracefiles, channel);
+  g_assert(group->len > 0);
+  mdata = g_array_index (group, LttTracefile, 0).mdata;
+
+  fquery = marker_get_format_from_name(mdata, name);
   if (fquery) {
     if (strcmp(fquery, format) != 0)
-      g_error("Marker format mismatch \"%s\" vs \"%s\" for marker %s. "
-            "Kernel issue.", fquery, format, g_quark_to_string(name));
+      g_error("Marker format mismatch \"%s\" vs \"%s\" for marker %s.%s. "
+            "Kernel issue.", fquery, format,
+            g_quark_to_string(channel), g_quark_to_string(name));
     else
       return 0;  /* Already exists. Nothing to do. */
   }
   fcopy = g_new(char, strlen(format)+1);
   strcpy(fcopy, format);
-  g_hash_table_insert(trace->markers_format_hash, (gpointer)(gulong)name,
+  g_hash_table_insert(mdata->markers_format_hash, (gpointer)(gulong)name,
     (gpointer)fcopy);
 
-  info = marker_get_info_from_name(trace, name);
+  info = marker_get_info_from_name(mdata, name);
   for (; info != NULL; info = info->next) {
     info->format = fcopy;
     if (marker_parse_format(format, info))
-      g_error("Error parsing marker format \"%s\" for marker \"%s\"", format,
-        g_quark_to_string(name));
+      g_error("Error parsing marker format \"%s\" for marker \"%.s.%s\"",
+        format, g_quark_to_string(channel), g_quark_to_string(name));
   }
   return 0;
 }
 
-int marker_id_event(LttTrace *trace, GQuark name, guint16 id,
+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)
 {
+  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);
+
+  group = g_datalist_id_get_data(&trace->tracefiles, channel);
+  g_assert(group->len > 0);
+  mdata = g_array_index (group, LttTracefile, 0).mdata;
 
-  if (trace->markers->len <= id)
-    trace->markers = g_array_set_size(trace->markers,
-      max(trace->markers->len * 2, id + 1));
-  info = &g_array_index(trace->markers, struct marker_info, id);
+  if (mdata->markers->len <= id)
+    mdata->markers = g_array_set_size(mdata->markers,
+      max(mdata->markers->len * 2, id + 1));
+  info = &g_array_index(mdata->markers, struct marker_info, id);
   info->name = name;
   info->int_size = int_size;
   info->long_size = long_size;
@@ -469,14 +486,14 @@ int marker_id_event(LttTrace *trace, GQuark name, guint16 id,
   info->alignment = alignment;
   info->fields = NULL;
   info->next = NULL;
-  info->format = marker_get_format_from_name(trace, name);
+  info->format = marker_get_format_from_name(mdata, name);
   info->largest_align = 1;
   if (info->format && marker_parse_format(info->format, info))
-      g_error("Error parsing marker format \"%s\" for marker \"%s\"",
-        info->format, g_quark_to_string(name));
-  head = marker_get_info_from_name(trace, name);
+      g_error("Error parsing marker format \"%s\" for marker \"%s.%s\"",
+        info->format, g_quark_to_string(channel), g_quark_to_string(name));
+  head = marker_get_info_from_name(mdata, name);
   if (!head)
-    g_hash_table_insert(trace->markers_hash, (gpointer)(gulong)name,
+    g_hash_table_insert(mdata->markers_hash, (gpointer)(gulong)name,
       (gpointer)(gulong)id);
   else {
     struct marker_info *iter;
@@ -484,7 +501,7 @@ int marker_id_event(LttTrace *trace, GQuark name, guint16 id,
       if (iter->name == name)
         found = 1;
     if (!found) {
-      g_hash_table_replace(trace->markers_hash, (gpointer)(gulong)name,
+      g_hash_table_replace(mdata->markers_hash, (gpointer)(gulong)name,
         (gpointer)(gulong)id);
       info->next = head;
     }
@@ -492,31 +509,43 @@ int marker_id_event(LttTrace *trace, GQuark name, guint16 id,
   return 0;
 }
 
-int allocate_marker_data(LttTrace *trace)
+struct marker_data *allocate_marker_data(void)
 {
+  struct marker_data *data;
+
+  data = g_new(struct marker_data, 1);
   /* Init array to 0 */
-  trace->markers = g_array_sized_new(FALSE, TRUE,
+  data->markers = g_array_sized_new(FALSE, TRUE,
                     sizeof(struct marker_info), DEFAULT_MARKERS_NUM);
-  if (!trace->markers)
-    return -ENOMEM;
-  trace->markers_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
-  if (!trace->markers_hash)
-    return -ENOMEM;
-  trace->markers_format_hash = g_hash_table_new_full(g_direct_hash,
+  if (!data->markers)
+    goto free_data;
+  data->markers_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
+  if (!data->markers_hash)
+    goto free_markers;
+  data->markers_format_hash = g_hash_table_new_full(g_direct_hash,
      g_direct_equal, NULL, g_free);
-  if (!trace->markers_hash)
-    return -ENOMEM;
-  return 0;
+  if (!data->markers_format_hash)
+    goto free_markers_hash;
+  return data;
+
+  /* error handling */
+free_markers_hash:
+  g_hash_table_destroy(data->markers_hash);
+free_markers:
+  g_array_free(data->markers, TRUE);
+free_data:
+  g_free(data);
+  return NULL;
 }
 
-void destroy_marker_data(LttTrace *trace)
+void destroy_marker_data(struct marker_data *data)
 {
   unsigned int i, j;
   struct marker_info *info;
   struct marker_field *field;
 
-  for (i=0; i<trace->markers->len; i++) {
-    info = &g_array_index(trace->markers, struct marker_info, i);
+  for (i=0; i<data->markers->len; i++) {
+    info = &g_array_index(data->markers, struct marker_info, i);
     if (info->fields) {
       for (j = 0; j < info->fields->len; j++) {
         field = &g_array_index(info->fields, struct marker_field, j);
@@ -525,7 +554,8 @@ void destroy_marker_data(LttTrace *trace)
       g_array_free(info->fields, TRUE);
     }
   }
-  g_array_free(trace->markers, TRUE);
-  g_hash_table_destroy(trace->markers_hash);
-  g_hash_table_destroy(trace->markers_format_hash);
+  g_hash_table_destroy(data->markers_format_hash);
+  g_hash_table_destroy(data->markers_hash);
+  g_array_free(data->markers, TRUE);
+  g_free(data);
 }
index 204448d555315018727d50862e1c6fb6dd6a3187..4d21e471d48dd4adf6b59e95884f877ddc922b56 100644 (file)
@@ -35,50 +35,56 @@ struct marker_info {
   struct marker_info *next; /* Linked list of markers with the same name */
 };
 
+struct marker_data {
+  GArray *markers;                     //indexed by marker id
+  GHashTable *markers_hash;            //indexed by name hash
+  GHashTable *markers_format_hash;     //indexed by name hash
+};
+
 enum marker_id {
   MARKER_ID_SET_MARKER_ID = 0,  /* Static IDs available (range 0-7) */
   MARKER_ID_SET_MARKER_FORMAT,
   MARKER_ID_DYNAMIC,    /* Dynamic IDs (range: 8-65535)   */
 };
 
-static inline guint16 marker_get_id_from_info(LttTrace *trace,
+static inline guint16 marker_get_id_from_info(struct marker_data *data,
     struct marker_info *info)
 {
-  return ((unsigned long)info - (unsigned long)trace->markers->data)
+  return ((unsigned long)info - (unsigned long)data->markers->data)
            / sizeof(struct marker_info);
 }
 
-static inline struct marker_info *marker_get_info_from_id(LttTrace *trace,
-    guint16 id)
+static inline struct marker_info *marker_get_info_from_id(
+    struct marker_data *data, guint16 id)
 {
-  if (unlikely(trace->markers->len <= id))
+  if (unlikely(data->markers->len <= id))
     return NULL;
-  return &g_array_index(trace->markers, struct marker_info, id);
+  return &g_array_index(data->markers, struct marker_info, id);
 }
 
 /*
  * Returns the head of the marker info list for that name.
  */
-static inline struct marker_info *marker_get_info_from_name(LttTrace *trace,
-    GQuark name)
+static inline struct marker_info *marker_get_info_from_name(
+    struct marker_data *data, GQuark name)
 {
   gpointer orig_key, value;
   int res;
 
-  res = g_hash_table_lookup_extended(trace->markers_hash,
+  res = g_hash_table_lookup_extended(data->markers_hash,
     (gconstpointer)(gulong)name, &orig_key, &value);
   if (!res)
     return NULL;
-  return marker_get_info_from_id(trace, (guint16)(gulong)value);
+  return marker_get_info_from_id(data, (guint16)(gulong)value);
 }
 
-static inline char *marker_get_format_from_name(LttTrace *trace,
+static inline char *marker_get_format_from_name(struct marker_data *data,
     GQuark name)
 {
   gpointer orig_key, value;
   int res;
 
-  res = g_hash_table_lookup_extended(trace->markers_format_hash,
+  res = g_hash_table_lookup_extended(data->markers_format_hash,
                (gconstpointer)(gulong)name, &orig_key, &value);
   if (!res)
     return NULL;
@@ -106,11 +112,12 @@ static inline unsigned int marker_get_num_fields(struct marker_info *info)
                field != marker_get_field(info, marker_get_num_fields(info)); \
                field++)
 
-int marker_format_event(LttTrace *trace, GQuark name, const char *format);
-int marker_id_event(LttTrace *trace, GQuark name, guint16 id,
+int marker_format_event(LttTrace *trace, GQuark channel, GQuark name,
+  const char *format);
+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 allocate_marker_data(LttTrace *trace);
-void destroy_marker_data(LttTrace *trace);
+struct marker_data *allocate_marker_data(void);
+void destroy_marker_data(struct marker_data *data);
 
 #endif //_LTT_MARKERS_H
index 2e031c22d622d4eb2b06639125267d13698bf017..202def1094d5853ba345c7271fe862e97aad9f2f 100644 (file)
@@ -45,10 +45,6 @@ struct LttTrace {
   LttTime   start_time_from_tsc;
 
   GData     *tracefiles;                    //tracefiles groups
-  /* Support for markers */
-  GArray    *markers;                       //indexed by marker ID
-  GHashTable *markers_hash;                 //indexed by name hash
-  GHashTable *markers_format_hash;                 //indexed by name hash
 };
 
 static inline guint ltt_trace_get_num_cpu(LttTrace *t)
index 58b2a48319789a3543240f9fe34d9d90f191ce0c..4485bf657a7280dedbd422d23a126e342081d975 100644 (file)
@@ -152,9 +152,9 @@ static int parse_trace_header(ltt_subbuffer_header_t *header,
     break;
   case 2:
     switch(header->minor_version) {
-    case 2:
+    case 3:
       {
-        struct ltt_subbuffer_header_2_2 *vheader = header;
+        struct ltt_subbuffer_header_2_3 *vheader = header;
         tf->buffer_header_size = ltt_subbuffer_header_size();
         tf->tscbits = 27;
         tf->eventbits = 5;
@@ -350,6 +350,7 @@ void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname)
 /* Search for something like : .*_.*
  *
  * The left side is the name, the right side is the number.
+ * Exclude leading /.
  */
 
 static int get_tracefile_name_number(gchar *raw_name,
@@ -367,6 +368,14 @@ static int get_tracefile_name_number(gchar *raw_name,
   gchar *endptr;
   gchar *tmpptr;
 
+  /* skip leading / */
+  for(i = 0; i < raw_name_len-1;i++) {
+    if(raw_name[i] != '/')
+      break;
+  }
+  raw_name = &raw_name[i];
+  raw_name_len = strlen(raw_name);
+
   for(i=raw_name_len-1;i>=0;i--) {
     if(raw_name[i] == '_') break;
   }
@@ -476,6 +485,8 @@ static void ltt_tracefile_group_destroy(gpointer data)
   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)
@@ -515,7 +526,8 @@ static int open_tracefiles(LttTrace *trace, gchar *root_path, gchar *relative_pa
   DIR *dir = opendir(root_path);
   struct dirent *entry;
   struct stat stat_buf;
-  int ret;
+  int ret, i;
+  struct marker_data *mdata;
   
   gchar path[PATH_MAX];
   int path_len;
@@ -586,7 +598,8 @@ static int open_tracefiles(LttTrace *trace, gchar *root_path, gchar *relative_pa
 
       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;
@@ -601,15 +614,25 @@ static int open_tracefiles(LttTrace *trace, gchar *root_path, gchar *relative_pa
         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 */
       unsigned int old_len = group->len;
       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;
     }
   }
   
@@ -648,19 +671,22 @@ static int ltt_process_metadata_tracefile(LttTracefile *tf)
       goto event_id_error;
     } else {
       char *pos;
-      const char *marker_name, *format;
+      const char *channel_name, *marker_name, *format;
       uint16_t id;
       guint8 int_size, long_size, pointer_size, size_t_size, alignment;
 
       switch((enum marker_id)tf->event.event_id) {
         case MARKER_ID_SET_MARKER_ID:
-          marker_name = pos = tf->event.data;
-          g_debug("Doing MARKER_ID_SET_MARKER_ID of marker %s", marker_name);
+          channel_name = pos = tf->event.data;
+         pos += strlen(channel_name) + 1;
+         marker_name = pos;
+          g_debug("Doing MARKER_ID_SET_MARKER_ID of marker %s.%s",
+           channel_name, marker_name);
           pos += strlen(marker_name) + 1;
           pos += ltt_align((size_t)pos, sizeof(guint16), tf->alignment);
           id = ltt_get_uint16(LTT_GET_BO(tf), pos);
-          g_debug("In MARKER_ID_SET_MARKER_ID of marker %s id %hu",
-               marker_name, id);
+          g_debug("In MARKER_ID_SET_MARKER_ID of marker %s.%s id %hu",
+               channel_name, marker_name, id);
           pos += sizeof(guint16);
           int_size = *(guint8*)pos;
           pos += sizeof(guint8);
@@ -672,18 +698,24 @@ static int ltt_process_metadata_tracefile(LttTracefile *tf)
           pos += sizeof(guint8);
           alignment = *(guint8*)pos;
           pos += sizeof(guint8);
-          marker_id_event(tf->trace, g_quark_from_string(marker_name),
+          marker_id_event(tf->trace,
+                          g_quark_from_string(channel_name),
+                          g_quark_from_string(marker_name),
                           id, int_size, long_size,
                           pointer_size, size_t_size, alignment);
           break;
         case MARKER_ID_SET_MARKER_FORMAT:
-          marker_name = pos = tf->event.data;
-          g_debug("Doing MARKER_ID_SET_MARKER_FORMAT of marker %s",
-                  marker_name);
+          channel_name = pos = tf->event.data;
+          pos += strlen(channel_name) + 1;
+          marker_name = pos;
+          g_debug("Doing MARKER_ID_SET_MARKER_FORMAT of marker %s.%s",
+                  channel_name, marker_name);
           pos += strlen(marker_name) + 1;
           format = pos;
           pos += strlen(format) + 1;
-          marker_format_event(tf->trace, g_quark_from_string(marker_name),
+          marker_format_event(tf->trace,
+                              g_quark_from_string(channel_name),
+                              g_quark_from_string(marker_name),
                               format);
           /* get information from dictionary TODO */
           break;
@@ -723,7 +755,6 @@ LttTrace *ltt_trace_open(const gchar *pathname)
   ltt_subbuffer_header_t *header;
   DIR *dir;
   struct dirent *entry;
-  guint control_found = 0;
   struct stat stat_buf;
   gchar path[PATH_MAX];
   
@@ -750,32 +781,25 @@ LttTrace *ltt_trace_open(const gchar *pathname)
       perror(path);
       continue;
     }
-    if(S_ISDIR(stat_buf.st_mode)) {
-      if(strcmp(entry->d_name, "control") == 0) {
-        control_found = 1;
-      }
-    }
   }
   closedir(dir);
   
-  if(!control_found) goto find_error;
-  
   /* Open all the tracefiles */
   if(open_tracefiles(t, abs_path, "")) {
     g_warning("Error opening tracefile %s", abs_path);
     goto find_error;
   }
   
-  /* Parse each trace control/metadata_N files : get runtime fac. info */
+  /* Parse each trace metadata_N files : get runtime fac. info */
   group = g_datalist_id_get_data(&t->tracefiles, LTT_TRACEFILE_NAME_METADATA);
   if(group == NULL) {
     g_error("Trace %s has no metadata tracefile", abs_path);
     g_assert(0);
-    goto metadata_error;
+    goto find_error;
   }
 
   /*
-   * Get the trace information for the control/metadata_0 tracefile.
+   * Get the trace information for the metadata_0 tracefile.
    * Getting a correct trace start_time and start_tsc is insured by the fact
    * that no subbuffers are supposed to be lost in the metadata channel.
    * Therefore, the first subbuffer contains the start_tsc timestamp in its
@@ -789,22 +813,23 @@ LttTrace *ltt_trace_open(const gchar *pathname)
 
   t->num_cpu = group->len;
   
-  ret = allocate_marker_data(t);
-  if (ret)
-    g_error("Error in allocating marker data");
+  //ret = allocate_marker_data(t);
+  //if (ret)
+  //  g_error("Error in allocating marker data");
 
   for(i=0; i<group->len; i++) {
     tf = &g_array_index (group, LttTracefile, i);
     if (tf->cpu_online)
       if(ltt_process_metadata_tracefile(tf))
-        goto metadata_error;
+        goto find_error;
+      //  goto metadata_error;
   }
 
   return t;
 
   /* Error handling */
-metadata_error:
-  destroy_marker_data(t);
+//metadata_error:
+//  destroy_marker_data(t);
 find_error:
   g_datalist_clear(&t->tracefiles);
 open_error:
@@ -1462,27 +1487,31 @@ void ltt_update_event_size(LttTracefile *tf)
   off_t size = 0;
   char *tscdata;
   struct marker_info *info;
-  switch((enum marker_id)tf->event.event_id) {
-    case MARKER_ID_SET_MARKER_ID:
-      size = strlen((char*)tf->event.data) + 1;
-      g_debug("marker %s id set", (char*)tf->event.data);
-      size += ltt_align(size, sizeof(guint16), tf->alignment);
-      size += sizeof(guint16);
-      size += sizeof(guint8);
-      size += sizeof(guint8);
-      size += sizeof(guint8);
-      size += sizeof(guint8);
-      size += sizeof(guint8);
-      break;
-    case MARKER_ID_SET_MARKER_FORMAT:
-      g_debug("marker %s format set", (char*)tf->event.data);
-      size = strlen((char*)tf->event.data) + 1;
-      size += strlen((char*)tf->event.data + size) + 1;
-      break;
+
+  if (tf->name == LTT_TRACEFILE_NAME_METADATA) {
+    switch((enum marker_id)tf->event.event_id) {
+      case MARKER_ID_SET_MARKER_ID:
+        size = strlen((char*)tf->event.data) + 1;
+        g_debug("marker %s id set", (char*)tf->event.data + size);
+        size += strlen((char*)tf->event.data + size) + 1;
+        size += ltt_align(size, sizeof(guint16), tf->alignment);
+        size += sizeof(guint16);
+        size += sizeof(guint8);
+        size += sizeof(guint8);
+        size += sizeof(guint8);
+        size += sizeof(guint8);
+        size += sizeof(guint8);
+        break;
+      case MARKER_ID_SET_MARKER_FORMAT:
+        size = strlen((char*)tf->event.data) + 1;
+        g_debug("marker %s format set", (char*)tf->event.data);
+        size += strlen((char*)tf->event.data + size) + 1;
+        size += strlen((char*)tf->event.data + size) + 1;
+        break;
+    }
   }
 
-  info = marker_get_info_from_id(tf->trace, tf->event.event_id);
+  info = marker_get_info_from_id(tf->mdata, tf->event.event_id);
 
   if (tf->event.event_id >= MARKER_CORE_IDS)
     g_assert(info != NULL);
@@ -1499,7 +1528,7 @@ void ltt_update_event_size(LttTracefile *tf)
     if (info->size != -1)
       size = info->size;
     else
-      size = marker_update_fields_offsets(marker_get_info_from_id(tf->trace,
+      size = marker_update_fields_offsets(marker_get_info_from_id(tf->mdata,
                                    tf->event.event_id), tf->event.data);
   }
 
@@ -1514,19 +1543,12 @@ void ltt_update_event_size(LttTracefile *tf)
   if (a_event_debug)
     print_debug_event_data(&tf->event);
 
-  /* Having a marker load or marker format event out of the metadata
-   * tracefiles is a serious bug. */
-  switch((enum marker_id)tf->event.event_id) {
-    case MARKER_ID_SET_MARKER_ID:
-    case MARKER_ID_SET_MARKER_FORMAT:
-      if (tf->name != g_quark_from_string("/control/metadata"))
-        g_error("Trace inconsistency : metadata event found in data "
-                "tracefile %s", g_quark_to_string(tf->long_name));
-  }
-
   if (tf->event.data_size != tf->event.event_size) {
-    struct marker_info *info = marker_get_info_from_id(tf->trace,
+    struct marker_info *info = marker_get_info_from_id(tf->mdata,
                                                        tf->event.event_id);
+    if (!info)
+      g_error("Undescribed event %hhu in channel %s", tf->event.event_id,
+        g_quark_to_string(tf->name));
     g_error("Kernel/LTTV event size differs for event %s: kernel %u, LTTV %u",
         g_quark_to_string(info->name),
         tf->event.event_size, tf->event.data_size);
@@ -2532,5 +2554,5 @@ static void ltt_tracefile_copy(LttTracefile *dest, const LttTracefile *src)
 
 static __attribute__((constructor)) void init(void)
 {
-  LTT_TRACEFILE_NAME_METADATA = g_quark_from_string("/control/metadata");
+  LTT_TRACEFILE_NAME_METADATA = g_quark_from_string("metadata");
 }
index f96f418f4c3b0c34e3d611764ea6caac7cea5560..170f4d5bd3d48d35c52538da70cf0435bb7bd1f9 100644 (file)
@@ -1,4 +1,5 @@
 AM_CFLAGS = $(GLIB_CFLAGS) 
+LIBS += $(THREAD_LIBS)
 LIBS += $(POPT_LIBS) $(GLIB_LIBS) -lgobject-2.0 -L${top_builddir}/ltt\
           -llttvtraceread
 
index bc68f3730307d6480c976d6b6848dbee87128dee..2f5fce8391366600c7884addf640b461dd95895e 100644 (file)
@@ -171,7 +171,7 @@ gboolean trace_event(void __UNUSED__ *hook_data, void *call_data)
   ltt_event_position(e, a_event_position);
   ltt_event_position_get(a_event_position, &tf, &nb_block, &offset, &tsc);
   fprintf(stderr,"Event %s %lu.%09lu [%u 0x%x tsc %llu]\n",
-      g_quark_to_string(marker_get_info_from_id(ltt_tracefile_get_trace(tf),
+      g_quark_to_string(marker_get_info_from_id(tf->mdata,
                        ltt_event_id(e))->name),
       tfs->parent.timestamp.tv_sec, tfs->parent.timestamp.tv_nsec,
       nb_block, offset, tsc);
@@ -228,10 +228,8 @@ gboolean save_state_copy_event(void *hook_data, void *call_data)
 
   FILE *fp;
 
-  LttTrace *trace = ((LttvTracefileContext *)tfs)->t_context->t;
-
   if(ts->nb_event == 0 && 
-      marker_get_info_from_id(trace, e->event_id)->name
+      marker_get_info_from_id(tfs->parent.tf->mdata, e->event_id)->name
                             == QUARK_BLOCK_START) {
     if(a_save_sample != NULL) {
       filename = g_string_new("");
@@ -330,7 +328,7 @@ static void compute_tracefile(LttTracefile *tracefile, void *hook_data)
   do {
     LttTracefile *tf_pos;
     //event_type = ltt_event_eventtype(event);
-    minfo = marker_get_info_from_id(ltt_tracefile_get_trace(tracefile),
+    minfo = marker_get_info_from_id(tracefile->mdata,
                                        ltt_event_id(event));
     time = ltt_event_time(event);
     ltt_event_position(event, a_event_position);
index 8ed060225ca9593689e665cd118d855203eb975b..3c53e38791c7fd081a407015fc2503d1575883ae 100644 (file)
@@ -2047,7 +2047,8 @@ lttv_filter_tree_parse_branch(
             if(event == NULL) return TRUE;
             else {
               struct marker_info *info;
-              info = marker_get_info_from_id((LttTrace *)trace, event->event_id);
+             LttTracefile *tf = context->tf;
+              info = marker_get_info_from_id(tf->mdata, event->event_id);
               g_assert(info != NULL);
               GQuark quark = info->name;
               return se->op((gpointer)&quark,v);
index 6578aebae5685d76d7cf5fbc90eef8efc2c08b7a..d6e3014294342a4399105c45f4e0dc38f294baa9 100644 (file)
@@ -410,7 +410,7 @@ LttvHooksById *lttv_hooks_by_id_new()
 {
   LttvHooksById *h = g_new(LttvHooksById, 1);
   h->index = g_ptr_array_sized_new(PREALLOC_EVENTS);
-  h->array = g_array_sized_new(FALSE, FALSE, sizeof(guint), 50);
+  h->array = g_array_sized_new(FALSE, FALSE, sizeof(guint), PREALLOC_EVENTS);
   return h;
 }
 
@@ -458,3 +458,66 @@ void lttv_hooks_by_id_remove(LttvHooksById *h, unsigned id)
   }
 }
 
+void lttv_hooks_by_id_copy(LttvHooksById *dest, LttvHooksById *src)
+{
+  guint i;
+
+  for(i = 0 ; i < src->array->len ; i++) {
+    guint index = g_array_index(src->array, guint, i);
+    LttvHooks *srch = lttv_hooks_by_id_find(src, index);
+    LttvHooks *desth = lttv_hooks_by_id_find(dest, index);
+    lttv_hooks_add_list(desth, srch);
+  }
+}
+
+LttvHooksByIdChannelArray *lttv_hooks_by_id_channel_new(void)
+{
+  LttvHooksByIdChannelArray *h = g_new(LttvHooksByIdChannelArray, 1);
+
+  h->array = g_array_new(FALSE, FALSE, sizeof(LttvHooksByIdChannel));
+  return h;
+}
+
+void lttv_hooks_by_id_channel_destroy(LttvHooksByIdChannelArray *h)
+{
+  LttvHooksByIdChannel *hid;
+  int i;
+
+  for (i = 0; i < h->array->len; i++) {
+    hid = &g_array_index(h->array, LttvHooksByIdChannel, i);
+    lttv_hooks_by_id_destroy(hid->hooks_by_id);
+  }
+  g_array_free(h->array, TRUE);
+  g_free(h);
+}
+
+static LttvHooksByIdChannel *lttv_hooks_by_id_channel_find_channel(
+    LttvHooksByIdChannelArray *h,
+    GQuark channel)
+{
+  LttvHooksByIdChannel *hid;
+  int i, found = 0;
+
+  for (i = 0; i < h->array->len; i++) {
+    hid = &g_array_index(h->array, LttvHooksByIdChannel, i);
+    if (hid->channel == channel)
+      found = 1;
+      break;
+  }
+  if (!found) {
+    g_array_set_size(h->array, h->array->len + 1);
+    hid = &g_array_index(h->array, LttvHooksByIdChannel, h->array->len - 1);
+    hid->channel = channel;
+    hid->hooks_by_id = lttv_hooks_by_id_new();
+  }
+  return hid;
+}
+
+/* get, or create if not found */
+LttvHooks *lttv_hooks_by_id_channel_find(LttvHooksByIdChannelArray *h,
+    GQuark channel, guint16 id)
+{
+  LttvHooksByIdChannel *hid;
+  hid = lttv_hooks_by_id_channel_find_channel(h, channel);
+  return lttv_hooks_by_id_find(hid->hooks_by_id, id);
+}
index 325d218671c7a98f080a5a3df12d8b56ff2cc846..91f0c13f9a02d6b0d35d304781dbf87dba9685f8 100644 (file)
@@ -130,7 +130,7 @@ typedef struct _LttvHooksById {
 
 /* Create and destroy a hooks by id list */
 
-LttvHooksById *lttv_hooks_by_id_new();
+LttvHooksById *lttv_hooks_by_id_new(void);
 
 void lttv_hooks_by_id_destroy(LttvHooksById *h);
 
@@ -156,9 +156,32 @@ static inline LttvHooks *lttv_hooks_by_id_get(LttvHooksById *h, unsigned id)
   return ret;
 }
 
-
 /* Remove the list of hooks associated with an id */
 
 void lttv_hooks_by_id_remove(LttvHooksById *h, unsigned id);
 
+void lttv_hooks_by_id_copy(LttvHooksById *dest, LttvHooksById *src);
+
+/*
+ * Hooks per channel per id. Useful for GUI to save/restore hooks
+ * on a per trace basis (rather than per tracefile).
+ */
+
+/* Internal structure, contained in by the LttvHooksByIdChannelArray */
+typedef struct _LttvHooksByIdChannel {
+  LttvHooksById *hooks_by_id;
+  GQuark channel;
+} LttvHooksByIdChannel;
+
+typedef struct _LttvHooksByIdChannelArray {
+  GArray *array;       /* Array of LttvHooksByIdChannel */
+} LttvHooksByIdChannelArray;
+
+LttvHooksByIdChannelArray *lttv_hooks_by_id_channel_new(void);
+
+void lttv_hooks_by_id_channel_destroy(LttvHooksByIdChannelArray *h);
+
+LttvHooks *lttv_hooks_by_id_channel_find(LttvHooksByIdChannelArray *h,
+    GQuark channel, guint16 id);
+
 #endif // HOOK_H
index 4afab112b444154c2c650e5ec61e132e08b3e85c..8bba69719df48a48d69ce92114c2f8d7c0750926 100644 (file)
@@ -46,8 +46,8 @@
 static inline void print_enum_events(LttEvent *e, struct marker_field *f,
                       guint64 value, GString *s, LttvTracefileState *tfs)
 {
-  LttTrace *trace = ltt_tracefile_get_trace(e->tracefile);
-  struct marker_info *info = marker_get_info_from_id(trace, e->event_id);
+  struct marker_info *info = marker_get_info_from_id(tfs->parent.tf->mdata,
+    e->event_id);
   LttvTraceState *ts = (LttvTraceState*)(tfs->parent.t_context);
   
   //TODO optimize with old quarks.
@@ -256,11 +256,10 @@ void lttv_event_to_string(LttEvent *e, GString *s,
   guint cpu = tfs->cpu;
   LttvTraceState *ts = (LttvTraceState*)tfs->parent.t_context;
   LttvProcessState *process = ts->running_process[cpu];
-  LttTrace *trace = ts->parent.t;
 
   s = g_string_set_size(s,0);
 
-  info = marker_get_info_from_id(trace, e->event_id);
+  info = marker_get_info_from_id(tfs->parent.tf->mdata, e->event_id);
 
   if(mandatory_fields) {
     time = ltt_event_time(e);
index d16e13e2efb8847194574148a6e1c48c8e674062..1a3d907db0adfb81f6447485c5d1ae1f31afc4eb 100644 (file)
 
 #define PREALLOCATED_EXECUTION_STACK 10
 
-/* Facilities Quarks */
+/* Channel Quarks */
 
 GQuark
-    LTT_FACILITY_KERNEL,
-    LTT_FACILITY_LIST,
-    LTT_FACILITY_FS,
-    LTT_FACILITY_USER_GENERIC,
-    LTT_FACILITY_BLOCK,
-    LTT_FACILITY_STATEDUMP;
+    LTT_CHANNEL_FD_STATE,
+    LTT_CHANNEL_GLOBAL_STATE,
+    LTT_CHANNEL_IRQ_STATE,
+    LTT_CHANNEL_MODULE_STATE,
+    LTT_CHANNEL_NETIF_STATE,
+    LTT_CHANNEL_SOFTIRQ_STATE,
+    LTT_CHANNEL_SWAP_STATE,
+    LTT_CHANNEL_SYSCALL_STATE,
+    LTT_CHANNEL_TASK_STATE,
+    LTT_CHANNEL_VM_STATE,
+    LTT_CHANNEL_FS,
+    LTT_CHANNEL_KERNEL,
+    LTT_CHANNEL_MM,
+    LTT_CHANNEL_USERSPACE,
+    LTT_CHANNEL_BLOCK;
 
 /* Events Quarks */
 
@@ -1875,7 +1884,7 @@ create_name_tables(LttvTraceState *tcs)
   hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 1);
 
   if(!lttv_trace_find_hook(tcs->parent.t,
-      LTT_FACILITY_KERNEL,
+      LTT_CHANNEL_KERNEL,
       LTT_EVENT_SYSCALL_ENTRY,
       FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
       NULL, NULL, &hooks)) {
@@ -1911,7 +1920,7 @@ create_name_tables(LttvTraceState *tcs)
   lttv_trace_hook_remove_all(&hooks);
 
   if(!lttv_trace_find_hook(tcs->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_ENTRY,
         FIELD_ARRAY(LTT_FIELD_TRAP_ID),
         NULL, NULL, &hooks)) {
@@ -1940,7 +1949,7 @@ create_name_tables(LttvTraceState *tcs)
   lttv_trace_hook_remove_all(&hooks);
 
   if(!lttv_trace_find_hook(tcs->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_IRQ_ID),
         NULL, NULL, &hooks)) {
@@ -3387,106 +3396,106 @@ void lttv_state_add_event_hooks(LttvTracesetState *self)
     //hn = 0;
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
        syscall_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_EXIT,
         NULL,
         syscall_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_ENTRY,
         FIELD_ARRAY(LTT_FIELD_TRAP_ID),
         trap_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_EXIT,
         NULL,
         trap_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_IRQ_ID),
         irq_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_EXIT,
         NULL,
         irq_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_RAISE,
         FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
         soft_irq_raise, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
         soft_irq_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_EXIT,
         NULL,
         soft_irq_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SCHED_SCHEDULE,
         FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID,
          LTT_FIELD_PREV_STATE),
         schedchange, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_FORK,
         FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID,
          LTT_FIELD_CHILD_TGID),
         process_fork, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_KTHREAD_CREATE,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_kernel_thread, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_EXIT,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_exit, NULL, &hooks);
     
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_FREE,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_free, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_FS,
+        LTT_CHANNEL_FS,
         LTT_EVENT_EXEC,
         FIELD_ARRAY(LTT_FIELD_FILENAME),
         process_exec, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_THREAD_BRAND,
         FIELD_ARRAY(LTT_FIELD_NAME),
         thread_brand, NULL, &hooks);
 
      /* statedump-related hooks */
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_TASK_STATE,
         LTT_EVENT_PROCESS_STATE,
         FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
          LTT_FIELD_TYPE, LTT_FIELD_MODE, LTT_FIELD_SUBMODE,
@@ -3494,49 +3503,49 @@ void lttv_state_add_event_hooks(LttvTracesetState *self)
         enum_process_state, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_GLOBAL_STATE,
         LTT_EVENT_STATEDUMP_END,
         NULL,
         statedump_end, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_IRQ_STATE,
         LTT_EVENT_LIST_INTERRUPT,
         FIELD_ARRAY(LTT_FIELD_ACTION, LTT_FIELD_IRQ_ID),
         enum_interrupt, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_BLOCK,
+        LTT_CHANNEL_BLOCK,
         LTT_EVENT_REQUEST_ISSUE,
         FIELD_ARRAY(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION),
         bdev_request_issue, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_BLOCK,
+        LTT_CHANNEL_BLOCK,
         LTT_EVENT_REQUEST_COMPLETE,
         FIELD_ARRAY(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION),
         bdev_request_complete, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_ENTRY,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         function_entry, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_EXIT,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         function_exit, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_STATEDUMP,
+        LTT_CHANNEL_SYSCALL_STATE,
         LTT_EVENT_SYS_CALL_TABLE,
         FIELD_ARRAY(LTT_FIELD_ID, LTT_FIELD_ADDRESS, LTT_FIELD_SYMBOL),
         dump_syscall, NULL, &hooks);
 
     lttv_trace_find_hook(ts->parent.t,
-        LTT_FACILITY_STATEDUMP,
+        LTT_CHANNEL_SOFTIRQ_STATE,
         LTT_EVENT_SOFTIRQ_VEC,
         FIELD_ARRAY(LTT_FIELD_ID, LTT_FIELD_ADDRESS, LTT_FIELD_SYMBOL),
         dump_softirq, NULL, &hooks);
@@ -3552,11 +3561,12 @@ void lttv_state_add_event_hooks(LttvTracesetState *self)
 
       for(k = 0 ; k < hooks->len ; k++) {
         th = &g_array_index(hooks, LttvTraceHook, k);
-          lttv_hooks_add(
-            lttv_hooks_by_id_find(tfs->parent.event_by_id, th->id),
-            th->h,
-            th,
-            LTTV_PRIO_STATE);
+         if (th->mdata == tfs->parent.tf->mdata)
+            lttv_hooks_add(
+              lttv_hooks_by_id_find(tfs->parent.event_by_id, th->id),
+              th->h,
+              th,
+              LTTV_PRIO_STATE);
       }
     }
     lttv_attribute_find(ts->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val);
@@ -3607,6 +3617,7 @@ void lttv_state_remove_event_hooks(LttvTracesetState *self)
 
       for(k = 0 ; k < hooks->len ; k++) {
         th = &g_array_index(hooks, LttvTraceHook, k);
+       if (th->mdata == tfs->parent.tf->mdata)
           lttv_hooks_remove_data(
             lttv_hooks_by_id_find(tfs->parent.event_by_id, th->id),
                     th->h,
@@ -4197,14 +4208,22 @@ static void module_init()
   LTTV_STATE_RESOURCE_TRAPS = g_quark_from_string("trap resource states");
   LTTV_STATE_RESOURCE_BLKDEVS = g_quark_from_string("blkdevs resource states");
 
-  
-  LTT_FACILITY_KERNEL     = g_quark_from_string("kernel");
-  LTT_FACILITY_FS    = g_quark_from_string("fs");
-  LTT_FACILITY_LIST = g_quark_from_string("list");
-  LTT_FACILITY_USER_GENERIC    = g_quark_from_string("user_generic");
-  LTT_FACILITY_BLOCK = g_quark_from_string("block");
-  LTT_FACILITY_STATEDUMP = g_quark_from_string("statedump");
+  LTT_CHANNEL_FD_STATE     = g_quark_from_string("fd_state");
+  LTT_CHANNEL_GLOBAL_STATE     = g_quark_from_string("global_state");
+  LTT_CHANNEL_IRQ_STATE     = g_quark_from_string("irq_state");
+  LTT_CHANNEL_MODULE_STATE     = g_quark_from_string("module_state");
+  LTT_CHANNEL_NETIF_STATE     = g_quark_from_string("netif_state");
+  LTT_CHANNEL_SOFTIRQ_STATE     = g_quark_from_string("softirq_state");
+  LTT_CHANNEL_SWAP_STATE     = g_quark_from_string("swap_state");
+  LTT_CHANNEL_SYSCALL_STATE     = g_quark_from_string("syscall_state");
+  LTT_CHANNEL_TASK_STATE     = g_quark_from_string("task_state");
+  LTT_CHANNEL_VM_STATE     = g_quark_from_string("vm_state");
+  LTT_CHANNEL_FS     = g_quark_from_string("fs");
+  LTT_CHANNEL_KERNEL     = g_quark_from_string("kernel");
+  LTT_CHANNEL_MM     = g_quark_from_string("mm");
+  LTT_CHANNEL_USERSPACE     = g_quark_from_string("userspace");
+  LTT_CHANNEL_BLOCK     = g_quark_from_string("block");
+
   LTT_EVENT_SYSCALL_ENTRY = g_quark_from_string("syscall_entry");
   LTT_EVENT_SYSCALL_EXIT  = g_quark_from_string("syscall_exit");
   LTT_EVENT_TRAP_ENTRY    = g_quark_from_string("trap_entry");
index 6e8164b6f882634c416f6af0462c978d398590d4..b24badbb52966406f5ed92278ebf755bbd267966 100644 (file)
 
 #define LTTV_STATE_SAVE_INTERVAL 50000
 
-/* Facilities Quarks */
+/* Channel Quarks */
 
 extern GQuark
-    LTT_FACILITY_KERNEL,
-    LTT_FACILITY_FS,
-    LTT_FACILITY_LIST,
-    LTT_FACILITY_USER_GENERIC,
-    LTT_FACILITY_BLOCK,
-    LTT_FACILITY_STATEDUMP;
+    LTT_CHANNEL_FD_STATE,
+    LTT_CHANNEL_GLOBAL_STATE,
+    LTT_CHANNEL_IRQ_STATE,
+    LTT_CHANNEL_MODULE_STATE,
+    LTT_CHANNEL_NETIF_STATE,
+    LTT_CHANNEL_SOFTIRQ_STATE,
+    LTT_CHANNEL_SWAP_STATE,
+    LTT_CHANNEL_SYSCALL_STATE,
+    LTT_CHANNEL_TASK_STATE,
+    LTT_CHANNEL_VM_STATE,
+    LTT_CHANNEL_FS,
+    LTT_CHANNEL_KERNEL,
+    LTT_CHANNEL_MM,
+    LTT_CHANNEL_USERSPACE,
+    LTT_CHANNEL_BLOCK;
 
 /* Events Quarks */
 
index cb09fd0d8a73ec86fde9de43ad90614b027cd085..6aef4403c61584d7ed869d70c6455cb917c695c8 100644 (file)
@@ -781,8 +781,6 @@ static gboolean every_event(void *hook_data, void *call_data)
 
   LttvAttributeValue v;
 
-  LttTrace *trace = ((LttvTracefileContext *)tfcs)->t_context->t;
-
   struct marker_info *info;
 
   /* The current branch corresponds to the tracefile/process/interrupt state.
@@ -790,7 +788,7 @@ static gboolean every_event(void *hook_data, void *call_data)
      type occuring in this context. A quark has been pre-allocated for each
      event type and is used as name. */
 
-  info = marker_get_info_from_id(trace, e->event_id);
+  info = marker_get_info_from_id(tfcs->parent.parent.tf->mdata, e->event_id);
 
   lttv_attribute_find(tfcs->current_event_types_tree, 
       info->name, LTTV_UINT, &v);
@@ -1068,77 +1066,77 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
     hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 12);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
         before_syscall_entry, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_EXIT,
         NULL,
         before_syscall_exit, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_ENTRY,
         FIELD_ARRAY(LTT_FIELD_TRAP_ID),
         before_trap_entry, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_EXIT,
         NULL,
         before_trap_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_IRQ_ID),
         before_irq_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_EXIT,
         NULL,
         before_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
         before_soft_irq_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_EXIT,
         NULL,
         before_soft_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SCHED_SCHEDULE,
         FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
         before_schedchange, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_ENTRY,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         before_function_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_EXIT,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         before_function_exit, NULL,
@@ -1146,7 +1144,7 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 
     /* statedump-related hooks */
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_TASK_STATE,
         LTT_EVENT_PROCESS_STATE,
         FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
         before_enum_process_state, NULL,
@@ -1157,98 +1155,98 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
     hooks = g_array_sized_new(FALSE, FALSE, sizeof(LttvTraceHook), 16);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_ENTRY,
         FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
         after_syscall_entry, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SYSCALL_EXIT,
         NULL,
         after_syscall_exit, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_ENTRY, 
         FIELD_ARRAY(LTT_FIELD_TRAP_ID),
         after_trap_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_TRAP_EXIT,
         NULL,
         after_trap_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_ENTRY, 
         FIELD_ARRAY(LTT_FIELD_IRQ_ID),
         after_irq_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_IRQ_EXIT,
         NULL,
         after_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_ENTRY, 
         FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
         after_soft_irq_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SOFT_IRQ_EXIT,
         NULL,
         after_soft_irq_exit, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_SCHED_SCHEDULE,
         FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
         after_schedchange, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_FORK, 
         FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID),
         process_fork, NULL, 
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_EXIT,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_exit, NULL,
         &hooks);
     
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_KERNEL,
+        LTT_CHANNEL_KERNEL,
         LTT_EVENT_PROCESS_FREE,
         FIELD_ARRAY(LTT_FIELD_PID),
         process_free, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_ENTRY,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         after_function_entry, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_USER_GENERIC,
+        LTT_CHANNEL_USERSPACE,
         LTT_EVENT_FUNCTION_EXIT,
         FIELD_ARRAY(LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE),
         after_function_exit, NULL,
@@ -1256,14 +1254,14 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 
     /* statedump-related hooks */
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_TASK_STATE,
         LTT_EVENT_PROCESS_STATE,
         FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
         after_enum_process_state, NULL,
         &hooks);
 
     lttv_trace_find_hook(ts->parent.parent.t,
-        LTT_FACILITY_LIST,
+        LTT_CHANNEL_GLOBAL_STATE,
         LTT_EVENT_STATEDUMP_END,
         NULL,
         after_statedump_end, NULL,
@@ -1283,19 +1281,21 @@ void lttv_stats_add_event_hooks(LttvTracesetStats *self)
 
       for(k = 0 ; k < before_hooks->len ; k++) {
         th = &g_array_index(before_hooks, LttvTraceHook, k);
-        lttv_hooks_add(
-            lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
-            th->h,
-            th,
-            LTTV_PRIO_STATS_BEFORE_STATE);
+        if (th->mdata == tfs->parent.parent.tf->mdata)
+          lttv_hooks_add(
+              lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+              th->h,
+              th,
+              LTTV_PRIO_STATS_BEFORE_STATE);
       }
       for(k = 0 ; k < after_hooks->len ; k++) {
         th = &g_array_index(after_hooks, LttvTraceHook, k);
-        lttv_hooks_add(
-            lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
-            th->h,
-            th,
-            LTTV_PRIO_STATS_AFTER_STATE);
+        if (th->mdata == tfs->parent.parent.tf->mdata)
+          lttv_hooks_add(
+              lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+              th->h,
+              th,
+              LTTV_PRIO_STATS_AFTER_STATE);
       }
     }
     lttv_attribute_find(self->parent.parent.a, LTTV_STATS_BEFORE_HOOKS, 
@@ -1355,17 +1355,19 @@ void lttv_stats_remove_event_hooks(LttvTracesetStats *self)
 
       for(k = 0 ; k < before_hooks->len ; k++) {
         th = &g_array_index(before_hooks, LttvTraceHook, k);
-        lttv_hooks_remove_data(
-            lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
-            th->h,
-            th);
+        if (th->mdata == tfs->parent.parent.tf->mdata)
+          lttv_hooks_remove_data(
+              lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+              th->h,
+              th);
       }
       for(k = 0 ; k < after_hooks->len ; k++) {
         th = &g_array_index(after_hooks, LttvTraceHook, k);
-        lttv_hooks_remove_data(
-            lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
-            th->h,
-            th);
+        if (th->mdata == tfs->parent.parent.tf->mdata)
+          lttv_hooks_remove_data(
+              lttv_hooks_by_id_find(tfs->parent.parent.event_by_id, th->id),
+              th->h,
+              th);
         
       }
     }
index f5b78b5cbfdd8d640fe6b91576b68d415c840010..dbac9928dcacbbe5097a49010cc4f7d59a9d9e2a 100644 (file)
@@ -28,9 +28,6 @@
 #include <lttv/filter.h>
 #include <errno.h>
 
-#define min(a,b) (((a)<(b))?(a):(b))
-
-
 gint compare_tracefile(gconstpointer a, gconstpointer b)
 {
   gint comparison = 0;
@@ -291,7 +288,7 @@ void lttv_traceset_context_add_hooks(LttvTracesetContext *self,
     LttvHooks *before_trace, 
     LttvHooks *before_tracefile,
     LttvHooks *event,
-    LttvHooksById *event_by_id)
+    LttvHooksByIdChannelArray *event_by_id_channel)
 {
   LttvTraceset *ts = self->ts;
 
@@ -309,7 +306,7 @@ void lttv_traceset_context_add_hooks(LttvTracesetContext *self,
                                  before_trace,
                                  before_tracefile,
                                  event,
-                                 event_by_id);
+                                 event_by_id_channel);
   }
 }
 
@@ -319,7 +316,7 @@ void lttv_traceset_context_remove_hooks(LttvTracesetContext *self,
     LttvHooks *after_trace, 
     LttvHooks *after_tracefile,
     LttvHooks *event, 
-    LttvHooksById *event_by_id)
+    LttvHooksByIdChannelArray *event_by_id_channel)
 {
 
   LttvTraceset *ts = self->ts;
@@ -336,7 +333,7 @@ void lttv_traceset_context_remove_hooks(LttvTracesetContext *self,
                                     after_trace,
                                     after_tracefile,
                                     event,
-                                    event_by_id);
+                                    event_by_id_channel);
   }
 
   lttv_hooks_call(after_traceset, self);
@@ -348,11 +345,11 @@ void lttv_trace_context_add_hooks(LttvTraceContext *self,
     LttvHooks *before_trace, 
     LttvHooks *before_tracefile,
     LttvHooks *event, 
-    LttvHooksById *event_by_id)
+    LttvHooksByIdChannelArray *event_by_id_channel)
 {
-  guint i, nb_tracefile;
-
+  guint i, j, nb_tracefile;
   LttvTracefileContext **tfc;
+  LttTracefile *tf;
 
   lttv_hooks_call(before_trace, self);
 
@@ -360,10 +357,22 @@ void lttv_trace_context_add_hooks(LttvTraceContext *self,
 
   for(i = 0 ; i < nb_tracefile ; i++) {
     tfc = &g_array_index(self->tracefiles, LttvTracefileContext*, i);
+    tf = (*tfc)->tf;
     lttv_tracefile_context_add_hooks(*tfc,
                                      before_tracefile,
                                      event,
-                                     event_by_id);
+                                     NULL);
+    if (event_by_id_channel) {
+      for(j = 0; j < event_by_id_channel->array->len; j++) {
+        LttvHooksByIdChannel *hooks = &g_array_index(event_by_id_channel->array,
+                                                    LttvHooksByIdChannel, j);
+        if (tf->name == hooks->channel)
+          lttv_tracefile_context_add_hooks(*tfc,
+                                       NULL,
+                                       NULL,
+                                       hooks->hooks_by_id);
+      }
+    }
   }
 }
 
@@ -373,20 +382,33 @@ void lttv_trace_context_remove_hooks(LttvTraceContext *self,
     LttvHooks *after_trace, 
     LttvHooks *after_tracefile,
     LttvHooks *event, 
-    LttvHooksById *event_by_id)
+    LttvHooksByIdChannelArray *event_by_id_channel)
 {
-  guint i, nb_tracefile;
-
+  guint i, j, nb_tracefile;
   LttvTracefileContext **tfc;
+  LttTracefile *tf;
 
   nb_tracefile = self->tracefiles->len;
 
   for(i = 0 ; i < nb_tracefile ; i++) {
     tfc = &g_array_index(self->tracefiles, LttvTracefileContext*, i);
+    tf = (*tfc)->tf;
+    if (event_by_id_channel) {
+      for(j = 0; j < event_by_id_channel->array->len; j++) {
+        LttvHooksByIdChannel *hooks = &g_array_index(event_by_id_channel->array,
+                                                    LttvHooksByIdChannel, j);
+        if (tf->name == hooks->channel)
+          lttv_tracefile_context_remove_hooks(*tfc,
+                                       NULL,
+                                       NULL,
+                                       hooks->hooks_by_id);
+      }
+    }
     lttv_tracefile_context_remove_hooks(*tfc,
-                                        after_tracefile,
-                                        event,
-                                        event_by_id);
+                                     after_tracefile,
+                                     event,
+                                     NULL);
+
   }
 
   lttv_hooks_call(after_trace, self);
@@ -398,7 +420,6 @@ void lttv_tracefile_context_add_hooks(LttvTracefileContext *self,
           LttvHooksById *event_by_id)
 {
   guint i, index;
-
   LttvHooks *hook;
   
   lttv_hooks_call(before_tracefile, self);
@@ -434,23 +455,6 @@ void lttv_tracefile_context_remove_hooks(LttvTracefileContext *self,
   lttv_hooks_call(after_tracefile, self);
 }
 
-
-
-void lttv_tracefile_context_add_hooks_by_id(LttvTracefileContext *tfc,
-                                           unsigned i,
-                                           LttvHooks *event_by_id)
-{
-  LttvHooks * h;
-  h = lttv_hooks_by_id_find(tfc->event_by_id, i);
-  lttv_hooks_add_list(h, event_by_id);
-}
-
-void lttv_tracefile_context_remove_hooks_by_id(LttvTracefileContext *tfc,
-                                              unsigned i)
-{
-  lttv_hooks_by_id_remove(tfc->event_by_id, i);
-}
-
 static LttvTracesetContext *
 new_traceset_context(LttvTracesetContext *self)
 {
@@ -667,7 +671,7 @@ void lttv_process_traceset_begin(LttvTracesetContext *self,
                                  LttvHooks       *before_trace,
                                  LttvHooks       *before_tracefile,
                                  LttvHooks       *event,
-                                 LttvHooksById   *event_by_id)
+                                 LttvHooksByIdChannelArray *event_by_id_channel)
 {
 
   /* simply add hooks in context. _before hooks are called by add_hooks. */
@@ -677,7 +681,7 @@ void lttv_process_traceset_begin(LttvTracesetContext *self,
                                   before_trace,
                                   before_tracefile,
                                   event,
-                                  event_by_id);
+                                  event_by_id_channel);
   
 }
 
@@ -810,7 +814,7 @@ void lttv_process_traceset_end(LttvTracesetContext *self,
                                LttvHooks           *after_trace,
                                LttvHooks           *after_tracefile,
                                LttvHooks           *event,
-                               LttvHooksById       *event_by_id)
+                               LttvHooksByIdChannelArray *event_by_id_channel)
 {
   /* Remove hooks from context. _after hooks are called by remove_hooks. */
   /* It calls all after_traceset, after_trace, and after_tracefile hooks. */
@@ -819,7 +823,7 @@ void lttv_process_traceset_end(LttvTracesetContext *self,
                                      after_trace,
                                      after_tracefile,
                                      event,
-                                     event_by_id);
+                                     event_by_id_channel);
 }
 
 /* Subtile modification : 
@@ -962,22 +966,30 @@ find_field(LttEventType *et, const GQuark field)
 
 struct marker_info *lttv_trace_hook_get_marker(LttTrace *t, LttvTraceHook *th)
 {
-  return marker_get_info_from_id(t, th->id);
+  return marker_get_info_from_id(th->mdata, th->id);
 }
 
-int lttv_trace_find_hook(LttTrace *t, GQuark facility_name, GQuark event_name,
+int lttv_trace_find_hook(LttTrace *t, GQuark channel_name, GQuark event_name,
     GQuark fields[], LttvHook h, gpointer hook_data, GArray **trace_hooks)
 {
   struct marker_info *info;
   guint16 marker_id;
   int init_array_size;
-  GQuark marker_name;
+  GArray *group;
+  struct marker_data *mdata;
 
-  marker_name = lttv_merge_facility_event_name(facility_name, event_name);
+  group = g_datalist_id_get_data(&t->tracefiles, channel_name);
+  if (unlikely(!group || group->len == 0)) {
+    g_warning("No channel for marker named %s.%s found",
+    g_quark_to_string(channel_name), g_quark_to_string(event_name));
+    return 1;
+  }
 
-  info = marker_get_info_from_name(t, marker_name);
+  mdata = g_array_index (group, LttTracefile, 0).mdata;
+  info = marker_get_info_from_name(mdata, event_name);
   if(unlikely(info == NULL)) {
-    g_warning("No marker of name %s found", g_quark_to_string(marker_name));
+    g_warning("No marker named %s.%s found",
+    g_quark_to_string(channel_name), g_quark_to_string(event_name));
     return 1;
   }
 
@@ -990,9 +1002,11 @@ int lttv_trace_find_hook(LttTrace *t, GQuark facility_name, GQuark event_name,
     GQuark *f;
     struct marker_field *marker_field;
 
-    marker_id = marker_get_id_from_info(t, info);
+    marker_id = marker_get_id_from_info(mdata, info);
 
     tmpth.h = h;
+    tmpth.mdata = mdata;
+    tmpth.channel = channel_name;
     tmpth.id = marker_id;
     tmpth.hook_data = hook_data;
     tmpth.fields = g_ptr_array_new();
@@ -1012,8 +1026,9 @@ int lttv_trace_find_hook(LttTrace *t, GQuark facility_name, GQuark event_name,
            marker. Print a warning and skip this marker completely.
           Still iterate on other markers with same name. */
         g_ptr_array_free(tmpth.fields, TRUE);
-        g_warning("Field %s cannot be found in marker %s",
-                g_quark_to_string(*f), g_quark_to_string(marker_name));
+        g_warning("Field %s cannot be found in marker %s.%s",
+                g_quark_to_string(*f), g_quark_to_string(channel_name),
+                                       g_quark_to_string(event_name));
         goto skip_marker;
       }
     }
@@ -1025,8 +1040,8 @@ skip_marker:
 
   /* Error if no new trace hook has been added */
   if (init_array_size == (*trace_hooks)->len) {
-        g_warning("No marker of name %s has all requested fields",
-                g_quark_to_string(marker_name));
+        g_warning("No marker of name %s.%s has all requested fields",
+                g_quark_to_string(channel_name), g_quark_to_string(event_name));
         return 1;
   }
   return 0;
index 8bee889086bd95755a4dbfca47f954e38f920999..5a768b4b931b74d21b9bf3fb985a6d5686da099a 100644 (file)
@@ -201,11 +201,11 @@ void lttv_process_traceset(LttvTracesetContext *self, LttTime end,
 
 
 void lttv_process_traceset_begin(LttvTracesetContext *self,
-                                 LttvHooks       *before_traceset,
-                                 LttvHooks       *before_trace,
-                                 LttvHooks       *before_tracefile,
-                                 LttvHooks       *event,
-                                 LttvHooksById   *event_by_id);
+                             LttvHooks       *before_traceset,
+                             LttvHooks       *before_trace,
+                             LttvHooks       *before_tracefile,
+                             LttvHooks       *event,
+                             LttvHooksByIdChannelArray   *event_by_id_channel);
 
 
 guint lttv_process_traceset_middle(LttvTracesetContext *self,
@@ -214,11 +214,11 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
                               const LttvTracesetContextPosition *end_position);
 
 void lttv_process_traceset_end(LttvTracesetContext *self,
-                               LttvHooks           *after_traceset,
-                               LttvHooks           *after_trace,
-                               LttvHooks           *after_tracefile,
-                               LttvHooks           *event,
-                               LttvHooksById       *event_by_id);
+                             LttvHooks           *after_traceset,
+                             LttvHooks           *after_trace,
+                             LttvHooks           *after_tracefile,
+                             LttvHooks           *event,
+                             LttvHooksByIdChannelArray   *event_by_id_channel);
 
 
 void lttv_process_traceset_seek_time(LttvTracesetContext *self, LttTime start);
@@ -233,26 +233,26 @@ void lttv_traceset_context_add_hooks(LttvTracesetContext *self,
     LttvHooks *before_trace, 
     LttvHooks *before_tracefile,
     LttvHooks *event,
-    LttvHooksById *event_by_id);
+    LttvHooksByIdChannelArray *event_by_id_channel);
 
 void lttv_traceset_context_remove_hooks(LttvTracesetContext *self,
     LttvHooks *after_traceset,
     LttvHooks *after_trace, 
     LttvHooks *after_tracefile,
     LttvHooks *event, 
-    LttvHooksById *event_by_id);
+    LttvHooksByIdChannelArray *event_by_id_channel);
 
 void lttv_trace_context_add_hooks(LttvTraceContext *self,
     LttvHooks *before_trace, 
     LttvHooks *before_tracefile,
     LttvHooks *event, 
-    LttvHooksById *event_by_id);
+    LttvHooksByIdChannelArray *event_by_id_channel);
 
 void lttv_trace_context_remove_hooks(LttvTraceContext *self,
     LttvHooks *after_trace, 
     LttvHooks *after_tracefile,
     LttvHooks *event, 
-    LttvHooksById *event_by_id);
+    LttvHooksByIdChannelArray *event_by_id_channel);
 
 void lttv_tracefile_context_add_hooks(LttvTracefileContext *self,
           LttvHooks *before_tracefile,
@@ -261,20 +261,14 @@ void lttv_tracefile_context_add_hooks(LttvTracefileContext *self,
 
 
 void lttv_tracefile_context_remove_hooks(LttvTracefileContext *self,
-           LttvHooks *after_tracefile,
-           LttvHooks *event, 
-           LttvHooksById *event_by_id);
-
-
-void lttv_tracefile_context_add_hooks_by_id(LttvTracefileContext *self,
-                                           unsigned i,
-                                           LttvHooks *event_by_id);
-
-void lttv_tracefile_context_remove_hooks_by_id(LttvTracefileContext *self,
-                                              unsigned i);
+          LttvHooks *after_tracefile,
+          LttvHooks *event, 
+          LttvHooksById *event_by_id);
 
 typedef struct _LttvTraceHook {
   LttvHook h;
+  struct marker_data *mdata;
+  GQuark channel;
   guint16 id;  /* id of the marker associated with this hook */
   GPtrArray *fields;  /* struct marker_fields pointers */
   gpointer hook_data;
@@ -308,6 +302,7 @@ lttv_trace_get_hook_field(LttvTraceHook *hook, unsigned int index)
        return g_ptr_array_index(hook->fields, index);
 }
 
+#if 0
 static inline GQuark lttv_merge_facility_event_name(GQuark fac, GQuark ev)
 {
   char *tmp;
@@ -324,6 +319,7 @@ static inline GQuark lttv_merge_facility_event_name(GQuark fac, GQuark ev)
   g_free(tmp);
   return ret;
 }
+#endif //0
 
 LttvTracefileContext *lttv_traceset_context_get_current_tfc(
                              LttvTracesetContext *self);
index 8ef0fcdb36ba96e93a1a87ac47ad2965710e0c62..2c0355a45fc71d23a9e1bbce4eac3c62a4979861 100644 (file)
@@ -6,7 +6,7 @@
 
 # WARNING : subdirs order is important : mainWin depends on API
 
-SUBDIRS = lttvwindow controlflow detailedevents statistics filter tracecontrol resourceview histogram interrupts
+SUBDIRS = lttvwindow controlflow detailedevents statistics filter tracecontrol histogram interrupts resourceview
 
 # TODO: PORT for 0.10
 #diskperformance tutorial
index 0d977d41b5f434b51905814735138ddc433d629d..2f3cc0c2616bbb7370cb2d6ff1b465c65481109a 100644 (file)
@@ -26,6 +26,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
index afd530d2cb1236be806c13adb29fc00aaad95570..cde87124dd71e0791c23aa3a395bacc0acc861c0 100644 (file)
@@ -173,8 +173,6 @@ void drawing_data_request(Drawing_t *drawing,
 
     GArray *hooks;
 
-    LttvTraceHook *hook;
-
     LttvTraceHook *th;
 
     guint ret;
@@ -186,7 +184,8 @@ void drawing_data_request(Drawing_t *drawing,
       EventsRequest *events_request = g_new(EventsRequest, 1);
       // Create the hooks
       //LttvHooks *event = lttv_hooks_new();
-      LttvHooksById *event_by_id = lttv_hooks_by_id_new();
+      LttvHooksByIdChannelArray *event_by_id_channel =
+          lttv_hooks_by_id_channel_new();
       LttvHooks *before_chunk_traceset = lttv_hooks_new();
       LttvHooks *after_chunk_traceset = lttv_hooks_new();
       LttvHooks *before_request_hook = lttv_hooks_new();
@@ -223,7 +222,7 @@ void drawing_data_request(Drawing_t *drawing,
       /* before hooks */
       
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SYSCALL_ENTRY,
           FIELD_ARRAY(LTT_FIELD_SYSCALL_ID),
           before_execmode_hook,
@@ -231,7 +230,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SYSCALL_EXIT,
           NULL,
           before_execmode_hook,
@@ -239,7 +238,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_TRAP_ENTRY,
           FIELD_ARRAY(LTT_FIELD_TRAP_ID),
           before_execmode_hook,
@@ -247,7 +246,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_TRAP_EXIT,
           NULL, 
           before_execmode_hook,
@@ -255,7 +254,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_IRQ_ENTRY,
           FIELD_ARRAY(LTT_FIELD_IRQ_ID),
           before_execmode_hook,
@@ -263,7 +262,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_IRQ_EXIT,
           NULL,
           before_execmode_hook,
@@ -271,7 +270,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SOFT_IRQ_ENTRY,
           FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
           before_execmode_hook,
@@ -279,7 +278,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SOFT_IRQ_EXIT,
           NULL,
           before_execmode_hook,
@@ -288,7 +287,7 @@ void drawing_data_request(Drawing_t *drawing,
 
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SCHED_SCHEDULE,
           FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
           before_schedchange_hook,
@@ -296,7 +295,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_PROCESS_EXIT,
           FIELD_ARRAY(LTT_FIELD_PID),
           before_process_exit_hook,
@@ -304,7 +303,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
       
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_PROCESS_FREE,
           FIELD_ARRAY(LTT_FIELD_PID),
           before_process_release_hook,
@@ -312,7 +311,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_LIST,
+          LTT_CHANNEL_GLOBAL_STATE,
           LTT_EVENT_STATEDUMP_END,
           NULL,
           before_statedump_end,
@@ -323,7 +322,7 @@ void drawing_data_request(Drawing_t *drawing,
       first_after = hooks->len;
  
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SCHED_SCHEDULE,
           FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
           after_schedchange_hook,
@@ -331,7 +330,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_PROCESS_FORK,
           FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID),
           after_process_fork_hook,
@@ -339,7 +338,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_PROCESS_EXIT,
           FIELD_ARRAY(LTT_FIELD_PID),
           after_process_exit_hook,
@@ -347,7 +346,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_FS,
+          LTT_CHANNEL_FS,
           LTT_EVENT_EXEC,
           NULL,
           after_fs_exec_hook,
@@ -355,7 +354,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_USER_GENERIC,
+          LTT_CHANNEL_USERSPACE,
           LTT_EVENT_THREAD_BRAND,
           FIELD_ARRAY(LTT_FIELD_NAME),
           after_user_generic_thread_brand_hook,
@@ -363,7 +362,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_LIST,
+          LTT_CHANNEL_TASK_STATE,
           LTT_EVENT_PROCESS_STATE,
           FIELD_ARRAY(LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME),
           after_event_enum_process_hook,
@@ -371,11 +370,12 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       
-      /* Add these hooks to each event_by_id hooks list */
+      /* Add these hooks to each event_by_id_channel hooks list */
       /* add before */
       for(k = 0 ; k < first_after ; k++) {
         th = &g_array_index(hooks, LttvTraceHook, k);
-        lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
+        lttv_hooks_add(lttv_hooks_by_id_channel_find(event_by_id_channel,
+                                                    th->channel, th->id),
                         th->h,
                         th,
                         LTTV_PRIO_STATE-5);
@@ -384,7 +384,8 @@ void drawing_data_request(Drawing_t *drawing,
       /* add after */
       for(k = first_after ; k < hooks->len ; k++) {
         th = &g_array_index(hooks, LttvTraceHook, k);
-        lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
+        lttv_hooks_add(lttv_hooks_by_id_channel_find(event_by_id_channel,
+                                                    th->channel, th->id),
                        th->h,
                        th,
                        LTTV_PRIO_STATE+5);
@@ -407,7 +408,7 @@ void drawing_data_request(Drawing_t *drawing,
       events_request->before_chunk_trace = NULL;
       events_request->before_chunk_tracefile = NULL;
       events_request->event = NULL;
-      events_request->event_by_id = event_by_id;
+      events_request->event_by_id_channel = event_by_id_channel;
       events_request->after_chunk_tracefile = NULL;
       events_request->after_chunk_trace = NULL;
       events_request->after_chunk_traceset = after_chunk_traceset;
index 20cfacef40a940660722317f323486f0390482a8..51a63d64b047657b34f4e329735b37d4164ce692 100644 (file)
@@ -27,6 +27,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
index f1cca3c775fff7b8f86505c4240e2fa311a396ef..9376349c9bcfbf0dfb2fbd55ce61fbb9b2f83801 100644 (file)
@@ -1593,7 +1593,8 @@ int event_hook(void *hook_data, void *call_data)
       TRACE_NAME_COLUMN, g_quark_to_string(ltt_trace_name(tfc->t_context->t)),
       TRACEFILE_NAME_COLUMN, g_quark_to_string(ltt_tracefile_name(tfc->tf)),
       CPUID_COLUMN, cpu,
-      EVENT_COLUMN, g_quark_to_string(marker_get_info_from_id(tfc->t_context->t, e->event_id)->name),
+      EVENT_COLUMN, g_quark_to_string(marker_get_info_from_id(tfc->tf->mdata,
+        e->event_id)->name),
       TIME_S_COLUMN, time.tv_sec,
       TIME_NS_COLUMN, time.tv_nsec,
       PID_COLUMN, process->pid,
index 572c17403585ba24e2ce7e73a2c5d6d2b167413d..4c2c77124912179cdace3a4add6054a0cd3d72d9 100644 (file)
@@ -27,6 +27,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
index d09da7e65daa55b06a686edd3f19c24decd76b1a..117cb38e3c9c38ae9de8d71faf7711aae7de54d4 100644 (file)
@@ -88,7 +88,7 @@ typedef struct _DiskPerformanceData {
   
   GArray *disk_array; 
   
-  LttvHooksById * event_by_id_hooks;
+  LttvHooksByIdChannelArray * event_by_id_hooks;
   
 } DiskPerformanceData;
 
@@ -445,17 +445,17 @@ static void request_event(DiskPerformanceData *disk_performance)
        /* Get a trace state */
        ts = (LttvTraceState *)tsc->traces[i];
         
-       disk_performance->event_by_id_hooks = lttv_hooks_by_id_new();
+       disk_performance->event_by_id_hooks = lttv_hooks_by_id_channel_new();
        /* Register event_by_id_hooks with a callback function */ 
         ret = lttv_trace_find_hook(ts->parent.t,
-               LTT_FACILITY_BLOCK, LTT_EVENT_BLOCK_READ,
+               LTT_CHANNEL_BLOCK, LTT_EVENT_BLOCK_READ,
                0, 0, 0,
                block_read_callback,
                disk_performance,
                &g_array_index(hooks, LttvTraceHook, 0));
         
        ret = lttv_trace_find_hook(ts->parent.t,
-               LTT_FACILITY_BLOCK, LTT_EVENT_BLOCK_WRITE,
+               LTT_CHANNEL_BLOCK, LTT_EVENT_BLOCK_WRITE,
                0, 0, 0,
                block_write_callback,
                disk_performance,
@@ -470,7 +470,9 @@ static void request_event(DiskPerformanceData *disk_performance)
                for(l=0; l<hook->fac_list->len; l++) 
                {
                        thf = g_array_index(hook->fac_list, LttvTraceHookByFacility*, l); 
-                       lttv_hooks_add(lttv_hooks_by_id_find(disk_performance->event_by_id_hooks, thf->id),
+                       lttv_hooks_add(lttv_hooks_by_id_channel_find(
+                              disk_performance->event_by_id_hooks,
+                             thf->channel, thf->id),
                                thf->h,
                                disk_performance,
                                LTTV_PRIO_DEFAULT);
@@ -502,7 +504,7 @@ static void request_event(DiskPerformanceData *disk_performance)
        events_request->before_chunk_trace    = disk_performance->hooks_trace_before;
        events_request->before_chunk_tracefile= NULL;
        events_request->event                   = NULL; 
-       events_request->event_by_id             = disk_performance->event_by_id_hooks;
+       events_request->event_by_id_channel = disk_performance->event_by_id_hooks;
        events_request->after_chunk_tracefile = NULL;
        events_request->after_chunk_trace     = NULL;
        events_request->after_chunk_traceset    = NULL;
index 89819a25633378ecf36e83102445fa603c55b499..79d86fdfb5fd794c20e1ae563411c1da70151b6f 100644 (file)
@@ -6,6 +6,7 @@
 
 AM_CFLAGS = $(GLIB_CFLAGS) 
 AM_CFLAGS += $(GTK_CFLAGS)
+LIBS += $(THREAD_LIBS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
index 3cb65bb925d88b49f6c221ae21c63cfd817d09af..a40c59b2c15a7db724d8e6fbe1bb49806be3e5cb 100644 (file)
@@ -27,6 +27,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
index f0a61ca4794cd4af941d50037747965a10f70feb..b0781b10bb3dccc31b6ca88c3a799c28a064d0c7 100644 (file)
@@ -302,7 +302,7 @@ void histo_request_event( HistoControlFlowData *histocontrol_flow_data, guint x,
        histo_events_request->before_chunk_trace    = NULL; 
        histo_events_request->before_chunk_tracefile= NULL; 
        histo_events_request->event                 = histo_count_event_hooks; 
-       histo_events_request->event_by_id           = NULL;//histo_event_by_id;//NULL; 
+       histo_events_request->event_by_id_channel   = NULL;//histo_event_by_id;//NULL; 
        histo_events_request->after_chunk_tracefile = NULL; 
        histo_events_request->after_chunk_trace     = NULL;   
        histo_events_request->after_chunk_traceset  = histo_after_chunk_traceset;//NULL; 
index 00c1d8f7319a35e7222d5994c381f2ae1b99bdc0..c564049a249b32d240cb6cd8bb72085b9ec75107 100644 (file)
@@ -27,6 +27,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
index 608e2b2730e1e0cf1148791278e46567b50126ed..949668bd8160044b79ad2e87c67d8da846d8cc68 100644 (file)
@@ -148,7 +148,7 @@ typedef struct _InterruptEventData {
   LttvHooks  * hooks_trace_after;
   LttvHooks  * hooks_trace_before;
   TimeWindow   time_window;
-  LttvHooksById * event_by_id_hooks;
+  LttvHooksByIdChannelArray * event_by_id_hooks;
   GArray *FirstRequestIrqExit;
   GArray *FirstRequestIrqEntry;
   GArray *SecondRequestIrqEntry;
@@ -461,11 +461,11 @@ static void FirstRequest(InterruptEventData *event_data )
        /* Get a trace state */
        ts = (LttvTraceState *)tsc->traces[i];
        /* Create event_by_Id hooks */
-       event_data->event_by_id_hooks = lttv_hooks_by_id_new();
+       event_data->event_by_id_hooks = lttv_hooks_by_id_channel_new();
   
        /*Register event_by_id_hooks with a callback function*/ 
         lttv_trace_find_hook(ts->parent.t,
-               LTT_FACILITY_KERNEL,
+               LTT_CHANNEL_KERNEL,
                 LTT_EVENT_IRQ_ENTRY,
                FIELD_ARRAY(LTT_FIELD_IRQ_ID),
                FirstRequestIrqEntryCallback,
@@ -473,7 +473,7 @@ static void FirstRequest(InterruptEventData *event_data )
                &hooks);
         
        lttv_trace_find_hook(ts->parent.t,
-               LTT_FACILITY_KERNEL,
+               LTT_CHANNEL_KERNEL,
                 LTT_EVENT_IRQ_EXIT,
                NULL,
                FirstRequestIrqExitCallback,
@@ -484,7 +484,9 @@ static void FirstRequest(InterruptEventData *event_data )
        for(k = 0 ; k < hooks->len; k++) 
        { 
                th = &g_array_index(hooks, LttvTraceHook, k); 
-               lttv_hooks_add(lttv_hooks_by_id_find(event_data->event_by_id_hooks, th->id),
+               lttv_hooks_add(lttv_hooks_by_id_channel_find(
+                                              event_data->event_by_id_hooks,
+                                              th->channel, th->id),
                        th->h,
                        th,
                        LTTV_PRIO_DEFAULT);
@@ -508,7 +510,7 @@ static void FirstRequest(InterruptEventData *event_data )
        events_request->before_chunk_trace    = event_data->hooks_trace_before; 
        events_request->before_chunk_tracefile= NULL; 
        events_request->event                   = NULL;  
-       events_request->event_by_id             = event_data->event_by_id_hooks; 
+       events_request->event_by_id_channel     = event_data->event_by_id_hooks; 
        events_request->after_chunk_tracefile = NULL; 
        events_request->after_chunk_trace     = NULL;    
        events_request->after_chunk_traceset    = NULL; 
@@ -721,11 +723,11 @@ static gboolean SecondRequest(void *hook_data, void *call_data)
        /* Get a trace state */
        ts = (LttvTraceState *)tsc->traces[i];
        /* Create event_by_Id hooks */
-       event_data->event_by_id_hooks = lttv_hooks_by_id_new();
+       event_data->event_by_id_hooks = lttv_hooks_by_id_channel_new();
   
        /*Register event_by_id_hooks with a callback function*/ 
           ret = lttv_trace_find_hook(ts->parent.t,
-               LTT_FACILITY_KERNEL,
+               LTT_CHANNEL_KERNEL,
                LTT_EVENT_IRQ_ENTRY,
                FIELD_ARRAY(LTT_FIELD_IRQ_ID),
                SecondRequestIrqEntryCallback,
@@ -733,7 +735,7 @@ static gboolean SecondRequest(void *hook_data, void *call_data)
                &hooks);
         
         ret = lttv_trace_find_hook(ts->parent.t,
-               LTT_FACILITY_KERNEL,
+               LTT_CHANNEL_KERNEL,
                LTT_EVENT_IRQ_EXIT,
                NULL,
                SecondRequestIrqExitCallback,
@@ -746,7 +748,9 @@ static gboolean SecondRequest(void *hook_data, void *call_data)
        for(k = 0 ; k < hooks->len; k++) 
        { 
                th = &g_array_index(hooks, LttvTraceHook, k); 
-               lttv_hooks_add(lttv_hooks_by_id_find(event_data->event_by_id_hooks, th->id),
+               lttv_hooks_add(lttv_hooks_by_id_channel_find(
+                           event_data->event_by_id_hooks,
+                           th->channel, th->id),
                        th->h,
                        th,
                        LTTV_PRIO_DEFAULT);
@@ -770,7 +774,7 @@ static gboolean SecondRequest(void *hook_data, void *call_data)
        events_request->before_chunk_trace    = NULL; 
        events_request->before_chunk_tracefile= NULL; 
        events_request->event                   = NULL;  
-       events_request->event_by_id             = event_data->event_by_id_hooks; 
+       events_request->event_by_id_channel     = event_data->event_by_id_hooks; 
        events_request->after_chunk_tracefile = NULL; 
        events_request->after_chunk_trace     = NULL;    
        events_request->after_chunk_traceset    = NULL; 
index 243bd4f7a19d2dce05ae285887aa4e0ea33db9ce..be552644bccfd4759af3d1a3f14c0c103d31136f 100644 (file)
@@ -4,6 +4,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS)
 
 INCLUDES = \
index 817044b89539fa1d7c069c31ca157960c18a7221..97e7556126a6cfa2c44b12e1101ebc9ff25e10bb 100644 (file)
@@ -1229,7 +1229,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                 events_request->before_chunk_trace,
                 events_request->before_chunk_tracefile,
                 events_request->event,
-                events_request->event_by_id);
+                events_request->event_by_id_channel);
           else {
             guint nb_trace = lttv_traceset_number(tsc->ts);
             g_assert((guint)events_request->trace < nb_trace &&
@@ -1242,7 +1242,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                                          events_request->before_chunk_trace,
                                          events_request->before_chunk_tracefile,
                                          events_request->event,
-                                         events_request->event_by_id);
+                                         events_request->event_by_id_channel);
           }
         }
       }
@@ -1266,7 +1266,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                 events_request->before_chunk_trace,
                 events_request->before_chunk_tracefile,
                 events_request->event,
-                events_request->event_by_id);
+                events_request->event_by_id_channel);
           else {
             guint nb_trace = lttv_traceset_number(tsc->ts);
             g_assert((guint)events_request->trace < nb_trace &&
@@ -1279,7 +1279,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                                          events_request->before_chunk_trace,
                                          events_request->before_chunk_tracefile,
                                          events_request->event,
-                                         events_request->event_by_id);
+                                         events_request->event_by_id_channel);
           }
 
           iter = g_slist_next(iter);
@@ -1330,7 +1330,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                   events_request->before_chunk_trace,
                   events_request->before_chunk_tracefile,
                   events_request->event,
-                  events_request->event_by_id);
+                  events_request->event_by_id_channel);
             else {
               guint nb_trace = lttv_traceset_number(tsc->ts);
               g_assert((guint)events_request->trace < nb_trace &&
@@ -1343,7 +1343,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                                            events_request->before_chunk_trace,
                                            events_request->before_chunk_tracefile,
                                            events_request->event,
-                                           events_request->event_by_id);
+                                           events_request->event_by_id_channel);
           }
 
 
@@ -1483,7 +1483,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                                          events_request->after_chunk_trace,
                                          events_request->after_chunk_tracefile,
                                          events_request->event,
-                                         events_request->event_by_id);
+                                         events_request->event_by_id_channel);
 
           else {
             guint nb_trace = lttv_traceset_number(tsc->ts);
@@ -1495,7 +1495,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                                          events_request->after_chunk_trace,
                                          events_request->after_chunk_tracefile,
                                          events_request->event,
-                                         events_request->event_by_id);
+                                         events_request->event_by_id_channel);
             lttv_hooks_call(events_request->after_chunk_traceset, tsc);
 
 
@@ -1541,7 +1541,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                                          events_request->after_chunk_trace,
                                          events_request->after_chunk_tracefile,
                                          events_request->event,
-                                         events_request->event_by_id);
+                                         events_request->event_by_id_channel);
 
           else {
             guint nb_trace = lttv_traceset_number(tsc->ts);
@@ -1553,7 +1553,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab)
                                          events_request->after_chunk_trace,
                                          events_request->after_chunk_tracefile,
                                          events_request->event,
-                                         events_request->event_by_id);
+                                         events_request->event_by_id_channel);
 
             lttv_hooks_call(events_request->after_chunk_traceset, tsc);
           }
index c964481db12e80244a2c56523bc765c002ea72b5..ffbf291772ea40df03f58c6aa85ca0aee889b113 100644 (file)
@@ -69,7 +69,7 @@ __EXPORT LttvTraceInfo
        LTTV_BEFORE_REQUEST,
        LTTV_AFTER_REQUEST,
        LTTV_EVENT_HOOK,
-       LTTV_EVENT_HOOK_BY_ID,
+       LTTV_EVENT_HOOK_BY_ID_CHANNEL,
        LTTV_HOOK_ADDER,
        LTTV_HOOK_REMOVER,
        LTTV_IN_PROGRESS,
@@ -159,7 +159,7 @@ static void init() {
   LTTV_BEFORE_REQUEST = g_quark_from_string("before_request");
   LTTV_AFTER_REQUEST = g_quark_from_string("after_request");
   LTTV_EVENT_HOOK = g_quark_from_string("event_hook");
-  LTTV_EVENT_HOOK_BY_ID = g_quark_from_string("event_hook_by_id");
+  LTTV_EVENT_HOOK_BY_ID_CHANNEL = g_quark_from_string("event_hook_by_id_channel");
   LTTV_HOOK_ADDER = g_quark_from_string("hook_adder");
   LTTV_HOOK_REMOVER = g_quark_from_string("hook_remover");
   LTTV_IN_PROGRESS = g_quark_from_string("in_progress");
index 3dea5a927257b9a9ebc2b12eadad88c7e93f3b5d..529e4ac6c21aed90cb33f611b543bd69b7dccd02 100644 (file)
@@ -1126,8 +1126,8 @@ void events_request_free(EventsRequest *events_request)
        lttv_hooks_destroy(events_request->before_chunk_tracefile);
   if(events_request->event != NULL)
        lttv_hooks_destroy(events_request->event);
-  if(events_request->event_by_id != NULL)
-       lttv_hooks_by_id_destroy(events_request->event_by_id);
+  if(events_request->event_by_id_channel != NULL)
+       lttv_hooks_by_id_channel_destroy(events_request->event_by_id_channel);
   if(events_request->after_chunk_tracefile != NULL)
        lttv_hooks_destroy(events_request->after_chunk_tracefile);
   if(events_request->after_chunk_trace != NULL)
index 3078ed15a368f906e8fe3d67a0dca5a9db5cb053..df04a3f00cae399331af4a1dcf41ab6d5eacde5e 100644 (file)
@@ -137,7 +137,7 @@ EventsRequest consists in
 - a stop_flag, ending the read process when set to TRUE
 - a end timestamp and/or position and/or number of events to read
 - hook lists to call for traceset/trace/tracefile begin and end, and for each
-  event (event hooks and event_by_id hooks).
+  event (event hooks and event_by_id_channel hooks).
   
 The main window will deliver events for every EventRequests it has
 pending through an algorithm that guarantee that all events requested,
@@ -665,7 +665,7 @@ typedef struct _EventsRequest {
   LttvHooks                   *before_chunk_trace;    /* Unset : NULL       */
   LttvHooks                   *before_chunk_tracefile;/* Unset : NULL       */
   LttvHooks                   *event;           /* Unset : NULL             */
-  LttvHooksById               *event_by_id;     /* Unset : NULL             */
+  LttvHooksByIdChannelArray   *event_by_id_channel;/* Unset : NULL          */
   LttvHooks                   *after_chunk_tracefile; /* Unset : NULL       */
   LttvHooks                   *after_chunk_trace;     /* Unset : NULL       */
   LttvHooks                   *after_chunk_traceset;  /* Unset : NULL       */
index caa84cee813fe146f03e45f6433118f794f46ddf..375eb689e97133977b988261624c79c2b91fbd7f 100644 (file)
@@ -759,7 +759,7 @@ void lttvwindowtraces_call_before_chunk(LttvAttributeName module_name,
   LttvHooks *before_chunk_trace=NULL;
   LttvHooks *before_chunk_tracefile=NULL;
   LttvHooks *event_hook=NULL;
-  LttvHooksById *event_hook_by_id=NULL;
+  LttvHooksByIdChannelArray *event_hook_by_id_channel=NULL;
 
  
   module_attribute =
@@ -802,10 +802,10 @@ void lttvwindowtraces_call_before_chunk(LttvAttributeName module_name,
   }
 
   type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
-                                     LTTV_EVENT_HOOK_BY_ID,
+                                     LTTV_EVENT_HOOK_BY_ID_CHANNEL,
                                      &value);
   if(type == LTTV_POINTER) {
-    event_hook_by_id = (LttvHooksById*)*(value.v_pointer);
+    event_hook_by_id_channel = (LttvHooksById*)*(value.v_pointer);
   }
 
   lttv_process_traceset_begin(tsc,
@@ -813,7 +813,7 @@ void lttvwindowtraces_call_before_chunk(LttvAttributeName module_name,
                               before_chunk_trace,
                               before_chunk_tracefile,
                               event_hook,
-                              event_hook_by_id);
+                              event_hook_by_id_channel);
 }
 
 
@@ -829,7 +829,7 @@ void lttvwindowtraces_call_after_chunk(LttvAttributeName module_name,
   LttvHooks *after_chunk_trace=NULL;
   LttvHooks *after_chunk_tracefile=NULL;
   LttvHooks *event_hook=NULL;
-  LttvHooksById *event_hook_by_id=NULL;
+  LttvHooksById *event_hook_by_id_channel=NULL;
  
   module_attribute =
       LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
@@ -871,10 +871,10 @@ void lttvwindowtraces_call_after_chunk(LttvAttributeName module_name,
   }
 
   type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
-                                     LTTV_EVENT_HOOK_BY_ID,
+                                     LTTV_EVENT_HOOK_BY_ID_CHANNEL,
                                      &value);
   if(type == LTTV_POINTER) {
-    event_hook_by_id = (LttvHooksById*)*(value.v_pointer);
+    event_hook_by_id_channel = (LttvHooksById*)*(value.v_pointer);
   }
   
   lttv_process_traceset_end(tsc,
@@ -882,7 +882,7 @@ void lttvwindowtraces_call_after_chunk(LttvAttributeName module_name,
                             after_chunk_trace,
                             after_chunk_tracefile,
                             event_hook,
-                            event_hook_by_id);
+                            event_hook_by_id_channel);
 
 }
 
@@ -1500,18 +1500,18 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
  *                    information.
  */
 void lttvwindowtraces_register_computation_hooks(LttvAttributeName module_name,
-                                          LttvHooks *before_chunk_traceset,
-                                          LttvHooks *before_chunk_trace,
-                                          LttvHooks *before_chunk_tracefile,
-                                          LttvHooks *after_chunk_traceset,
-                                          LttvHooks *after_chunk_trace,
-                                          LttvHooks *after_chunk_tracefile,
-                                          LttvHooks *before_request,
-                                          LttvHooks *after_request,
-                                          LttvHooks *event_hook,
-                                          LttvHooksById *event_hook_by_id,
-                                          LttvHooks *hook_adder,
-                                          LttvHooks *hook_remover)
+                                        LttvHooks *before_chunk_traceset,
+                                        LttvHooks *before_chunk_trace,
+                                        LttvHooks *before_chunk_tracefile,
+                                        LttvHooks *after_chunk_traceset,
+                                        LttvHooks *after_chunk_trace,
+                                        LttvHooks *after_chunk_tracefile,
+                                        LttvHooks *before_request,
+                                        LttvHooks *after_request,
+                                        LttvHooks *event_hook,
+                                        LttvHooksById *event_hook_by_id_channel,
+                                        LttvHooks *hook_adder,
+                                        LttvHooks *hook_remover)
 {
   LttvAttribute *g_attribute = lttv_global_attributes();
   LttvAttribute *attribute;
@@ -1593,11 +1593,11 @@ void lttvwindowtraces_register_computation_hooks(LttvAttributeName module_name,
   *(value.v_pointer) = event_hook;
 
   result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
-                                LTTV_EVENT_HOOK_BY_ID,
+                                LTTV_EVENT_HOOK_BY_ID_CHANNEL,
                                 LTTV_POINTER,
                                 &value);
   g_assert(result);
-  *(value.v_pointer) = event_hook_by_id;
+  *(value.v_pointer) = event_hook_by_id_channel;
 
   result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
                                 LTTV_HOOK_ADDER,
@@ -1827,14 +1827,14 @@ void lttvwindowtraces_unregister_computation_hooks
     lttv_hooks_destroy(event_hook);
  
   result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
-                                LTTV_EVENT_HOOK_BY_ID,
+                                LTTV_EVENT_HOOK_BY_ID_CHANNEL,
                                 LTTV_POINTER,
                                 &value);
   g_assert(result);
 
-  LttvHooksById *event_hook_by_id = (LttvHooksById*)*(value.v_pointer);
-  if(event_hook_by_id != NULL)
-    lttv_hooks_by_id_destroy(event_hook_by_id);
+  LttvHooksById *event_hook_by_id_channel = (LttvHooksById*)*(value.v_pointer);
+  if(event_hook_by_id_channel != NULL)
+    lttv_hooks_by_id_channel_destroy(event_hook_by_id_channel);
  
   result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
                                 LTTV_HOOK_ADDER,
@@ -1858,7 +1858,7 @@ void lttvwindowtraces_unregister_computation_hooks
  
 
   lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
-                                     LTTV_EVENT_HOOK_BY_ID);
+                                     LTTV_EVENT_HOOK_BY_ID_CHANNEL);
   lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(attribute),
                                      LTTV_EVENT_HOOK);
 
index 2345030896de616fda79aef715733e7235b6dcf7..45ad7e228c53a68db3379e87fb0025e3d59e4c52 100644 (file)
@@ -92,7 +92,7 @@ extern LttvTraceInfo LTTV_TRACES,
               LTTV_BEFORE_REQUEST,
               LTTV_AFTER_REQUEST,
               LTTV_EVENT_HOOK,
-              LTTV_EVENT_HOOK_BY_ID,
+              LTTV_EVENT_HOOK_BY_ID_CHANNEL,
               LTTV_HOOK_ADDER,
               LTTV_HOOK_REMOVER,
               LTTV_IN_PROGRESS,
index 52bf12cba41103946d839fc59723029fce99aaf7..eea691a8368a60edd7b9bd9eaebd2ac89bad6c3e 100644 (file)
@@ -26,6 +26,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
index 3af879f76ca64af26c415cde405c7047931e32e1..2959cac79fc7a580d4c2f288f7fd29b5dc2ad602 100644 (file)
@@ -210,7 +210,8 @@ void drawing_data_request(Drawing_t *drawing,
       EventsRequest *events_request = g_new(EventsRequest, 1);
       // Create the hooks
       //LttvHooks *event = lttv_hooks_new();
-      LttvHooksById *event_by_id = lttv_hooks_by_id_new();
+      LttvHooksByIdChannelArray *event_by_id_channel =
+        lttv_hooks_by_id_channel_new();
       LttvHooks *before_chunk_traceset = lttv_hooks_new();
       LttvHooks *after_chunk_traceset = lttv_hooks_new();
       LttvHooks *before_request_hook = lttv_hooks_new();
@@ -263,7 +264,7 @@ void drawing_data_request(Drawing_t *drawing,
 //          &hooks);
 //
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_TRAP_ENTRY,
           FIELD_ARRAY(LTT_FIELD_TRAP_ID),
           before_execmode_hook,
@@ -271,7 +272,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_TRAP_EXIT,
           NULL,
           before_execmode_hook,
@@ -279,7 +280,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_IRQ_ENTRY,
           FIELD_ARRAY(LTT_FIELD_IRQ_ID),
           before_execmode_hook,
@@ -287,7 +288,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_IRQ_EXIT,
           NULL,
           before_execmode_hook,
@@ -295,7 +296,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SOFT_IRQ_RAISE,
           FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
           before_execmode_hook,
@@ -303,7 +304,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SOFT_IRQ_ENTRY,
           FIELD_ARRAY(LTT_FIELD_SOFT_IRQ_ID),
           before_execmode_hook,
@@ -311,7 +312,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SOFT_IRQ_EXIT,
           NULL,
           before_execmode_hook,
@@ -320,7 +321,7 @@ void drawing_data_request(Drawing_t *drawing,
 
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SCHED_SCHEDULE,
           FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
           before_schedchange_hook,
@@ -328,7 +329,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
 //      lttv_trace_find_hook(ts->parent.t,
-//          LTT_FACILITY_KERNEL,
+//          LTT_CHANNEL_KERNEL,
 //          LTT_EVENT_PROCESS_EXIT,
 //          FIELD_ARRAY(LTT_FIELD_PID),
 //          before_process_exit_hook,
@@ -336,7 +337,7 @@ void drawing_data_request(Drawing_t *drawing,
 //          &hooks);
 //      
 //      lttv_trace_find_hook(ts->parent.t,
-//          LTT_FACILITY_KERNEL,
+//          LTT_CHANNEL_KERNEL,
 //          LTT_EVENT_PROCESS_FREE,
 //          FIELD_ARRAY(LTT_FIELD_PID),
 //          before_process_release_hook,
@@ -352,7 +353,7 @@ void drawing_data_request(Drawing_t *drawing,
 //          &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_BLOCK,
           LTT_EVENT_REQUEST_ISSUE,
           FIELD_ARRAY(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION),
           before_bdev_event_hook,
@@ -360,7 +361,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_BLOCK,
           LTT_EVENT_REQUEST_COMPLETE,
           FIELD_ARRAY(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION),
           before_bdev_event_hook,
@@ -371,7 +372,7 @@ void drawing_data_request(Drawing_t *drawing,
       first_after = hooks->len;
       
       lttv_trace_find_hook(ts->parent.t,
-          LTT_FACILITY_KERNEL,
+          LTT_CHANNEL_KERNEL,
           LTT_EVENT_SCHED_SCHEDULE,
           FIELD_ARRAY(LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE),
           after_schedchange_hook,
@@ -379,7 +380,7 @@ void drawing_data_request(Drawing_t *drawing,
           &hooks);
 
 //      lttv_trace_find_hook(ts->parent.t,
-//          LTT_FACILITY_KERNEL,
+//          LTT_CHANNEL_KERNEL,
 //          LTT_EVENT_PROCESS_FORK,
 //          FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID),
 //          after_process_fork_hook,
@@ -387,7 +388,7 @@ void drawing_data_request(Drawing_t *drawing,
 //          &hooks);
 //
 //      lttv_trace_find_hook(ts->parent.t,
-//          LTT_FACILITY_KERNEL,
+//          LTT_CHANNEL_KERNEL,
 //          LTT_EVENT_PROCESS_EXIT,
 //          FIELD_ARRAY(LTT_FIELD_PID),
 //          after_process_exit_hook,
@@ -395,7 +396,7 @@ void drawing_data_request(Drawing_t *drawing,
 //          &hooks);
 //
 //      lttv_trace_find_hook(ts->parent.t,
-//          LTT_FACILITY_KERNEL,
+//          LTT_CHANNEL_KERNEL,
 //          LTT_EVENT_EXEC,
 //          NULL,
 //          after_fs_exec_hook,
@@ -423,19 +424,21 @@ void drawing_data_request(Drawing_t *drawing,
       /* add before */
       for(k = 0 ; k < first_after ; k++) {
         th = &g_array_index(hooks, LttvTraceHook, k);
-        lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
-                        th->h,
-                        th,
-                        LTTV_PRIO_STATE-5);
+        lttv_hooks_add(lttv_hooks_by_id_channel_find(event_by_id_channel,
+                                                     th->channel, th->id),
+          th->h,
+          th,
+          LTTV_PRIO_STATE-5);
       }
 
       /* add after */
       for(k = first_after ; k < hooks->len ; k++) {
         th = &g_array_index(hooks, LttvTraceHook, k);
-        lttv_hooks_add(lttv_hooks_by_id_find(event_by_id, th->id),
-                       th->h,
-                       th,
-                       LTTV_PRIO_STATE+5);
+        lttv_hooks_add(lttv_hooks_by_id_channel_find(event_by_id_channel,
+                                                     th->channel, th->id),
+          th->h,
+          th,
+          LTTV_PRIO_STATE+5);
       }
       
       events_request->hooks = hooks;
@@ -455,7 +458,7 @@ void drawing_data_request(Drawing_t *drawing,
       events_request->before_chunk_trace = NULL;
       events_request->before_chunk_tracefile = NULL;
       events_request->event = NULL;
-      events_request->event_by_id = event_by_id;
+      events_request->event_by_id_channel = event_by_id_channel;
       events_request->after_chunk_tracefile = NULL;
       events_request->after_chunk_trace = NULL;
       events_request->after_chunk_traceset = after_chunk_traceset;
@@ -479,7 +482,7 @@ static void set_last_start(gpointer key, gpointer value, gpointer user_data)
 {
   //ResourceInfo *process_info = (ResourceInfo*)key;
   HashedResourceData *hashed_process_data = (HashedResourceData*)value;
-  guint x = (guint)user_data;
+  guint x = (guint)(gulong)user_data;
 
   hashed_process_data->x.over = x;
   hashed_process_data->x.over_used = FALSE;
@@ -518,7 +521,7 @@ void drawing_data_request_begin(EventsRequest *events_request, LttvTracesetState
 
   for(i=0; i<RV_RESOURCE_COUNT; i++) {
     g_hash_table_foreach(cfd->process_list->restypes[i].hash_table, set_last_start,
-                         (gpointer)x);
+                         (gpointer)(gulong)x);
   }
 
 }
index b6d3c5493fc11303a322713e55183f93a0c43ebe..d174da034883e3701878a547ef10df1ee9546f0e 100644 (file)
@@ -813,6 +813,7 @@ int before_execmode_hook_irq(void *hook_data, void *call_data)
 
   LttvTracefileState *tfs = (LttvTracefileState *)call_data;
   LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
+  struct marker_info *minfo;
 
   LttEvent *e;
   e = ltt_tracefile_get_event(tfc->tf);
@@ -830,17 +831,20 @@ int before_execmode_hook_irq(void *hook_data, void *call_data)
   guint64 irq;
   guint cpu = tfs->cpu;
 
-  guint16 ev_id_entry = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY)));
-  guint16 ev_id_exit = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT)));
-  if(ev_id_entry == e->event_id) {
+  /*
+   * Check for LTT_CHANNEL_KERNEL channel name and event ID
+   * corresponding to LTT_EVENT_IRQ_ENTRY or LTT_EVENT_IRQ_EXIT.
+   */
+  if (tfc->tf->name != LTT_CHANNEL_KERNEL)
+    return 0;
+  minfo = marker_get_info_from_id(tfc->tf->mdata, e->event_id);
+  g_assert(minfo != NULL);
+  if (minfo->name == LTT_EVENT_IRQ_ENTRY) {
     irq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
-  }
-  else if(ev_id_exit == e->event_id) {
+  } else if (minfo->name == LTT_EVENT_IRQ_EXIT) {
     irq = ts->cpu_states[cpu].last_irq;
-  }
-  else {
+  } else
     return 0;
-  }
 
   guint trace_num = ts->parent.index;
 
@@ -987,6 +991,7 @@ int before_execmode_hook_soft_irq(void *hook_data, void *call_data)
 
   LttvTracefileState *tfs = (LttvTracefileState *)call_data;
   LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
+  struct marker_info *minfo;
 
   LttEvent *e;
   e = ltt_tracefile_get_event(tfc->tf);
@@ -1004,18 +1009,22 @@ int before_execmode_hook_soft_irq(void *hook_data, void *call_data)
   guint64 softirq;
   guint cpu = tfs->cpu;
 
-  guint16 ev_id_raise = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_RAISE)));
-  guint16 ev_id_entry = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY)));
-  guint16 ev_id_exit = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT)));
-  if(ev_id_entry == e->event_id || ev_id_raise == e->event_id) {
+  /*
+   * Check for LTT_CHANNEL_KERNEL channel name and event ID
+   * corresponding to LTT_EVENT_SOFT_IRQ_RAISE, LTT_EVENT_SOFT_IRQ_ENTRY
+   * or LTT_EVENT_SOFT_IRQ_EXIT.
+   */
+  if (tfc->tf->name != LTT_CHANNEL_KERNEL)
+    return 0;
+  minfo = marker_get_info_from_id(tfc->tf->mdata, e->event_id);
+  g_assert(minfo != NULL);
+  if (minfo->name == LTT_EVENT_SOFT_IRQ_RAISE
+      || minfo->name == LTT_EVENT_SOFT_IRQ_ENTRY) {
     softirq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
-  }
-  else if(ev_id_exit == e->event_id) {
+  } else if (minfo->name == LTT_EVENT_SOFT_IRQ_EXIT) {
     softirq = ts->cpu_states[cpu].last_soft_irq;
-  }
-  else {
+  } else
     return 0;
-  }
 
   guint trace_num = ts->parent.index;
 
@@ -1153,6 +1162,7 @@ int before_execmode_hook_trap(void *hook_data, void *call_data)
 
   LttvTracefileState *tfs = (LttvTracefileState *)call_data;
   LttvTraceState *ts = (LttvTraceState *)tfc->t_context;
+  struct marker_info *minfo;
 
   LttEvent *e;
   e = ltt_tracefile_get_event(tfc->tf);
@@ -1170,17 +1180,20 @@ int before_execmode_hook_trap(void *hook_data, void *call_data)
   guint64 trap;
   guint cpu = tfs->cpu;
 
-  guint16 ev_id_entry = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_ENTRY)));
-  guint16 ev_id_exit = marker_get_id_from_info(trace, marker_get_info_from_name(trace, lttv_merge_facility_event_name(LTT_FACILITY_KERNEL, LTT_EVENT_TRAP_EXIT)));
-  if(ev_id_entry == e->event_id) {
+  /*
+   * Check for LTT_CHANNEL_KERNEL channel name and event ID
+   * corresponding to LTT_EVENT_TRAP_ENTRY or LTT_EVENT_TRAP_EXIT.
+   */
+  if (tfc->tf->name != LTT_CHANNEL_KERNEL)
+    return 0;
+  minfo = marker_get_info_from_id(tfc->tf->mdata, e->event_id);
+  g_assert(minfo != NULL);
+  if (minfo->name == LTT_EVENT_TRAP_ENTRY) {
     trap = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
-  }
-  else if(ev_id_exit == e->event_id) {
+  } else if (minfo->name == LTT_EVENT_TRAP_EXIT) {
     trap = ts->cpu_states[cpu].last_trap;
-  }
-  else {
+  } else
     return 0;
-  }
 
   guint trace_num = ts->parent.index;
 
index 4be0cffc0f3ecd9d4997eece2368b5e110c3d9a1..9ff63b32a3dfdd49a6a44b8c14bfbaace9b60b62 100644 (file)
@@ -120,4 +120,21 @@ gint continue_notify(void *hook_data, void *call_data);
 
 void legend_destructor(GtkWindow *legend);
 
+ControlFlowData *resourceview(LttvPluginTab *ptab);
+
+HashedResourceData *resourcelist_obtain_cpu(ControlFlowData *resourceview_data,
+  guint trace_num, guint id);
+
+HashedResourceData *resourcelist_obtain_irq(ControlFlowData *resourceview_data,
+  guint trace_num, guint id);
+
+HashedResourceData *resourcelist_obtain_soft_irq(
+  ControlFlowData *resourceview_data, guint trace_num, guint id);
+
+HashedResourceData *resourcelist_obtain_trap(ControlFlowData *resourceview_data,
+  guint trace_num, guint id);
+
+HashedResourceData *resourcelist_obtain_bdev(ControlFlowData *resourceview_data,
+  guint trace_num, guint id);
+
 #endif // _EVENT_HOOKS_H
index 912dfba23b9c5155a9ad46b2c1d25f8c39eb9292..f6568c514b878e74b99c0cbeddc107483b55065d 100644 (file)
@@ -8,6 +8,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
index 42925da7900c29ca0971c2d786c3f1195776bb72..96a13df54cfe2590aabffc83d90711f7b4d470d6 100644 (file)
@@ -9,6 +9,7 @@ AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DPACKAGE_BIN_DIR=\""$(bindir)"\"
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 LIBS += $(UTIL_LIBS)
 
index ab5513bc2e7774ba3d29e0bbca84ea75b18f0f80..7aed5b42b2854a3a10ff9274c9bf0c85e4c55282 100644 (file)
@@ -27,6 +27,7 @@ AM_CFLAGS = $(GLIB_CFLAGS)
 AM_CFLAGS += $(GTK_CFLAGS)
 AM_CFLAGS += -fvisibility=hidden
 LIBS += $(GLIB_LIBS)
+LIBS += $(THREAD_LIBS)
 LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
 
 libdir = ${lttvplugindir}
index 9971ef80082dac15de9e23107fc501ef73bcf5f0..03425fb395f5c9e42abe761db7c30a45f8a8006f 100644 (file)
@@ -1,4 +1,5 @@
 AM_CFLAGS = $(GLIB_CFLAGS) 
+LIBS += $(THREAD_LIBS)
 LIBS += $(GLIB_LIBS) -lgobject-2.0 -L${top_builddir}/ltt -llttvtraceread
 
 libdir = ${lttvplugindir}
This page took 0.075079 seconds and 4 git commands to generate.