5 #include <lttv/state.h>
7 /* The statistics are for a complete time interval. These structures differ
8 from the system state since they relate to static components of the
9 system (all processes which existed instead of just the currently
12 The basic attributes tree to gather for several different execution modes
13 (e.g., user mode, syscall, irq), thereafter called the "events tree",
14 contains the following attributes: the number of events of each type,
15 the total number of events, the number of bytes written, the time spent
16 executing, waiting for a resource, waiting for a cpu, and possibly many
17 others. The name "facility-event_type" below is to be replaced
18 by specific event types (e.g., core-schedchange, code-syscall_entry...).
30 The events for several different execution modes are joined together to
31 form the "execution modes tree". The name "execution mode" is to be replaced
32 by "system call", "trap", "irq", "user mode" or "kernel thread".
33 The name "submode" is to be replaced by the specific system call, trap or
34 irq name. The "submode" is an empty string if none is applicable, which is
35 the case for "user mode" and "kernel thread".
37 An "events tree" for each "execution mode" contains the sum for all its
38 different submodes. An "events tree" in the "execution modes tree" contains
39 the sum for all its different execution modes.
51 Each trace set contains an "execution modes tree". While the traces
52 come from possibly different systems, which may differ in their system
53 calls..., most of the system calls will have the same name, even if their
54 actual internal numeric id differs. Categories such as cpu id and process
55 id are not kept since these are specific to each system. When several
56 traces are taken from the same system, these categories may make sense and
57 could eventually be considered.
59 Each trace contains a global "execution modes tree", one for each
60 cpu and process, and one for each process/cpu combination. The name
61 "cpu number" stands for the cpu identifier, and "process_id-start_time"
62 is a unique process identifier composed of the process id
63 (unique at any given time but which may be reused over time) concatenated
64 with the process start time.
72 "process_id-start_time"/
83 All the events and derived values (cpu, elapsed and wait time) are
84 added during the trace analysis in the relevant
85 trace / processes / * / cpu / * / mode_types / * /submodes / *
86 "events tree". To achieve this efficiently, each tracefile context
87 contains a pointer to the current relevant "events tree" and "event_types"
90 Once all the events are processed, the total number of events is computed
91 within each trace / processes / * / cpu / * / mode_types / * / submodes / *.
92 Then, the "events tree" are summed for all submodes within each mode type
93 and for all mode types within a processes / * / cpu / *
94 "execution modes tree".
96 Finally, the "execution modes trees" for all cpu within a process,
97 for all processes, and for all traces are computed. Separately,
98 the "execution modes tree" for each cpu but for all processes within a
99 trace are summed in the trace / cpu / * subtrees.
104 /* The various statistics branch names are GQuarks. They are pre-computed for
105 easy and efficient access */
108 LTTV_STATS_PROCESS_UNKNOWN
,
109 LTTV_STATS_PROCESSES
,
111 LTTV_STATS_MODE_TYPES
,
113 LTTV_STATS_EVENT_TYPES
,
115 LTTV_STATS_ELAPSED_TIME
,
117 LTTV_STATS_EVENTS_COUNT
,
118 LTTV_STATS_BEFORE_HOOKS
,
119 LTTV_STATS_AFTER_HOOKS
;
122 typedef struct _LttvTracesetStats LttvTracesetStats
;
123 typedef struct _LttvTracesetStatsClass LttvTracesetStatsClass
;
125 typedef struct _LttvTraceStats LttvTraceStats
;
126 typedef struct _LttvTraceStatsClass LttvTraceStatsClass
;
128 typedef struct _LttvTracefileStats LttvTracefileStats
;
129 typedef struct _LttvTracefileStatsClass LttvTracefileStatsClass
;
131 gboolean
lttv_stats_add_event_hooks(LttvTracesetStats
*self
);
133 gboolean
lttv_stats_remove_event_hooks(LttvTracesetStats
*self
);
136 /* The LttvTracesetStats, LttvTraceStats and LttvTracefileStats types
137 inherit from the corresponding State objects defined in state.h.. */
139 #define LTTV_TRACESET_STATS_TYPE (lttv_traceset_stats_get_type ())
140 #define LTTV_TRACESET_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TRACESET_STATS_TYPE, LttvTracesetStats))
141 #define LTTV_TRACESET_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_TRACESET_STATS_TYPE, LttvTracesetStatsClass))
142 #define LTTV_IS_TRACESET_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TRACESET_STATS_TYPE))
143 #define LTTV_IS_TRACESET_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_TRACESET_STATS_TYPE))
144 #define LTTV_TRACESET_STATS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_TRACESET_STATS_TYPE, LttvTracesetStatsClass))
146 struct _LttvTracesetStats
{
147 LttvTracesetState parent
;
149 LttvAttribute
*stats
;
152 struct _LttvTracesetStatsClass
{
153 LttvTracesetStateClass parent
;
156 GType
lttv_traceset_stats_get_type (void);
159 #define LTTV_TRACE_STATS_TYPE (lttv_trace_stats_get_type ())
160 #define LTTV_TRACE_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TRACE_STATS_TYPE, LttvTraceStats))
161 #define LTTV_TRACE_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_TRACE_STATS_TYPE, LttvTraceStatsClass))
162 #define LTTV_IS_TRACE_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TRACE_STATS_TYPE))
163 #define LTTV_IS_TRACE_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_TRACE_STATS_TYPE))
164 #define LTTV_TRACE_STATS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_TRACE_STATS_TYPE, LttvTraceStatsClass))
166 struct _LttvTraceStats
{
167 LttvTraceState parent
;
169 LttvAttribute
*stats
;
172 struct _LttvTraceStatsClass
{
173 LttvTraceStateClass parent
;
176 GType
lttv_trace_stats_get_type (void);
179 #define LTTV_TRACEFILE_STATS_TYPE (lttv_tracefile_stats_get_type ())
180 #define LTTV_TRACEFILE_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TRACEFILE_STATS_TYPE, LttvTracefileStats))
181 #define LTTV_TRACEFILE_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_TRACEFILE_STATS_TYPE, LttvTracefileStatsClass))
182 #define LTTV_IS_TRACEFILE_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TRACEFILE_STATS_TYPE))
183 #define LTTV_IS_TRACEFILE_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_TRACEFILE_STATS_TYPE))
184 #define LTTV_TRACEFILE_STATS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_TRACEFILE_STATS_TYPE, LttvTracefileStatsClass))
186 struct _LttvTracefileStats
{
187 LttvTracefileState parent
;
189 LttvAttribute
*stats
;
190 LttvAttribute
*current_events_tree
;
191 LttvAttribute
*current_event_types_tree
;
194 struct _LttvTracefileStatsClass
{
195 LttvTracefileStateClass parent
;
198 GType
lttv_tracefile_stats_get_type (void);