1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Michel Dagenais
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19 #ifndef PROCESSTRACE_H
20 #define PROCESSTRACE_H
23 #include <lttv/traceset.h>
24 #include <lttv/attribute.h>
25 #include <lttv/hook.h>
27 //typedef void LttvFilter; /* TODO (MD) */
28 typedef struct _LttvFilter LttvFilter
;
30 /* Run through the events in a traceset in sorted order calling all the
31 hooks appropriately. It starts at the current time and runs until end or
32 nb_events are processed. */
34 void lttv_process_traceset(LttvTraceset
*traceset
, LttTime end
,
37 /* Process traceset can also be done in smaller pieces calling begin,
38 * then seek and middle repeatedly, and end. The middle function return the
39 * number of events processed. It will be smaller than nb_events if the end time
40 * or end position is reached. */
43 void lttv_process_traceset_begin(LttvTraceset
*traceset
,
44 LttvHooks
*before_traceset
,
45 LttvHooks
*before_trace
,
48 guint
lttv_process_traceset_middle(LttvTraceset
*traceset
,
51 const LttvTracesetPosition
*end_position
);
53 void lttv_process_traceset_end(LttvTraceset
*traceset
,
54 LttvHooks
*after_traceset
,
55 LttvHooks
*after_trace
,
58 guint
lttv_process_traceset_update(LttvTraceset
*traceset
);
61 void lttv_process_traceset_seek_time(LttvTraceset
*traceset
, LttTime start
);
63 void lttv_traceset_compute_time_span(LttvTraceset
*traceset
,
64 TimeInterval
*time_span
);
66 gboolean
lttv_process_traceset_seek_position(LttvTraceset
*traceset
,
67 const LttvTracesetPosition
*pos
);
69 void lttv_process_trace_seek_time(LttvTrace
*trace
, LttTime start
);
71 void lttv_traceset_add_hooks(LttvTraceset
*traceset
,
72 LttvHooks
*before_traceset
,
73 LttvHooks
*before_trace
,
76 void lttv_traceset_remove_hooks(LttvTraceset
*traceset
,
77 LttvHooks
*after_traceset
,
78 LttvHooks
*after_trace
,
81 void lttv_trace_add_hooks(LttvTrace
*trace
,
82 LttvHooks
*before_trace
,
85 void lttv_trace_remove_hooks(LttvTrace
*trace
,
86 LttvHooks
*after_trace
,
89 LttvTracesetPosition
*
90 lttv_traceset_position_new(const LttvTraceset
*traceset
);
92 void lttv_traceset_position_save(const LttvTraceset
*traceset
,
93 LttvTracesetPosition
*pos
);
95 void lttv_traceset_position_destroy(LttvTracesetPosition
*pos
);
97 void lttv_traceset_position_copy(LttvTracesetPosition
*dest
,
98 const LttvTracesetPosition
*src
);
101 lttv_traceset_pos_pos_compare(const LttvTracesetPosition
*pos1
,
102 const LttvTracesetPosition
*pos2
);
104 gint
lttv_traceset_ts_pos_compare(const LttvTraceset
*traceset
,
105 const LttvTracesetPosition
*pos2
);
108 lttv_traceset_position_get_time(const LttvTracesetPosition
*pos
);
110 /* Seek n events forward and backward (without filtering) : only use these where
111 * necessary : the seek backward is costy. */
113 #define BACKWARD_SEEK_MUL 2 /* Multiplication factor of time_offset between
114 backward seek iterations */
116 static const LttTime seek_back_default_offset
= { 1, 0 };
118 typedef gboolean
check_handler(guint count
, gboolean
*stop_flag
, gpointer data
);
120 guint
lttv_process_traceset_seek_n_forward(LttvTraceset
*traceset
,
122 check_handler
*check
,
129 typedef void (*seek_time_fct
)(LttvTraceset
*traceset
, LttTime start
);
131 /* If first_offset is ltt_time_zero, it will choose a default value */
132 guint
lttv_process_traceset_seek_n_backward(LttvTraceset
*traceset
,
134 LttTime first_offset
,
136 check_handler
*check
,
143 #endif // PROCESSTRACE_H