Subversion Repositories shark

Rev

Rev 1677 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1676 tullio 1
\documentclass[english]{report}
2
\usepackage[T1]{fontenc}
3
\usepackage[latin1]{inputenc}
4
\usepackage{geometry}
5
\geometry{verbose,a4paper}
6
\usepackage{float}
7
\usepackage{makeidx}
8
\makeindex
9
\usepackage{graphicx}
10
 
11
\makeatletter
12
 
13
\newenvironment{intest}{\noindent\large\bf\hspace*{1pt}}
14
{\vspace*{-5pt}\\\line(1,0){433}}
15
 
16
\usepackage{babel}
17
\makeatother
18
\begin{document}
19
\thispagestyle{empty}
20
 
21
\begin{center}{\LARGE S.Ha.R.K. User Manual}\end{center}{\LARGE \par}
22
\vfill{}
23
 
24
\begin{center}Volume V\end{center}
25
\begin{center}The S.Ha.R.K. New Tracer\end{center} \vfill{}
26
\begin{center}Written by\end{center}
27
\begin{center}Tullio Facchinetti (tullio.facchinetti at unipv.it)\end{center} \vfill{}
28
\begin{center}\includegraphics[width=2cm]{../common/sssup.ps}\end{center}
29
\begin{center}Scuola Superiore di Studi e Perfezionamento S. Anna\end{center}
30
\begin{center}RETIS Lab\end{center}
31
\begin{center}Via Carducci, 40 - 56100 Pisa\end{center}
32
 
33
\pagebreak
34
 
35
\tableofcontents{}
36
 
37
 
38
\chapter{The S.Ha.R.K. tracer}
39
 
40
The new Tracer is a powerful tool to understand what happens while a
41
S.Ha.R.K. \cite{Gai01} application is executed. The Tracer logs
42
a set of events corresponding with the most important activities
43
within the kernel, such as preemptions, interrupt activations,
44
mutexes blocks and releases, and much more.
45
 
46
During the execution, the kernel logs the sequence of events in
47
memory; such events are then written to disk or sent through the
48
network, typically at the end of the application execution. Each
49
event is made by: a high resolution timestamp (TSC, Time Stamp
50
Counter) corresponding to the instant at which the event has been
51
logged; the event type; 2 optional parameters to add additional
52
information to the event.
53
 
54
The Tracer can also be used to log custom events, since it
55
reserves a number of free event types for user events.
56
 
57
To use the features made available by the Tracer, the Tracer
58
functions must be enabled into the kernel by specifying
59
 
60
~
61
 
62
TRACER = NEW
63
 
64
~
65
 
66
into the \textit{shark.cfg} configuration file. The S.Ha.R.K.
67
kernel must be built with this option set.
68
 
69
%----------------------------------------------------------------------------
70
\chapter{Primitives}
71
%----------------------------------------------------------------------------
72
 
73
\vspace{7mm}
74
 
75
%------------------------------------------------------------
76
\begin{intest}
77
FTrace\_enable \index{FTrace\_enable}
78
\end{intest}
79
 
80
\begin{description}
81
\item [\textbf{int FTrace\_enable();}]
82
\item [\textbf{Description:}] Enable the Tracer. When this function is called, the Tracer starts
83
the event logging.
84
\end{description}
85
 
86
%------------------------------------------------------------
87
\begin{intest}
88
FTrace\_disable \index{FTrace\_disable}
89
\end{intest}
90
 
91
\begin{description}
92
\item [\textbf{int FTrace\_disable();}]
93
\item [\textbf{Description:}] Disable the Tracer. When this function is called, the Tracer stops
94
the event logging.
95
\end{description}
96
 
97
%------------------------------------------------------------
98
\begin{intest}
99
FTrace\_chunk\_create \index{FTrace\_chunk\_create}
100
\end{intest}
101
 
102
\begin{description}
103
\item [\textbf{int FTrace\_chunk\_create(int normal\_size, int emergency\_size, FTrace\_flags flags);}]
104
\item [\textbf{Description:}] Create a new chunk.
105
\end{description}
106
 
107
%------------------------------------------------------------
108
\begin{intest}
109
FTrace\_chunk\_delete \index{FTrace\_chunk\_delete}
110
\end{intest}
111
 
112
\begin{description}
113
\item [\textbf{int FTrace\_chunk\_delete(int number);}]
114
\item [\textbf{Description:}] Delete a Chunk.
115
\end{description}
116
 
