fix tabs
[lttv.git] / ltt / branches / poly / ltt / ltt.h
CommitLineData
9c312311 1/* This file is part of the Linux Trace Toolkit trace reading library
2 * Copyright (C) 2003-2004 Michel Dagenais
f104d082 3 * 2005 Mathieu Desnoyers
9c312311 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
7c6b3cd7 20#ifndef LTT_H
21#define LTT_H
975e44c7 22
cbd41522 23#include <glib.h>
1d1df11d 24#include <ltt/time.h>
25#include <ltt/compiler.h>
975e44c7 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
290dfc8c 31 trace daemon. They simply contain different events. Typically control
32 tracefiles contain the important events (process creations and registering
1b82f325 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
975e44c7 35 then use the exact same id numbers for event types.
36
290dfc8c 37 A tracefile (LttTracefile) contains a list of events (LttEvent) sorted
975e44c7 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
290dfc8c 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.
1b82f325 47 The list of facilities (and associated checksum) used in a trace
975e44c7 48 must be known in order to properly decode the contained events. An event
290dfc8c 49 is stored in the "facilities" control tracefile to denote each different
50 facility used.
975e44c7 51
290dfc8c 52 Event types (LttEventType) refer to data types (LttType) describing
975e44c7 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
290dfc8c 58 structures, may be of any nested data type (LttType).
975e44c7 59
290dfc8c 60 An LttField is a special object to denote a specific, possibly nested,
975e44c7 61 field within an event type. Suppose an event type socket_connect is a
1b82f325 62 structure containing two data members, source and destination, of type
975e44c7 63 socket_address. Type socket_address contains two unsigned integer
290dfc8c 64 data members, ip and port. An LttField is different from a data type
975e44c7 65 structure member since it can denote a specific nested field, like the
66 source port, and store associated access information (byte offset within
290dfc8c 67 the event data). The LttField objects are trace specific since the
975e44c7 68 contained information (byte offsets) may vary with the architecture
1b82f325 69 associated to the trace. */
975e44c7 70
77175651 71#define NUM_FACILITIES 256
513eefe0 72#define FACILITIES_BITS 8
9d239bd9 73#define AVG_EVENTS_PER_FACILITIES 10
77175651 74
290dfc8c 75typedef struct _LttTrace LttTrace;
1b82f325 76
290dfc8c 77typedef struct _LttTracefile LttTracefile;
975e44c7 78
290dfc8c 79typedef struct _LttFacility LttFacility;
975e44c7 80
290dfc8c 81typedef struct _LttEventType LttEventType;
975e44c7 82
290dfc8c 83typedef struct _LttType LttType;
975e44c7 84
290dfc8c 85typedef struct _LttField LttField;
975e44c7 86
290dfc8c 87typedef struct _LttEvent LttEvent;
975e44c7 88
8a2d0e71 89typedef struct _LttSystemDescription LttSystemDescription;
975e44c7 90
c02ea99f 91
975e44c7 92/* Checksums are used to differentiate facilities which have the same name
93 but differ. */
94
3aee1200 95//typedef guint32 LttChecksum;
975e44c7 96
97
98/* Events are usually stored with the easily obtained CPU clock cycle count,
308711e5 99 ltt_cycle_count. This can be converted to the real time value, LttTime,
975e44c7 100 using linear interpolation between regularly sampled values (e.g. a few
101 times per second) of the real time clock with their corresponding
102 cycle count values. */
103
f7afe191 104
105typedef struct _TimeInterval{
04b44e05 106 LttTime start_time;
107 LttTime end_time;
f7afe191 108} TimeInterval;
109
110
cbd41522 111typedef guint64 LttCycleCount;
975e44c7 112
fb1a869e 113
80da81ad 114/* Event positions are used to seek within a tracefile based on
115 the block number and event position within the block. */
116
117typedef struct _LttEventPosition LttEventPosition;
118
1b82f325 119
120/* Differences between architectures include word sizes, endianess,
121 alignment, floating point format and calling conventions. For a
122 packed binary trace, endianess and size matter, assuming that the
123 floating point format is standard (and is seldom used anyway). */
124
290dfc8c 125typedef enum _LttArchSize
7c6b3cd7 126{ LTT_LP32, LTT_ILP32, LTT_LP64, LTT_ILP64, LTT_UNKNOWN
290dfc8c 127} LttArchSize;
7c6b3cd7 128
1b82f325 129
290dfc8c 130typedef enum _LttArchEndian
7c6b3cd7 131{ LTT_LITTLE_ENDIAN, LTT_BIG_ENDIAN
290dfc8c 132} LttArchEndian;
975e44c7 133
a5dcde2f 134typedef enum _LttTypeEnum
f104d082 135{ LTT_INT_FIXED,
136 LTT_UINT_FIXED,
137 LTT_POINTER,
138 LTT_CHAR,
139 LTT_UCHAR,
140 LTT_SHORT,
141 LTT_USHORT,
142 LTT_INT,
143 LTT_UINT,
144 LTT_LONG,
145 LTT_ULONG,
146 LTT_SIZE_T,
147 LTT_SSIZE_T,
148 LTT_OFF_T,
149 LTT_FLOAT,
150 LTT_STRING,
151 LTT_ENUM,
152 LTT_ARRAY,
153 LTT_SEQUENCE,
154 LTT_STRUCT,
155 LTT_UNION,
156 LTT_NONE
a5dcde2f 157} LttTypeEnum;
f5d7967f 158
159
160/* Architecture types */
161#define LTT_ARCH_TYPE_I386 1
162#define LTT_ARCH_TYPE_PPC 2
163#define LTT_ARCH_TYPE_SH 3
164#define LTT_ARCH_TYPE_S390 4
165#define LTT_ARCH_TYPE_MIPS 5
166#define LTT_ARCH_TYPE_ARM 6
167#define LTT_ARCH_TYPE_PPC64 7
168#define LTT_ARCH_TYPE_X86_64 8
285468d4 169#define LTT_ARCH_TYPE_C2 9
83e160f2 170#define LTT_ARCH_TYPE_POWERPC 10
f5d7967f 171
172/* Standard definitions for variants */
173#define LTT_ARCH_VARIANT_NONE 0 /* Main architecture implementation */
174
175
176
7c6b3cd7 177#endif // LTT_H
This page took 0.052643 seconds and 4 git commands to generate.