old files clean
[lttv.git] / ltt / branches / poly / include / lttv / stats.h
CommitLineData
b445142a 1#ifndef STATS_H
2#define STATS_H
3
4#include <glib.h>
5#include <lttv/state.h>
dc877563 6
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
10 existing processes).
11
b445142a 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...).
19
20 event_types/
21 "facility-event_type"
22 events_count
23 cpu_time
24 elapsed_time
25 wait_time
26 bytes_written
27 packets_sent
28 ...
29
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".
36
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.
40
41 mode_types/
42 "execution mode"/
43 submodes/
44 "submode"/
45 Events Tree
46 events/
47 Event Tree
48 events/
49 Events Tree
50
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.
58
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.
65
66 modes/
67 Execution Modes Tree
68 cpu/
69 "cpu number"/
70 Execution Modes Tree
71 processes/
72 "process_id-start_time"/
73 exec_file_name
74 parent
75 start_time
76 end_time
77 modes/
78 Execution Modes Tree
79 cpu/
80 "cpu number"/
81 Execution Modes Tree
82
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"
88 tree within it.
89
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".
95
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.
100
101 */
102
103
104/* The various statistics branch names are GQuarks. They are pre-computed for
105 easy and efficient access */
106
107extern GQuark
108 LTTV_STATS_PROCESS_UNKNOWN,
109 LTTV_STATS_PROCESSES,
110 LTTV_STATS_CPU,
111 LTTV_STATS_MODE_TYPES,
112 LTTV_STATS_SUBMODES,
113 LTTV_STATS_EVENT_TYPES,
114 LTTV_STATS_CPU_TIME,
115 LTTV_STATS_ELAPSED_TIME,
116 LTTV_STATS_EVENTS,
117 LTTV_STATS_EVENTS_COUNT,
118 LTTV_STATS_BEFORE_HOOKS,
119 LTTV_STATS_AFTER_HOOKS;
120
121
122typedef struct _LttvTracesetStats LttvTracesetStats;
123typedef struct _LttvTracesetStatsClass LttvTracesetStatsClass;
124
125typedef struct _LttvTraceStats LttvTraceStats;
126typedef struct _LttvTraceStatsClass LttvTraceStatsClass;
127
128typedef struct _LttvTracefileStats LttvTracefileStats;
129typedef struct _LttvTracefileStatsClass LttvTracefileStatsClass;
130
131gboolean lttv_stats_add_event_hooks(LttvTracesetStats *self);
132
133gboolean lttv_stats_remove_event_hooks(LttvTracesetStats *self);
134
9f797243 135void lttv_stats_save_statistics(LttvTracesetStats *self);
136
137gboolean lttv_stats_load_statistics(LttvTracesetStats *self);
138
b445142a 139
140/* The LttvTracesetStats, LttvTraceStats and LttvTracefileStats types
141 inherit from the corresponding State objects defined in state.h.. */
142
143#define LTTV_TRACESET_STATS_TYPE (lttv_traceset_stats_get_type ())
144#define LTTV_TRACESET_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TRACESET_STATS_TYPE, LttvTracesetStats))
145#define LTTV_TRACESET_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_TRACESET_STATS_TYPE, LttvTracesetStatsClass))
146#define LTTV_IS_TRACESET_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TRACESET_STATS_TYPE))
147#define LTTV_IS_TRACESET_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_TRACESET_STATS_TYPE))
148#define LTTV_TRACESET_STATS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_TRACESET_STATS_TYPE, LttvTracesetStatsClass))
149
150struct _LttvTracesetStats {
151 LttvTracesetState parent;
152
153 LttvAttribute *stats;
154};
155
156struct _LttvTracesetStatsClass {
157 LttvTracesetStateClass parent;
158};
159
160GType lttv_traceset_stats_get_type (void);
161
162
163#define LTTV_TRACE_STATS_TYPE (lttv_trace_stats_get_type ())
164#define LTTV_TRACE_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TRACE_STATS_TYPE, LttvTraceStats))
165#define LTTV_TRACE_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_TRACE_STATS_TYPE, LttvTraceStatsClass))
166#define LTTV_IS_TRACE_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TRACE_STATS_TYPE))
167#define LTTV_IS_TRACE_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_TRACE_STATS_TYPE))
168#define LTTV_TRACE_STATS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_TRACE_STATS_TYPE, LttvTraceStatsClass))
169
170struct _LttvTraceStats {
171 LttvTraceState parent;
172
173 LttvAttribute *stats;
174};
175
176struct _LttvTraceStatsClass {
177 LttvTraceStateClass parent;
178};
179
180GType lttv_trace_stats_get_type (void);
181
182
183#define LTTV_TRACEFILE_STATS_TYPE (lttv_tracefile_stats_get_type ())
184#define LTTV_TRACEFILE_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_TRACEFILE_STATS_TYPE, LttvTracefileStats))
185#define LTTV_TRACEFILE_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_TRACEFILE_STATS_TYPE, LttvTracefileStatsClass))
186#define LTTV_IS_TRACEFILE_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_TRACEFILE_STATS_TYPE))
187#define LTTV_IS_TRACEFILE_STATS_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_TRACEFILE_STATS_TYPE))
188#define LTTV_TRACEFILE_STATS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_TRACEFILE_STATS_TYPE, LttvTracefileStatsClass))
189
190struct _LttvTracefileStats {
191 LttvTracefileState parent;
192
193 LttvAttribute *stats;
194 LttvAttribute *current_events_tree;
195 LttvAttribute *current_event_types_tree;
196};
197
198struct _LttvTracefileStatsClass {
199 LttvTracefileStateClass parent;
200};
201
202GType lttv_tracefile_stats_get_type (void);
203
dc877563 204
b445142a 205#endif // STATS_H
This page took 0.030386 seconds and 4 git commands to generate.