117
%------------------------------------------------------------
118
\begin{intest}
119
FTrace\_set\_chunk\_flags \index{FTrace\_set\_chunk\_flags}
120
\end{intest}
121
 
122
\begin{description}
123
\item [\textbf{int FTrace\_set\_chunk\_flags(int number, FTrace\_flags flags);}]
124
\item [\textbf{Description:}] Set the chunk flags.
125
\end{description}
126
 
127
%------------------------------------------------------------
128
\begin{intest}
129
FTrace\_get\_chunk\_flags \index{FTrace\_get\_chunk\_flags}
130
\end{intest}
131
 
132
\begin{description}
133
\item [\textbf{int FTrace\_get\_chunk\_flags(int number, FTrace\_flags *flags);}]
134
\item [\textbf{Description:}] Returns chunk flags.
135
\end{description}
136
 
137
%------------------------------------------------------------
138
\begin{intest}
139
FTrace\_actual\_chunk\_select \index{FTrace\_actual\_chunk\_select}
140
\end{intest}
141
 
142
\begin{description}
143
\item [\textbf{int FTrace\_actual\_chunk\_select(int number);}]
144
\item [\textbf{Description:}] Select the actual chunk.
145
\end{description}
146
 
147
%------------------------------------------------------------
148
\begin{intest}
149
FTrace\_chunk\_link \index{FTrace\_chunk\_link}
150
\end{intest}
151
 
152
\begin{description}
153
\item [\textbf{int FTrace\_chunk\_link(int chunk\_A, int chunk\_B);}]
154
\item [\textbf{Description:}] Link two chunks.
155
\end{description}
156
 
157
%------------------------------------------------------------
158
\begin{intest}
159
FTrace\_get\_first\_chunk \index{FTrace\_get\_first\_chunk}
160
\end{intest}
161
 
162
\begin{description}
163
\item [\textbf{int FTrace\_get\_first\_chunk(FTrace\_flags flags);}]
164
\item [\textbf{Description:}] Find the first chunk with specific flags.
165
\end{description}
166
 
167
%------------------------------------------------------------
168
\begin{intest}
169
FTrace\_get\_chunk\_table \index{FTrace\_get\_chunk\_table}
170
\end{intest}
171
 
172
\begin{description}
173
\item [\textbf{FTrace\_Chunk\_Ptr *FTrace\_get\_chunk\_table();}]
174
\item [\textbf{Description:}] Get chunks status.
175
\end{description}
176
 
177
%------------------------------------------------------------
178
\begin{intest}
179
FTrace\_compress\_chunk \index{FTrace\_compress\_chunk}
180
\end{intest}
181
 
182
\begin{description}
183
\item [\textbf{int FTrace\_compress\_chunk(int number, FTrace\_flags new\_flags);}]
184
\item [\textbf{Description:}] Create a new memory region where the compressed data are stored.
185
\end{description}
186
 
187
%------------------------------------------------------------
188
\begin{intest}
189
FTrace\_send\_chunk \index{FTrace\_send\_chunk}
190
\end{intest}
191
 
192
\begin{description}
193
\item [\textbf{int FTrace\_send\_chunk(int number, int osd\_flags,
194
FTrace\_flags new\_flags);}]
195
\item [\textbf{Description:}] Send the chunk out from the memory.
196
\end{description}
197
 
198
%------------------------------------------------------------
199
\begin{intest}
200
FTrace\_init\_disk\_writer \index{FTrace\_init\_disk\_writer}
201
\end{intest}
202
 
203
\begin{description}
204
\item [\textbf{int FTrace\_init\_disk\_writer(char *fname, int flag,
205
char *l\_ip, char *t\_ip);}]
206
\item [\textbf{Description:}] Initialize the disk Tracer chunk dumper. It sets
207
the internal chunk sender to the function that writes chunks on disk. It
208
initializes the filename that will be used to open the file for saving chunks.
209
\end{description}
210
 
211
%------------------------------------------------------------
212
\begin{intest}
213
FTrace\_disk\_writer \index{FTrace\_disk\_writer}
214
\end{intest}
215
 
