update filter
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 17 Dec 2008 20:54:10 +0000 (20:54 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 17 Dec 2008 20:54:10 +0000 (20:54 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@3185 04897980-b3bd-0310-b5e0-8ef037075253

trunk/lttv/configure.in
trunk/lttv/lttv/lttv/filter.c
trunk/lttv/lttv/lttv/filter.h
trunk/lttv/lttv/lttv/print.c
trunk/lttv/lttv/modules/gui/filter/filter.c
trunk/lttv/lttv/modules/text/textFilter.c

index fed746351472cf273d86caa2272fa502124d81ff..d73e1f0691fa59aaeafc0045a909ae3ba0647e52 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.12.2-15122008)
+AM_INIT_AUTOMAKE(lttv,0.12.3-17122008)
 AM_CONFIG_HEADER(config.h)
 AM_PROG_LIBTOOL
 
index 71eb619c50cede72a10b7aa575c8e9be37a8fefa..28252b31bdfc3d32a41cf1a28cd9c731c210fa0e 100644 (file)
  *  \verbatim
  *  LttvTracefileContext{} 
  *  |->event\ 
- *  | |->name (String, converted to GQuark)
- *  | |->facility (String, converted to GQuark)
+ *  | |->name (String, converted to GQuark) (channel.event)
+ *  | |->subname (String, converted to GQuark)
  *  | |->category (String, not yet implemented)
  *  | |->time (LttTime)
  *  | |->tsc (LttCycleCount --> uint64)
  *  | |->target_pid (target PID of the event)
  *  | |->fields
- *  |   |->"facility_name
+ *  |   |->"channel name"
  *  |     |->"event name"
  *  |       |->"field name"
  *  |         |->"sub-field name"
  *  |           |->...
  *  |             |->"leaf-field name" (field type)
- *  |->tracefile
+ *  |->channel (or tracefile)
  *  | |->name (String, converted to GQuark)
  *  |->trace
  *  | |->name (String, converted to GQuark)
@@ -168,10 +168,12 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) {
     /* 
      * FIXME: not yet implemented !
      */
-  } else if(!g_strcasecmp(f->str,"tracefile") ) {
+  } else if(!g_strcasecmp(f->str,"tracefile")
+            || !g_strcasecmp(f->str,"channel") ) {
     /*
      * Possible values:
      *  tracefile.name
+     *  channel.name
      */
     g_string_free(f,TRUE);
     f=ltt_g_ptr_array_remove_index_slow(fp,0);
@@ -228,6 +230,7 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) {
     /*
      * Possible values:
      *  event.name
+     *  event.channel
      *  event.category
      *  event.time
      *  event.tsc
@@ -240,6 +243,9 @@ lttv_simple_expression_assign_field(GPtrArray* fp, LttvSimpleExpression* se) {
     if(!g_strcasecmp(f->str,"name") ) {
       se->field = LTTV_FILTER_EVENT_NAME;
     }
+    else if(!g_strcasecmp(f->str,"subname") ) {
+      se->field = LTTV_FILTER_EVENT_SUBNAME;
+    }
     else if(!g_strcasecmp(f->str,"category") ) {
       /*
        * FIXME: Category not yet functional in lttv
@@ -305,7 +311,7 @@ lttv_simple_expression_assign_operator(LttvSimpleExpression* se, LttvExpressionO
      case LTTV_FILTER_TRACEFILE_NAME:
      case LTTV_FILTER_STATE_P_NAME:
      case LTTV_FILTER_STATE_T_BRAND:
-     case LTTV_FILTER_EVENT_NAME:
+     case LTTV_FILTER_EVENT_SUBNAME:
      case LTTV_FILTER_STATE_EX_MODE:
      case LTTV_FILTER_STATE_EX_SUBMODE:
      case LTTV_FILTER_STATE_P_STATUS:
@@ -321,6 +327,21 @@ lttv_simple_expression_assign_operator(LttvSimpleExpression* se, LttvExpressionO
            return FALSE;
        }
        break;
+     /*
+      * two strings.
+      */
+     case LTTV_FILTER_EVENT_NAME:
+       switch(op) {
+         case LTTV_FIELD_EQ:
+           se->op = lttv_apply_op_eq_quarks;
+           break;
+         case LTTV_FIELD_NE:
+           se->op = lttv_apply_op_ne_quarks;
+           break;
+         default:
+           g_warning("Error encountered in operator assignment = or != expected");
+           return FALSE;
+       }
      /* 
       * integer
       */
@@ -467,7 +488,7 @@ lttv_simple_expression_assign_value(LttvSimpleExpression* se, char* value) {
      case LTTV_FILTER_TRACEFILE_NAME:
      case LTTV_FILTER_STATE_P_NAME:
      case LTTV_FILTER_STATE_T_BRAND:
-     case LTTV_FILTER_EVENT_NAME:
+     case LTTV_FILTER_EVENT_SUBNAME:
      case LTTV_FILTER_STATE_EX_MODE:
      case LTTV_FILTER_STATE_EX_SUBMODE:
      case LTTV_FILTER_STATE_P_STATUS:
@@ -475,6 +496,25 @@ lttv_simple_expression_assign_value(LttvSimpleExpression* se, char* value) {
        se->value.v_quark = g_quark_from_string(value);
        g_free(value);
        break;
+     /*
+      * Two strings.
+      */
+     case LTTV_FILTER_EVENT_NAME:
+       {
+         /* channel.event */
+         char *end = strchr(value, '.');
+         if (end) {
+           *end = '\0';
+           end++;
+           se->value.v_quarks.q[0] = g_quark_from_string(value);
+           se->value.v_quarks.q[1] = g_quark_from_string(end);
+         } else {
+           se->value.v_quarks.q[0] = (GQuark)0;
+           se->value.v_quarks.q[1] = g_quark_from_string(value);
+         }
+         g_free(value);
+       }
+       break;
      /* 
       * integer -- supposed to be uint64
       */
@@ -583,7 +623,7 @@ lttv_struct_type(gint ft) {
         case LTTV_FILTER_STATE_CT:
         case LTTV_FILTER_STATE_IT:
         case LTTV_FILTER_STATE_P_NAME:
-  case LTTV_FILTER_STATE_T_BRAND:
+        case LTTV_FILTER_STATE_T_BRAND:
         case LTTV_FILTER_STATE_EX_MODE:
         case LTTV_FILTER_STATE_EX_SUBMODE:
         case LTTV_FILTER_STATE_P_STATUS:
@@ -591,6 +631,7 @@ lttv_struct_type(gint ft) {
             return LTTV_FILTER_STATE;
             break;
         case LTTV_FILTER_EVENT_NAME:
+        case LTTV_FILTER_EVENT_SUBNAME:
         case LTTV_FILTER_EVENT_CATEGORY:
         case LTTV_FILTER_EVENT_TIME:
         case LTTV_FILTER_EVENT_TSC:
@@ -705,6 +746,25 @@ gboolean lttv_apply_op_eq_quark(const gpointer v1, LttvFieldValue v2) {
   return (*r == v2.v_quark);
 }
 
+/**
+ *  @fn gboolean lttv_apply_op_eq_quarks(gpointer,LttvFieldValue) 
+ * 
+ *  Applies the 'equal' operator to the
+ *  specified structure and value
+ *  @param v1 left member of comparison
+ *  @param v2 right member of comparison
+ *  @return success/failure of operation
+ */
+gboolean lttv_apply_op_eq_quarks(const gpointer v1, LttvFieldValue v2) {
+  GQuark *r1 = (GQuark *) v1;
+  GQuark *r2 = r1 + 1;
+  if (likely(*r1 != (GQuark)0) && *r1 != v2.v_quarks.q[0])
+    return 0;
+  if (*r2 != v2.v_quarks.q[1])
+    return 0;
+  return 1;
+}
+
 /**
  *  @fn gboolean lttv_apply_op_eq_ltttime(gpointer,LttvFieldValue) 
  * 
@@ -817,6 +877,23 @@ gboolean lttv_apply_op_ne_quark(const gpointer v1, LttvFieldValue v2) {
   return (*r != v2.v_quark);
 }
 
+/**
+ *  @fn gboolean lttv_apply_op_ne_quarks(gpointer,LttvFieldValue) 
+ * 
+ *  Applies the 'equal' operator to the
+ *  specified structure and value
+ *  @param v1 left member of comparison
+ *  @param v2 right member of comparison
+ *  @return success/failure of operation
+ */
+gboolean lttv_apply_op_ne_quarks(const gpointer v1, LttvFieldValue v2) {
+  GQuark *r1 = (GQuark *) v1;
+  GQuark *r2 = r1 + 1;
+  if ((*r1 == (GQuark)0 || *r1 == v2.v_quarks.q[0]) && *r2 == v2.v_quarks.q[1])
+    return 0;
+  else
+    return 1;
+}
 
 /**
  *  @fn gboolean lttv_apply_op_ne_ltttime(gpointer,LttvFieldValue) 
@@ -2044,6 +2121,19 @@ lttv_filter_tree_parse_branch(
             }
             break;
         case LTTV_FILTER_EVENT_NAME:
+            if(event == NULL) return TRUE;
+            else {
+              struct marker_info *info;
+              GQuark qtuple[2];
+             LttTracefile *tf = context->tf;
+              qtuple[0] = ltt_tracefile_name(tracefile);
+              info = marker_get_info_from_id(tf->mdata, event->event_id);
+              g_assert(info != NULL);
+              qtuple[1] = info->name;
+              return se->op((gpointer)qtuple,v);
+            }
+            break;
+        case LTTV_FILTER_EVENT_SUBNAME:
             if(event == NULL) return TRUE;
             else {
               struct marker_info *info;
index 49d97981576b0181bc75997934c1af183337d475..d942752de184dae4e6f27eb4265ba223879ded96 100644 (file)
@@ -110,6 +110,7 @@ enum _LttvFieldType {
   LTTV_FILTER_STATE_P_STATUS,         /**< state.process_status (LttvProcessStatus) */
   LTTV_FILTER_STATE_CPU,              /**< state.cpu (?last_cpu?) */
   LTTV_FILTER_EVENT_NAME,             /**< event.name (char*) */
+  LTTV_FILTER_EVENT_SUBNAME,          /**< event.subname (char*) */
   LTTV_FILTER_EVENT_CATEGORY,         /**< FIXME: not implemented */
   LTTV_FILTER_EVENT_TIME,             /**< event.time (double) */
   LTTV_FILTER_EVENT_TSC,              /**< event.tsc (double) */
@@ -156,6 +157,9 @@ union _LttvFieldValue {
   double v_double;                    /**< double */
   char* v_string;                     /**< string */
   LttTime v_ltttime;                  /**< LttTime */
+  struct {
+    GQuark q[2];
+  } v_quarks;
 };
 
 /**
@@ -268,6 +272,7 @@ gboolean lttv_apply_op_eq_uint16(const gpointer v1, LttvFieldValue v2);
 gboolean lttv_apply_op_eq_double(const gpointer v1, LttvFieldValue v2);
 gboolean lttv_apply_op_eq_string(const gpointer v1, LttvFieldValue v2);
 gboolean lttv_apply_op_eq_quark(const gpointer v1, LttvFieldValue v2);
+gboolean lttv_apply_op_eq_quarks(const gpointer v1, LttvFieldValue v2);
 gboolean lttv_apply_op_eq_ltttime(const gpointer v1, LttvFieldValue v2);
 
 gboolean lttv_apply_op_ne_uint(const gpointer v1, LttvFieldValue v2);
@@ -277,6 +282,7 @@ gboolean lttv_apply_op_ne_uint16(const gpointer v1, LttvFieldValue v2);
 gboolean lttv_apply_op_ne_double(const gpointer v1, LttvFieldValue v2);
 gboolean lttv_apply_op_ne_string(const gpointer v1, LttvFieldValue v2);
 gboolean lttv_apply_op_ne_quark(const gpointer v1, LttvFieldValue v2);
+gboolean lttv_apply_op_ne_quarks(const gpointer v1, LttvFieldValue v2);
 gboolean lttv_apply_op_ne_ltttime(const gpointer v1, LttvFieldValue v2);
 
 gboolean lttv_apply_op_lt_uint(const gpointer v1, LttvFieldValue v2);
index c9099064d2bab23142806629342ad50cd707aa9b..b5f02a0cc0e2a595d8b4eacf99c888fea6b42dfb 100644 (file)
@@ -264,7 +264,8 @@ void lttv_event_to_string(LttEvent *e, GString *s,
 
   if(mandatory_fields) {
     time = ltt_event_time(e);
-    g_string_append_printf(s,"%s: %ld.%09ld (%s/%s_%u)",
+    g_string_append_printf(s,"%s.%s: %ld.%09ld (%s/%s_%u)",
+       g_quark_to_string(ltt_tracefile_name(tfs->parent.tf)),
         g_quark_to_string(info->name),
         (long)time.tv_sec, time.tv_nsec,
        g_quark_to_string(
index 66108652e08061c69766f72a62cbf8c8e8afcd90..60e17839a5a61760705662c7d614832f2a838022 100644 (file)
@@ -187,7 +187,7 @@ gui_filter(LttvPlugin *plugin)
   fvd->f_field_options = g_ptr_array_new(); //g_array_new(FALSE,FALSE,16);
   g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new(""));
   g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.name"));
-  g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.facility"));
+  g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.subname"));
   g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.category"));
   g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.time"));
   g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("event.tsc"));
@@ -195,7 +195,7 @@ gui_filter(LttvPlugin *plugin)
   /*
    * TODO: Add core.xml fields here !
    */
-  g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("tracefile.name"));
+  g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("channel.name"));
   g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("trace.name"));
   g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("state.process_name"));
   g_ptr_array_add(fvd->f_field_options,(gpointer) g_string_new("state.thread_brand"));
index 4590a76a4ea7d3e2b0b79ebc95995a22eb9e8e42..27425201dd9a246741031655165dc34a990adbbf 100644 (file)
@@ -128,14 +128,14 @@ void filter_list_commands(void *hook_data) {
   g_print("[field] [op] [value]\n\n");
 
   g_print("*** Possible fields ***\n");
-  g_print("event.name (string)\n");
-  g_print("event.facility (string)\n");
+  g_print("event.name (string) (channel_name.event_name)\n");
+  g_print("event.subname (string)\n");
   g_print("event.category (string)\n");
   g_print("event.time (double)\n");
   g_print("event.tsc (integer)\n");
   g_print("event.target_pid (integer)\n");
-  g_print("event.field.facility_name.event_name.field_name.subfield_name (field_type)\n");
-  g_print("tracefile.name (string)\n");
+  g_print("event.field.channel_name.event_name.field_name.subfield_name (field_type)\n");
+  g_print("channel.name (string)\n");
   g_print("trace.name (string)\n");
   g_print("state.pid (integer)\n");
   g_print("state.ppid (integer)\n");
This page took 0.034937 seconds and 4 git commands to generate.