move lttv to root
[lttv.git] / ltt / ltt.h
1 /* This file is part of the Linux Trace Toolkit trace reading library
2 * Copyright (C) 2003-2004 Michel Dagenais
3 * 2005 Mathieu Desnoyers
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License Version 2.1 as published by the Free Software Foundation.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20 #ifndef LTT_H
21 #define LTT_H
22
23 #include <glib.h>
24 #include <ltt/time.h>
25 #include <ltt/compiler.h>
26
27 /* A trace is associated with a tracing session run on a single, possibly
28 multi-cpu, system. It is defined as a pathname to a directory containing
29 all the relevant trace files. All the tracefiles for a trace were
30 generated in a single system for the same time period by the same
31 trace daemon. They simply contain different events. Typically control
32 tracefiles contain the important events (process creations and registering
33 tracing facilities) for all CPUs, and one file for each CPU contains all
34 the events for that CPU. All the tracefiles within the same trace directory
35 then use the exact same id numbers for event types.
36
37 A tracefile (LttTracefile) contains a list of events (LttEvent) sorted
38 by time for each CPU; events from different CPUs may be slightly out of
39 order, especially using the (possibly drifting) cycle counters as
40 time unit.
41
42 A facility is a list of event types (LttEventType), declared in a special
43 eventdefs file. A corresponding checksum differentiates different
44 facilities which would have the same name but a different content
45 (e.g., different versions). The files are stored within the trace
46 directory and are accessed automatically upon opening a trace.
47 The list of facilities (and associated checksum) used in a trace
48 must be known in order to properly decode the contained events. An event
49 is stored in the "facilities" control tracefile to denote each different
50 facility used.
51
52 Event types (LttEventType) refer to data types (LttType) describing
53 their content. The data types supported are integer and unsigned integer
54 (of various length), enumerations (a special form of unsigned integer),
55 floating point (of various length), fixed size arrays, sequence
56 (variable sized arrays), structures and null terminated strings.
57 The elements of arrays and sequences, and the data members for
58 structures, may be of any nested data type (LttType).
59
60 An LttField is a special object to denote a specific, possibly nested,
61 field within an event type. Suppose an event type socket_connect is a
62 structure containing two data members, source and destination, of type
63 socket_address. Type socket_address contains two unsigned integer
64 data members, ip and port. An LttField is different from a data type
65 structure member since it can denote a specific nested field, like the
66 source port, and store associated access information (byte offset within
67 the event data). The LttField objects are trace specific since the
68 contained information (byte offsets) may vary with the architecture
69 associated to the trace. */
70
71 #define PREALLOC_EVENTS 28
72
73 typedef struct LttTrace LttTrace;
74
75 typedef struct LttTracefile LttTracefile;
76
77 typedef struct LttSystemDescription LttSystemDescription;
78
79 typedef struct LttEvent LttEvent;
80
81 /* Checksums are used to differentiate facilities which have the same name
82 but differ. */
83
84 //typedef guint32 LttChecksum;
85
86
87 /* Events are usually stored with the easily obtained CPU clock cycle count,
88 ltt_cycle_count. This can be converted to the real time value, LttTime,
89 using linear interpolation between regularly sampled values (e.g. a few
90 times per second) of the real time clock with their corresponding
91 cycle count values. */
92
93
94 typedef struct _TimeInterval{
95 LttTime start_time;
96 LttTime end_time;
97 } TimeInterval;
98
99
100 typedef guint64 LttCycleCount;
101
102 /* Event positions are used to seek within a tracefile based on
103 the block number and event position within the block. */
104
105 typedef struct LttEventPosition LttEventPosition;
106
107
108 /* Differences between architectures include word sizes, endianess,
109 alignment, floating point format and calling conventions. For a
110 packed binary trace, endianess and size matter, assuming that the
111 floating point format is standard (and is seldom used anyway). */
112
113 typedef enum _LttArchSize
114 { LTT_LP32, LTT_ILP32, LTT_LP64, LTT_ILP64, LTT_UNKNOWN
115 } LttArchSize;
116
117
118 typedef enum _LttArchEndian
119 { LTT_LITTLE_ENDIAN, LTT_BIG_ENDIAN
120 } LttArchEndian;
121
122 typedef enum _LttTypeEnum
123 { LTT_INT_FIXED,
124 LTT_UINT_FIXED,
125 LTT_POINTER,
126 LTT_CHAR,
127 LTT_UCHAR,
128 LTT_SHORT,
129 LTT_USHORT,
130 LTT_INT,
131 LTT_UINT,
132 LTT_LONG,
133 LTT_ULONG,
134 LTT_SIZE_T,
135 LTT_SSIZE_T,
136 LTT_OFF_T,
137 LTT_FLOAT,
138 LTT_STRING,
139 LTT_ENUM,
140 LTT_ARRAY,
141 LTT_SEQUENCE,
142 LTT_STRUCT,
143 LTT_UNION,
144 LTT_NONE
145 } LttTypeEnum;
146
147
148 /* Architecture types */
149 #define LTT_ARCH_TYPE_I386 1
150 #define LTT_ARCH_TYPE_PPC 2
151 #define LTT_ARCH_TYPE_SH 3
152 #define LTT_ARCH_TYPE_S390 4
153 #define LTT_ARCH_TYPE_MIPS 5
154 #define LTT_ARCH_TYPE_ARM 6
155 #define LTT_ARCH_TYPE_PPC64 7
156 #define LTT_ARCH_TYPE_X86_64 8
157 #define LTT_ARCH_TYPE_C2 9
158 #define LTT_ARCH_TYPE_POWERPC 10
159 #define LTT_ARCH_TYPE_X86 11
160
161 /* Standard definitions for variants */
162 #define LTT_ARCH_VARIANT_NONE 0 /* Main architecture implementation */
163
164 #endif // LTT_H
This page took 0.03327 seconds and 5 git commands to generate.