216
\begin{description}
217
\item [\textbf{void FTrace\_disk\_writer(FTrace\_Chunk\_Ptr c);}]
218
\item [\textbf{Description:}] This function is called by the application when it
219
asks to write chunk c on disk. It saves the chunk data into the chunk\_to\_disk
220
array. At the runlevel after the exit, all the saved chunks will be written to
221
disk.
222
\end{description}
223
 
224
%------------------------------------------------------------
225
\begin{intest}
226
FTrace\_OSD\_init\_udp \index{FTrace\_OSD\_init\_udp}
227
\end{intest}
228
 
229
\begin{description}
230
\item [\textbf{int FTrace\_OSD\_init\_udp(int flag, char *l\_ip, char *t\_ip);}]
231
\item [\textbf{Description:}] Initialize the Tracer chunk network sender using
232
the UDP protocol supported by S.Ha.R.K. If flag = 1 initializes the network
233
driver, otherwise it considers that the network layer has already been
234
initialized. It also sets the internal chunk sender to the function that
235
initializes the task for sending the chunk.
236
\end{description}
237
 
238
%------------------------------------------------------------
239
\begin{intest}
240
FTrace\_set\_filter \index{FTrace\_set\_filter}
241
\end{intest}
242
 
243
\begin{description}
244
\item [\textbf{void FTrace\_set\_filter(BYTE family, int status);}]
245
\item [\textbf{Description:}] Set the filter for a specific family of events
246
(see Table \ref{tab:filter-events} for a list of all the event families). When
247
the filter is enabled for a given family of events, all the events belonging to
248
that family are not logged.\\
249
While \texttt{status} set to 1 enables the filter, \texttt{status}
250
set to 0 disables the filter.
251
\end{description}
252
 
253
%------------------------------------------------------------
254
\begin{intest}
255
TRACER\_LOGEVENT \index{TRACER\_LOGEVENT}
256
\end{intest}
257
 
258
\begin{description}
259
\item [\textbf{TRACER\_LOGEVENT(WORD type, WORD par1, DWORD par2);}]
260
\item [\textbf{Description:}] Stores a new event of \texttt{type} type into the
261
current chunk, together with the 2 parameters \texttt{par1} (2 bytes) and
262
\texttt{par2} (4 bytes).
263
\end{description}
264
 
265
%----------------------------------------------------------------------------
266
\chapter{Event types description}
267
\label{ch:Event-types-description}
268
%----------------------------------------------------------------------------
269
 
270
This Chapter reports all the available event type codes currently
271
supported by S.Ha.R.K.
272
 
273
\begin{table}
274
\begin{center}
275
\begin{tabular}{|l|c|c|c|}
276
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
277
\hline FTrace\_EVT\_empty & 0x00 & . & . \\
278
\hline FTrace\_EVT\_cycles\_per\_msec & 0x10 & .& [clk/msec] \\
279
\hline FTrace\_EVT\_trace\_start& 0x20 & . & . \\
280
\hline FTrace\_EVT\_trace\_stop & 0x30& . & . \\
281
\hline FTrace\_EVT\_blackout\_start & 0x40 & .& . \\
282
\hline FTrace\_EVT\_blackout\_end & 0x50 & .& . \\
283
\hline FTrace\_EVT\_id & 0x60 & context& pid \\
284
\hline FTrace\_EVT\_numevents & 0x70 & .& . \\
285
\hline
286
\end{tabular}
287
\end{center}
288
\caption{General trace events.}
289
\end{table}
290
 
291
 
292
\begin{table}
293
\begin{center}
294
\begin{tabular}{|l|c|c|c|}
295
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
296
\hline FTrace\_EVT\_ipoint & 0x01 & number & . \\ \hline
297
\end{tabular}
298
\end{center}
299
\caption{Lightweight tracing events.}
300
\end{table}
301
 
302
 
