+/*
+ * lttv_traceset_get_timestamp_begin : returns the minimum timestamp of
+ * all the traces in the traceset.
+ *
+ */
+
+guint64 lttv_traceset_get_timestamp_begin(LttvTraceset *traceset)
+{
+ struct bt_context *bt_ctx;
+ bt_ctx = lttv_traceset_get_context(traceset);
+ guint64 timestamp_min = G_MAXUINT64, timestamp_cur = 0;
+ int i;
+ int trace_count;
+ LttvTrace *currentTrace;
+ trace_count = traceset->traces->len;
+ if(trace_count == 0)
+ timestamp_min = 0;
+ else{
+ timestamp_min = G_MAXUINT64;
+
+ for(i = 0; i < trace_count;i++)
+ {
+ currentTrace = g_ptr_array_index(traceset->traces,i);
+ timestamp_cur = bt_trace_handle_get_timestamp_begin(bt_ctx, currentTrace->id);
+ if(timestamp_cur < timestamp_min)
+ timestamp_min = timestamp_cur;
+ }
+ }
+ return timestamp_min;
+}
+
+/*
+ * lttv_traceset_get_timestamp_end: returns the maximum timestamp of
+ * all the traces in the traceset.
+ *
+ */
+guint64 lttv_traceset_get_timestamp_end(LttvTraceset *traceset)
+{
+ struct bt_context *bt_ctx;
+ bt_ctx = lttv_traceset_get_context(traceset);
+ guint64 timestamp_max, timestamp_cur = 0;
+ int i;
+ int trace_count;
+ LttvTrace *currentTrace;
+ trace_count = traceset->traces->len;
+
+ if(trace_count == 0)
+ timestamp_max = 1;
+ else
+ {
+ timestamp_max = 0;
+ for(i =0; i < trace_count;i++)
+ {
+ currentTrace = g_ptr_array_index(traceset->traces,i);
+ timestamp_cur = bt_trace_handle_get_timestamp_end(bt_ctx, currentTrace->id);
+ if(timestamp_cur > timestamp_max)
+ timestamp_max = timestamp_cur;
+ }
+ }
+ return timestamp_max;
+
+}