Enable support for opening multiple trace
[lttv.git] / lttv / lttv / traceset.h
index 9d62687686e0b19a4cc8691379d24de88ea75722..4f326fd8286adace26304ee19a80aae7ffda6e4e 100644 (file)
@@ -23,6 +23,7 @@
 #include <lttv/hook.h>
 #include <lttv/event.h>
 #include <ltt/ltt.h>
+#include <ltt/time.h>
 #include <lttv/trace.h>
 /* A traceset is a set of traces to be analyzed together. */
 
@@ -41,10 +42,14 @@ struct _LttvTraceset {
        LttvAttribute *a;
        LttvHooks *event_hooks;
        struct bt_ctf_iter *iter;
-  LttvTraceState *tmpState;
-
+       GPtrArray *state_trace_handle_index;
+       gboolean has_precomputed_states;
+       TimeInterval time_span;
+       char *common_path;
 };
 
+#define TRACE_NAME_SIZE 100
+
 struct _LttvTrace {
        // Trace id for babeltrace
        LttvTraceset *traceset;         /* container traceset */
@@ -52,11 +57,16 @@ struct _LttvTrace {
        LttvAttribute *a;
        guint ref_count;
        LttvTraceState *state;
+       char short_name[TRACE_NAME_SIZE];
+       char *full_path;
 };
 
 /* In babeltrace, the position concept is an iterator. */
 struct _LttvTracesetPosition {
        struct bt_ctf_iter *iter;
+       struct bt_iter_pos *bt_pos;
+        guint64 timestamp;
+        int cpu_id;
 };
 
 /* Tracesets may be added to, removed from and their content listed. */
@@ -69,6 +79,8 @@ char * lttv_traceset_name(LttvTraceset * s);
 LttvTrace *lttv_trace_new(LttTrace *t);
 #endif
 
+void get_absolute_pathname(const gchar *pathname, gchar * abs_pathname);
+
 LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig);
 
 LttvTraceset *lttv_traceset_load(const gchar *filename);
@@ -81,22 +93,22 @@ gint lttv_traceset_save(LttvTraceset *s);
 
 void lttv_traceset_destroy(LttvTraceset *s);
 
+LttvHooks *lttv_traceset_get_hooks(LttvTraceset *s);
 
 void lttv_traceset_add(LttvTraceset *s, LttvTrace *t);
 
 /*
- * lttv_traceset_add_path : Add all traces recursively to a traceset
+ * lttv_trace_create : Add all traces recursively to a traceset from a path
  *
+ * 
  * ts is the traceset in which will be contained the traces
  *
- * path is a path to a trace(s). It cannot be NULL and it is not parse
- * recursively.
- * todo mdenis: implement algorithm to go through all folders recursively to
- * find all traces in the path
+ * trace_path is the path where to find a set of trace.
+ * Traverse the path recursively to add all traces within.
  *
- * @return 0 on success, -1 on failure
+ * return 0 on success or a negative integer on failure
  */
-int lttv_traceset_add_path(LttvTraceset *ts, const char *path);
+int lttv_traceset_add_path(LttvTraceset *ts, char *path);
 
 unsigned lttv_traceset_number(LttvTraceset *s);
 
@@ -104,25 +116,48 @@ LttvTrace *lttv_traceset_get(LttvTraceset *s, unsigned i);
 
 void lttv_traceset_remove(LttvTraceset *s, unsigned i);
 
-/* An attributes table is attached to the set and to each trace in the set. */
+int lttv_traceset_get_trace_index_from_event(LttvEvent *event);
 
-LttvAttribute *lttv_traceset_attribute(LttvTraceset *s);
+int lttv_traceset_get_trace_index_from_handle_id(LttvTraceset *ts, int handle_id);
 
+/* An attributes table is attached to the set and to each trace in the set. */
 
-#ifdef BABEL_CLEANUP
-LttTrace *lttv_trace(LttvTrace *t);
-#endif
+LttvAttribute *lttv_traceset_attribute(LttvTraceset *s);
 
 /* Take a position snapshot */
-LttvTracesetPosition *lttv_traceset_create_position(LttvTraceset *traceset);
+LttvTracesetPosition *lttv_traceset_create_current_position(LttvTraceset *traceset);
 
 /* Destroy position snapshot */
 void lttv_traceset_destroy_position(LttvTracesetPosition *traceset_pos);
 
-void lttv_traceset_seek_to_position(LttvTracesetPosition *traceset_pos);
+void lttv_traceset_seek_to_position(const LttvTracesetPosition *traceset_pos);
 
 guint lttv_traceset_get_cpuid_from_event(LttvEvent *event);
+/* Returns the minimum timestamp of the traces in the traceset */
+guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset);
+/* Returns the maximum timestamp of the traces in the traceset */
+guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset);
+/* Return a TimeInterval from timestamp of the first event to the last event [experimentale]*/
+TimeInterval lttv_traceset_get_time_span_real(LttvTraceset *ts);
+/* Returns a TimeInterval struct that represents the min and max of the traceset */
+TimeInterval lttv_traceset_get_time_span(LttvTraceset *traceset);
 
 const char *lttv_traceset_get_name_from_event(LttvEvent *event);
 
+LttvTracesetPosition *lttv_traceset_create_time_position(LttvTraceset *ts, LttTime timestamp);
+
+guint64 lttv_traceset_position_get_timestamp(const LttvTracesetPosition *pos);
+
+LttTime  lttv_traceset_position_get_time(const LttvTracesetPosition *pos);
+
+LttTime lttv_traceset_get_current_time(const LttvTraceset *ts);
+
+int lttv_traceset_position_compare(const LttvTracesetPosition *pos1, const LttvTracesetPosition *pos2);
+
+int lttv_traceset_position_time_compare(const LttvTracesetPosition *pos1, 
+                                       const LttvTracesetPosition *pos2);
+
+int lttv_traceset_position_compare_current(const LttvTraceset *ts, 
+                                          const LttvTracesetPosition *pos);
+
 #endif // TRACESET_H
This page took 0.023648 seconds and 4 git commands to generate.