303
\begin{table}
304
\begin{center}
305
\begin{tabular}{|l|c|c|c|}
306
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
307
\hline FTrace\_EVT\_task\_create & 0x02 & context& pid \\
308
\hline FTrace\_EVT\_task\_activate & 0x12 & context & . \\
309
\hline FTrace\_EVT\_task\_dispatch & 0x22 & . & . \\
310
\hline FTrace\_EVT\_task\_epilogue & 0x32 & . & . \\
311
\hline FTrace\_EVT\_task\_end & 0x42 & context & pid \\
312
\hline FTrace\_EVT\_task\_begin\_cycle & 0x52 & . & . \\
313
\hline FTrace\_EVT\_task\_end\_cycle & 0x62 & context & level \\
314
\hline FTrace\_EVT\_task\_sleep & 0x72 & . & . \\
315
\hline FTrace\_EVT\_task\_schedule & 0x82 & exec\_shadow.context & exec.context \\
316
\hline FTrace\_EVT\_task\_timer & 0x92 & context & level \\
317
\hline FTrace\_EVT\_task\_disable& 0xA2 & . & . \\
318
\hline FTrace\_EVT\_task\_deadline\_miss & 0xB2 & context & . \\
319
\hline FTrace\_EVT\_task\_wcet\_violation & 0xC2 & context& . \\
320
\hline
321
\end{tabular}
322
\end{center}
323
\caption{Task related events.}
324
\end{table}
325
 
326
\begin{table}
327
\begin{center}
328
\begin{tabular}{|l|c|c|c|}
329
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
330
\hline FTrace\_EVT\_interrupt\_start & 0x03 & int & . \\
331
\hline FTrace\_EVT\_interrupt\_end & 0x13 & int & . \\
332
\hline FTrace\_EVT\_interrupt\_hit & 0x23 &
333
\multicolumn{2}{c|}{Instant where interrupt was hit (no end)} \\
334
\hline FTrace\_EVT\_interrupt\_count & 0x33 &
335
\multicolumn{2}{c|}{Number of interrupts raised since last interrupt\_count} \\
336
\hline
337
\end{tabular}
338
\end{center}
339
\caption{Interrupt events, even more lightweight than ipoints.}
340
\end{table}
341
 
342
\begin{table}
343
\begin{center}
344
\begin{tabular}{|l|c|c|c|}
345
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
346
\hline FTrace\_EVT\_to\_real\_mode & 0x04 & . & . \\
347
\hline FTrace\_EVT\_to\_protected\_mode & 0x14 & . & . \\
348
\hline FTrace\_EVT\_CLI & 0x24 & . & . \\ \hline
349
FTrace\_EVT\_STI & 0x34 & . & . \\ \hline
350
\end{tabular}
351
\end{center}
352
\caption{Other CPU specific events.}
353
\end{table}
354
 
355
\begin{table}
356
\begin{center}
357
\begin{tabular}{|l|c|c|c|}
358
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
359
\hline FTrace\_EVT\_set\_priority & 0x05 & . & . \\
360
\hline FTrace\_EVT\_context\_switch & 0x15 & context& . \\
361
\hline FTrace\_EVT\_inheritance & 0x25 & exec\_shadow.context & exec.context \\
362
\hline
363
\end{tabular}
364
\end{center}
365
\caption{Changes on task attributes and state.}
366
\end{table}
367
 
368
\begin{table}
369
\begin{center}
370
\begin{tabular}{|l|c|c|c|}
371
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
372
\hline FTrace\_EVT\_set\_mutex\_create & 0x06 & . & . \\
373
\hline FTrace\_EVT\_set\_mutex\_lock & 0x16 & context& mutex \\
374
\hline FTrace\_EVT\_set\_mutex\_inherit & 0x26 & . & . \\
375
\hline FTrace\_EVT\_set\_mutex\_unlock & 0x43 & context & mutex \\
376
\hline FTrace\_EVT\_set\_mutex\_wait & 0x46 & context & mutex \\
377
\hline FTrace\_EVT\_set\_mutex\_post & 0x56 & context& mutex \\
378
\hline
379
\end{tabular}
380
\end{center}
381
\caption{Mutex events.}
382
\end{table}
383
 
384
\begin{table}
385
\begin{center}
386
\begin{tabular}{|l|c|c|c|}
387
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
388
\hline FTrace\_EVT\_signal & 0x07 & . & . \\
389
\hline
390
\end{tabular}
391
\end{center}
392
\caption{Signal events.}
393
\end{table}
394
 
395
\begin{table}
396
\begin{center}
397
\begin{tabular}{|l|c|c|c|}
398
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
399
\hline FTrace\_EVT\_server\_create & 0x08 & . & server \\
400
\hline FTrace\_EVT\_server\_replenish & 0x18 & .& server \\
401
\hline FTrace\_EVT\_server\_exhaust & 0x28 & . & server \\
402
\hline FTrace\_EVT\_server\_reclaiming & 0x38 & . & server \\
403
\hline FTrace\_EVT\_server\_remove & 0x48 & . & server \\
404
\hline FTrace\_EVT\_server\_active & 0x58 & . & server \\
405
\hline FTrace\_EVT\_server\_using\_rec & 0x68 & reclaiming & server \\
406
\hline
407
\end{tabular}
408
\end{center}
409
\caption{Specific server events.}
410
\end{table}
411
 
412
\begin{table}
413
\begin{center}
414
\begin{tabular}{|l|c|c|c|}
415
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
416
\hline FTrace\_EVT\_user\_event\_0 & 0x09 & free & free \\
417
\hline FTrace\_EVT\_user\_event\_1 & 0x19 & free & free \\
418
\hline FTrace\_EVT\_user\_event\_2 & 0x29 & free & free \\
419
\hline FTrace\_EVT\_user\_event\_3 & 0x39 & free & free \\
420
\hline FTrace\_EVT\_user\_event\_4 & 0x49 & free & free \\
421
\hline FTrace\_EVT\_user\_event\_5 & 0x59 & free & free \\
422
\hline FTrace\_EVT\_user\_event\_6 & 0x69 & free & free \\
423
\hline FTrace\_EVT\_user\_event\_7 & 0x79 & free & free \\
424
\hline FTrace\_EVT\_user\_event\_8 & 0x89 & free & free \\
425
\hline FTrace\_EVT\_user\_event\_9 & 0x99 & free & free \\
426
\hline FTrace\_EVT\_user\_event\_10 & 0xA9 & free & free \\
427
\hline FTrace\_EVT\_user\_event\_11 & 0xB9 & free & free \\
428
\hline FTrace\_EVT\_user\_event\_12 & 0xC9 & free & free \\
429
\hline FTrace\_EVT\_user\_event\_13 & 0xD9 & free & free \\
430
\hline FTrace\_EVT\_user\_event\_14 & 0xE9 & free & free \\
431
\hline
432
\end{tabular}
433
\end{center}
434
\caption{User defined events.}
435
\end{table}
436
 
437
\begin{table}
438
\begin{center}
439
\begin{tabular}{|l|c|c|c|}
440
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
441
\hline FTrace\_EVT\_timer\_post & 0x0B & . & . \\
442
\hline FTrace\_EVT\_timer\_delete & 0x1B & . & . \\
443
\hline FTrace\_EVT\_timer\_wakeup\_start & 0x2B & . & . \\
444
\hline FTrace\_EVT\_timer\_wakeup\_end & 0x3B & context & . \\
445
\hline
446
\end{tabular}
447
\end{center}
448
\caption{Timer events.}
449
\end{table}
450
 
451
\begin{table}
452
\begin{center}
453
\begin{tabular}{|l|c|c|c|}
454
\hline Name & Code & Parameter 1 & Parameter 2 \\ \hline
455
\cline{1-1} \cline{2-2} FTrace\_EVT\_data\_pointer & 0x1A &
456
\multicolumn{2}{c|}{holds a pointer of data from} \\
457
\cline{1-1} \cline{2-2} FTrace\_EVT\_next\_chunk & 0xFF &
458
\multicolumn{2}{c|}{previous event} \\
459
\hline
460
\end{tabular}
461
\end{center}
462
\caption{Generic data events.}
463
\end{table}
464
 
465
\begin{table}
466
\begin{center}
467
\begin{tabular}{|l|c|}
468
\hline Name & Code \\ \hline
469
\hline FTrace\_filter\_trace\_Events & 0xF0 \\
470
\hline FTrace\_filter\_ipoint & 0xF1 \\
471
\hline FTrace\_filter\_task & 0xF2 \\
472
\hline FTrace\_filter\_interrupt & 0xF3 \\
473
\hline FTrace\_filter\_CPU & 0xF4 \\
474
\hline FTrace\_filter\_priority & 0xF5 \\
475
\hline FTrace\_filter\_mutex & 0xF6 \\
476
\hline FTrace\_filter\_signal & 0xF7 \\
477
\hline FTrace\_filter\_server & 0xF8 \\
478
\hline FTrace\_filter\_user & 0xF9 \\
479
\hline FTrace\_filter\_data & 0xFA \\
480
\hline FTrace\_filter\_timer & 0xFB \\
481
\hline FTrace\_family\_mask & 0x0F \\
482
\hline
483
\end{tabular}
484
\end{center}
485
\caption{Filter management.}
486
\label{tab:filter-events}
487
\end{table}
488
 
489
%----------------------------------------------------------------------------
490
\chapter{Example of Tracer usage}
491
%----------------------------------------------------------------------------
492
 
493
\begin{verbatim}
494
/* Declarations */
495
int a,b,c;
496
SYS_FLAGS f;
497
 
498
/* Create 3 chunks for storing the tracer events. */
499
a = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
500
b = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN);
501
c = FTrace_chunk_create(1000000, 1000000, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
502
 
503
FTrace_chunk_link(a,b);
504
FTrace_chunk_link(b,c);
505
 
506
/* Select the first chunk for saving the events. */
507
FTrace_actual_chunk_select(a);
508
 
509
/* Start the tracer. */
510
FTrace_enable();
511
 
512
/* Enable filtering for timer related events. */
513
FTrace_set_filter(FTrace_filter_timer, 1);
514
TRACER_LOGEVENT(FTrace_EVT_trace_start, proc_table[exec_shadow].context, clk_per_msec);
515
 
516
for (i = 0; i < 10; i++)
517
  if (proc_table[i].context != 0)
518
    TRACER_LOGEVENT(FTrace_EVT_id, (unsigned short int)proc_table[i].context, i);
519
 
520
/* do something */
521
 
522
/** Enable filtering for timer related events. */
523
FTrace_set_filter(FTrace_filter_timer, 0);
524
 
525
/** Change the chunk where the events are stored. */
526
TRACER_LOGEVENT(FTrace_EVT_next_chunk, 0, 0);
527
TRACER_LOGEVENT(FTrace_EVT_ipoint, 6000, 0);
528
 
529
/* do something */
530
 
531
/* Store a TFrace stop event. */
532
TRACER_LOGEVENT(FTrace_EVT_trace_stop, 0, 0);
533
 
534
/* Stop the tracer. */
535
FTrace_disable();
536
 
537
/* Initialize the network for remotely saving the trace. */
538
FTrace_OSD_init_udp(1, "192.168.1.10", "192.168.1.1");
539
 
540
/*
541
 * If want to save the events to disk, simply change
542
 * the network initialization instruction with the following line:
543
 * FTrace_init_disk_writer("trace.dat", 0, NULL, NULL);
544
 *
545
 */
546
 
547
/* Save the chunk. */
548
FTrace_send_chunk(a, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_CYC);
549
FTrace_send_chunk(b, 0, FTRACE_CHUNK_FLAG_FREE | FTRACE_CHUNK_FLAG_JTN);
550
\end{verbatim}
551
 
552
%----------------------------------------------------------------------------
553
\chapter{Tracer output}
554
%----------------------------------------------------------------------------
555
 
556
When the trace is saved, locally or remotely, into a file, the
557
resulting binary file appears as a sequence of bytes where each
558
event stored within the trace output file is 16 bytes long. The
559
format of each single event is depicted in Table \ref{tab:format}.
560
 
561
The fields have the following meaning:
562
 
563
\begin{itemize}
564
\item Code represents the event type (see Chapter
565
\ref{ch:Event-types-description} for the full list);
566
\item Parameter 1 and 2 are the parameters used when \texttt{TRACER\_LOGEVENT}
567
is invoked;
568
\item TSC is the Time Stamp Counter associated with the event;
569
\end{itemize}
570
 
571
If \texttt{ptr} points to the first byte of an event, the correct TSC value
572
can be obtained with the following instructions:
573
 
574
\begin{verbatim}
575
unsigned long long tsc_value;
576
tsc_value = (unsigned long long)(*(unsigned int *)(ptr + 4)) << 32;
577
tsc_value += (unsigned long long)(*(unsigned int *)(ptr + 8));
578
\end{verbatim}
579
 
580
\begin{table}
581
\begin{center}\begin{tabular}{|c|c|c|c|c|}
582
\hline Code & Parameter 1 & TSC (high part) & TSC (low part) & Parameter 2 \\
583
\hline 2 bytes & 2 bytes & 4 bytes & 4 bytes & 4 bytes \\
584
\hline
585
\end{tabular}\end{center}
586
\caption{Event output file format.}
587
\label{tab:format}
588
\end{table}
589
 
590
\printindex{}
591
 
592
\bibliographystyle{alpha}
593
\bibliography{../common/biblio}
594
 
595
\end{document}