Use a timescale without correction in the graphs
[lttv.git] / lttv / lttv / sync / event_processing_lttng_standard.c
CommitLineData
70407e86
BP
1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
19#define _ISOC99_SOURCE
20
21#ifdef HAVE_CONFIG_H
22#include <config.h>
23#endif
24
25#include <linux/if_ether.h>
26#include <math.h>
27#include <netinet/in.h>
28#include <stdint.h>
29#include <stdlib.h>
f6691532 30#include <string.h>
70407e86 31
2bd4b3e4 32#include "sync_chain.h"
10341d26 33#include "event_processing_lttng_common.h"
70407e86 34
10341d26 35#include "event_processing_lttng_standard.h"
70407e86
BP
36
37
38#ifndef g_info
39#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
40#endif
41
42
08365995 43// Functions common to all processing modules
70407e86
BP
44static void initProcessingLTTVStandard(SyncState* const syncState,
45 LttvTracesetContext* const traceSetContext);
46static void destroyProcessingLTTVStandard(SyncState* const syncState);
47
48static void finalizeProcessingLTTVStandard(SyncState* const syncState);
49static void printProcessingStatsLTTVStandard(SyncState* const syncState);
8d7d16dd
BP
50static void writeProcessingGraphsOptionsLTTVStandard(SyncState* const
51 syncState, const unsigned int i, const unsigned int j);
70407e86
BP
52
53// Functions specific to this module
54static void registerProcessingLTTVStandard() __attribute__((constructor (102)));
55static gboolean processEventLTTVStandard(void* hookData, void* callData);
56static void partialDestroyProcessingLTTVStandard(SyncState* const syncState);
57
58
59static ProcessingModule processingModuleLTTVStandard = {
60 .name= "LTTV-standard",
61 .initProcessing= &initProcessingLTTVStandard,
62 .destroyProcessing= &destroyProcessingLTTVStandard,
63 .finalizeProcessing= &finalizeProcessingLTTVStandard,
64 .printProcessingStats= &printProcessingStatsLTTVStandard,
d6ee5003 65 .writeProcessingGraphsPlots= NULL,
08365995 66 .writeProcessingGraphsOptions= &writeProcessingGraphsOptionsLTTVStandard,
70407e86
BP
67};
68
69
70
71/*
72 * Processing Module registering function
73 */
74static void registerProcessingLTTVStandard()
75{
76 g_queue_push_tail(&processingModules, &processingModuleLTTVStandard);
77
78 createQuarks();
79}
80
81
82/*
83 * Allocate and initialize data structures for synchronizing a traceset.
84 * Register event hooks.
85 *
86 * Args:
87 * syncState: container for synchronization data.
88 * This function allocates these processingData members:
89 * traceNumTable
90 * pendingRecv
91 * hookListList
92 * stats
93 * traceSetContext: set of LTTV traces
94 */
95static void initProcessingLTTVStandard(SyncState* const syncState, LttvTracesetContext*
96 const traceSetContext)
97{
98 unsigned int i;
99 ProcessingDataLTTVStandard* processingData;
100
101 processingData= malloc(sizeof(ProcessingDataLTTVStandard));
102 syncState->processingData= processingData;
103 processingData->traceSetContext= traceSetContext;
104
105 if (syncState->stats)
106 {
107 processingData->stats= calloc(1, sizeof(ProcessingStatsLTTVStandard));
108 }
109 else
110 {
111 processingData->stats= NULL;
112 }
113
114 processingData->traceNumTable= g_hash_table_new(&g_direct_hash, NULL);
115 processingData->hookListList= g_array_sized_new(FALSE, FALSE,
116 sizeof(GArray*), syncState->traceNb);
117 processingData->pendingRecv= malloc(sizeof(GHashTable*) *
118 syncState->traceNb);
119
120 for(i= 0; i < syncState->traceNb; i++)
121 {
122 g_hash_table_insert(processingData->traceNumTable,
123 processingData->traceSetContext->traces[i]->t, (gpointer) i);
124 }
125
1633c5a5
BP
126 if (syncState->graphsStream)
127 {
128 processingData->graphs= malloc(syncState->traceNb *
129 sizeof(ProcessingGraphsLTTVStandard));
130
131 for(i= 0; i < syncState->traceNb; i++)
132 {
133 LttTrace* traceI= traceSetContext->traces[i]->t;
134
135 processingData->graphs[i].startFreq= traceI->start_freq;
136 processingData->graphs[i].freqScale= traceI->freq_scale;
137 }
138 }
139 else
140 {
141 processingData->graphs= NULL;
142 }
143
70407e86
BP
144 for(i= 0; i < syncState->traceNb; i++)
145 {
146 processingData->pendingRecv[i]= g_hash_table_new_full(&g_direct_hash,
10341d26 147 NULL, NULL, &gdnDestroyEvent);
70407e86
BP
148 }
149
150 registerHooks(processingData->hookListList, traceSetContext,
f6691532
BP
151 &processEventLTTVStandard, syncState,
152 syncState->matchingModule->canMatch);
70407e86
BP
153}
154
155
156/*
157 * Call the partial processing destroyer, obtain and adjust the factors from
158 * downstream
159 *
160 * Args:
161 * syncState container for synchronization data.
162 */
163static void finalizeProcessingLTTVStandard(SyncState* const syncState)
164{
165 unsigned int i;
166 GArray* factors;
167 double minOffset, minDrift;
168 unsigned int refFreqTrace;
169 ProcessingDataLTTVStandard* processingData;
170
171 processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
172
173 partialDestroyProcessingLTTVStandard(syncState);
174
175 factors= syncState->matchingModule->finalizeMatching(syncState);
176
177 /* The offsets are adjusted so the lowest one is 0. This is done because
178 * of a Lttv specific limitation: events cannot have negative times. By
179 * having non-negative offsets, events cannot be moved backwards to
180 * negative times.
181 */
182 minOffset= 0;
183 for (i= 0; i < syncState->traceNb; i++)
184 {
185 minOffset= MIN(g_array_index(factors, Factors, i).offset, minOffset);
186 }
187
188 for (i= 0; i < syncState->traceNb; i++)
189 {
190 g_array_index(factors, Factors, i).offset-= minOffset;
191 }
192
193 /* Because the timestamps are corrected at the TSC level (not at the
194 * LttTime level) all trace frequencies must be made equal. We choose to
195 * use the frequency of the system with the lowest drift
196 */
197 minDrift= INFINITY;
198 refFreqTrace= 0;
199 for (i= 0; i < syncState->traceNb; i++)
200 {
201 if (g_array_index(factors, Factors, i).drift < minDrift)
202 {
203 minDrift= g_array_index(factors, Factors, i).drift;
204 refFreqTrace= i;
205 }
206 }
207 g_assert(syncState->traceNb == 0 || minDrift != INFINITY);
208
209 // Write the factors to the LttTrace structures
210 for (i= 0; i < syncState->traceNb; i++)
211 {
212 LttTrace* t;
213 Factors* traceFactors;
214
215 t= processingData->traceSetContext->traces[i]->t;
216 traceFactors= &g_array_index(factors, Factors, i);
217
218 t->drift= traceFactors->drift;
219 t->offset= traceFactors->offset;
220 t->start_freq=
221 processingData->traceSetContext->traces[refFreqTrace]->t->start_freq;
222 t->freq_scale=
223 processingData->traceSetContext->traces[refFreqTrace]->t->freq_scale;
224 t->start_time_from_tsc =
225 ltt_time_from_uint64(tsc_to_uint64(t->freq_scale, t->start_freq,
226 t->drift * t->start_tsc + t->offset));
227 }
228
229 g_array_free(factors, TRUE);
230
231 lttv_traceset_context_compute_time_span(processingData->traceSetContext,
232 &processingData->traceSetContext->time_span);
233
234 g_debug("traceset start %ld.%09ld end %ld.%09ld\n",
235 processingData->traceSetContext->time_span.start_time.tv_sec,
236 processingData->traceSetContext->time_span.start_time.tv_nsec,
237 processingData->traceSetContext->time_span.end_time.tv_sec,
238 processingData->traceSetContext->time_span.end_time.tv_nsec);
70407e86
BP
239}
240
241
242/*
d6ee5003
BP
243 * Print statistics related to processing Must be called after
244 * finalizeProcessing.
70407e86
BP
245 *
246 * Args:
247 * syncState container for synchronization data.
248 */
249static void printProcessingStatsLTTVStandard(SyncState* const syncState)
250{
70407e86
BP
251 ProcessingDataLTTVStandard* processingData;
252
253 if (!syncState->stats)
254 {
255 return;
256 }
257
258 processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
259
260 printf("LTTV processing stats:\n");
261 printf("\treceived frames: %d\n", processingData->stats->totRecv);
262 printf("\treceived frames that are IP: %d\n",
263 processingData->stats->totRecvIp);
f6691532
BP
264 if (syncState->matchingModule->canMatch[TCP])
265 {
266 printf("\treceived and processed packets that are TCP: %d\n",
267 processingData->stats->totRecvTCP);
268 }
269 if (syncState->matchingModule->canMatch[UDP])
270 {
271 printf("\treceived and processed packets that are UDP: %d\n",
272 processingData->stats->totRecvUDP);
273 }
274 if (syncState->matchingModule->canMatch[TCP])
275 {
276 printf("\tsent packets that are TCP: %d\n",
277 processingData->stats->totOutE);
278 }
70407e86
BP
279}
280
281
282/*
283 * Unregister event hooks. Deallocate processingData.
284 *
285 * Args:
286 * syncState: container for synchronization data.
287 * This function deallocates these processingData members:
288 * stats
289 */
290static void destroyProcessingLTTVStandard(SyncState* const syncState)
291{
292 ProcessingDataLTTVStandard* processingData;
293
294 processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
295
296 if (processingData == NULL)
297 {
298 return;
299 }
300
301 partialDestroyProcessingLTTVStandard(syncState);
302
303 if (syncState->stats)
304 {
305 free(processingData->stats);
306 }
307
1633c5a5
BP
308 if (syncState->graphsStream)
309 {
310 free(processingData->graphs);
311 }
312
70407e86
BP
313 free(syncState->processingData);
314 syncState->processingData= NULL;
315}
316
317
318/*
319 * Unregister event hooks. Deallocate some of processingData.
320 *
321 * This function can be called right after the events have been processed to
322 * free some data structures that are not needed for finalization.
323 *
324 * Args:
325 * syncState: container for synchronization data.
326 * This function deallocates these members:
327 * traceNumTable
328 * hookListList
329 * pendingRecv
330 */
331static void partialDestroyProcessingLTTVStandard(SyncState* const syncState)
332{
333 unsigned int i;
334 ProcessingDataLTTVStandard* processingData;
335
336 processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
337
338 if (processingData == NULL || processingData->traceNumTable == NULL)
339 {
340 return;
341 }
342
343 g_hash_table_destroy(processingData->traceNumTable);
344 processingData->traceNumTable= NULL;
345
346 for(i= 0; i < syncState->traceNb; i++)
347 {
348
349 g_debug("Cleaning up pendingRecv list\n");
350 g_hash_table_destroy(processingData->pendingRecv[i]);
351 }
352 free(processingData->pendingRecv);
353
354 unregisterHooks(processingData->hookListList,
08365995 355 processingData->traceSetContext);
70407e86
BP
356}
357
358
359/*
360 * Lttv hook function that will be called for network events
361 *
362 * Args:
363 * hookData: LttvTraceHook* for the type of event that generated the call
364 * callData: LttvTracefileContext* at the moment of the event
365 *
366 * Returns:
367 * FALSE Always returns FALSE, meaning to keep processing hooks for
368 * this event
369 */
370static gboolean processEventLTTVStandard(void* hookData, void* callData)
371{
372 LttvTraceHook* traceHook;
373 LttvTracefileContext* tfc;
374 LttEvent* event;
70407e86 375 LttCycleCount tsc;
76be6fc2
BP
376 LttTime time;
377 WallTime wTime;
70407e86
BP
378 LttTrace* trace;
379 unsigned long traceNum;
380 struct marker_info* info;
381 SyncState* syncState;
382 ProcessingDataLTTVStandard* processingData;
383
384 traceHook= (LttvTraceHook*) hookData;
385 tfc= (LttvTracefileContext*) callData;
9a9ca632 386 trace= tfc->t_context->t;
70407e86
BP
387 syncState= (SyncState*) traceHook->hook_data;
388 processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
389 event= ltt_tracefile_get_event(tfc->tf);
70407e86 390 info= marker_get_info_from_id(tfc->tf->mdata, event->event_id);
76be6fc2
BP
391 tsc= ltt_event_cycle_count(event);
392 time= ltt_event_time(event);
393 wTime.seconds= time.tv_sec;
394 wTime.nanosec= time.tv_nsec;
70407e86
BP
395
396 g_assert(g_hash_table_lookup_extended(processingData->traceNumTable,
397 trace, NULL, (gpointer*) &traceNum));
398
399 g_debug("XXXX process event: time: %ld.%09ld trace: %ld (%p) name: %s ",
76be6fc2 400 time.tv_sec, time.tv_nsec, traceNum, trace,
70407e86
BP
401 g_quark_to_string(info->name));
402
fea7219b 403 if (info->name == LTT_EVENT_DEV_XMIT_EXTENDED)
70407e86 404 {
10341d26 405 Event* outE;
70407e86
BP
406
407 if (!ltt_event_get_unsigned(event,
408 lttv_trace_get_hook_field(traceHook, 1)) == ETH_P_IP ||
409 !ltt_event_get_unsigned(event,
410 lttv_trace_get_hook_field(traceHook, 2)) == IPPROTO_TCP)
411 {
412 return FALSE;
413 }
414
f6691532
BP
415 if (!syncState->matchingModule->canMatch[TCP])
416 {
417 return FALSE;
418 }
419
70407e86
BP
420 if (syncState->stats)
421 {
422 processingData->stats->totOutE++;
423 }
424
10341d26 425 outE= malloc(sizeof(Event));
70407e86 426 outE->traceNum= traceNum;
76be6fc2
BP
427 outE->cpuTime= tsc;
428 outE->wallTime= wTime;
10341d26 429 outE->type= TCP;
d4721e1a 430 outE->copy= &copyTCPEvent;
10341d26
BP
431 outE->destroy= &destroyTCPEvent;
432 outE->event.tcpEvent= malloc(sizeof(TCPEvent));
433 outE->event.tcpEvent->direction= OUT;
434 outE->event.tcpEvent->segmentKey= malloc(sizeof(SegmentKey));
435 outE->event.tcpEvent->segmentKey->connectionKey.saddr=
d4721e1a
BP
436 htonl(ltt_event_get_unsigned(event,
437 lttv_trace_get_hook_field(traceHook, 3)));
10341d26 438 outE->event.tcpEvent->segmentKey->connectionKey.daddr=
d4721e1a
BP
439 htonl(ltt_event_get_unsigned(event,
440 lttv_trace_get_hook_field(traceHook, 4)));
10341d26
BP
441 outE->event.tcpEvent->segmentKey->tot_len=
442 ltt_event_get_unsigned(event, lttv_trace_get_hook_field(traceHook,
443 5));
444 outE->event.tcpEvent->segmentKey->ihl= ltt_event_get_unsigned(event,
70407e86 445 lttv_trace_get_hook_field(traceHook, 6));
10341d26
BP
446 outE->event.tcpEvent->segmentKey->connectionKey.source=
447 ltt_event_get_unsigned(event, lttv_trace_get_hook_field(traceHook,
448 7));
449 outE->event.tcpEvent->segmentKey->connectionKey.dest=
450 ltt_event_get_unsigned(event, lttv_trace_get_hook_field(traceHook,
451 8));
452 outE->event.tcpEvent->segmentKey->seq= ltt_event_get_unsigned(event,
70407e86 453 lttv_trace_get_hook_field(traceHook, 9));
10341d26
BP
454 outE->event.tcpEvent->segmentKey->ack_seq=
455 ltt_event_get_unsigned(event, lttv_trace_get_hook_field(traceHook,
456 10));
457 outE->event.tcpEvent->segmentKey->doff= ltt_event_get_unsigned(event,
70407e86 458 lttv_trace_get_hook_field(traceHook, 11));
10341d26 459 outE->event.tcpEvent->segmentKey->ack= ltt_event_get_unsigned(event,
70407e86 460 lttv_trace_get_hook_field(traceHook, 12));
10341d26 461 outE->event.tcpEvent->segmentKey->rst= ltt_event_get_unsigned(event,
70407e86 462 lttv_trace_get_hook_field(traceHook, 13));
10341d26 463 outE->event.tcpEvent->segmentKey->syn= ltt_event_get_unsigned(event,
70407e86 464 lttv_trace_get_hook_field(traceHook, 14));
10341d26 465 outE->event.tcpEvent->segmentKey->fin= ltt_event_get_unsigned(event,
70407e86
BP
466 lttv_trace_get_hook_field(traceHook, 15));
467
10341d26 468 syncState->matchingModule->matchEvent(syncState, outE);
70407e86
BP
469
470 g_debug("Output event done\n");
471 }
472 else if (info->name == LTT_EVENT_DEV_RECEIVE)
473 {
474 guint32 protocol;
475
476 if (syncState->stats)
477 {
478 processingData->stats->totRecv++;
479 }
480
481 protocol= ltt_event_get_unsigned(event,
482 lttv_trace_get_hook_field(traceHook, 1));
483
484 if (protocol == ETH_P_IP)
485 {
10341d26
BP
486 Event* inE;
487 void* skb;
70407e86
BP
488
489 if (syncState->stats)
490 {
491 processingData->stats->totRecvIp++;
492 }
493
10341d26 494 inE= malloc(sizeof(Event));
70407e86 495 inE->traceNum= traceNum;
76be6fc2
BP
496 inE->cpuTime= tsc;
497 inE->wallTime= wTime;
10341d26 498 inE->event.tcpEvent= NULL;
d4721e1a 499 inE->copy= &copyEvent;
10341d26 500 inE->destroy= &destroyEvent;
70407e86 501
10341d26
BP
502 skb= (void*) (long) ltt_event_get_long_unsigned(event,
503 lttv_trace_get_hook_field(traceHook, 0));
504 g_hash_table_replace(processingData->pendingRecv[traceNum], skb,
505 inE);
70407e86 506
10341d26 507 g_debug("Adding inE %p for skb %p to pendingRecv\n", inE, skb);
70407e86
BP
508 }
509 else
510 {
511 g_debug("\n");
512 }
513 }
fea7219b 514 else if (info->name == LTT_EVENT_TCPV4_RCV_EXTENDED)
70407e86 515 {
10341d26 516 Event* inE;
70407e86
BP
517 void* skb;
518
519 // Search pendingRecv for an event with the same skb
520 skb= (void*) (long) ltt_event_get_long_unsigned(event,
521 lttv_trace_get_hook_field(traceHook, 0));
522
10341d26 523 inE= (Event*)
70407e86
BP
524 g_hash_table_lookup(processingData->pendingRecv[traceNum], skb);
525 if (inE == NULL)
526 {
527 // This should only happen in case of lost events
f6691532 528 g_warning("No matching pending receive event found");
70407e86
BP
529 }
530 else
531 {
532 if (syncState->stats)
533 {
f6691532 534 processingData->stats->totRecvTCP++;
70407e86
BP
535 }
536
537 // If it's there, remove it and proceed with a receive event
538 g_hash_table_steal(processingData->pendingRecv[traceNum], skb);
539
10341d26
BP
540 inE->type= TCP;
541 inE->event.tcpEvent= malloc(sizeof(TCPEvent));
d4721e1a 542 inE->copy= &copyTCPEvent;
10341d26
BP
543 inE->destroy= &destroyTCPEvent;
544 inE->event.tcpEvent->direction= IN;
545 inE->event.tcpEvent->segmentKey= malloc(sizeof(SegmentKey));
546 inE->event.tcpEvent->segmentKey->connectionKey.saddr=
d4721e1a
BP
547 htonl(ltt_event_get_unsigned(event,
548 lttv_trace_get_hook_field(traceHook, 1)));
10341d26 549 inE->event.tcpEvent->segmentKey->connectionKey.daddr=
d4721e1a
BP
550 htonl(ltt_event_get_unsigned(event,
551 lttv_trace_get_hook_field(traceHook, 2)));
10341d26
BP
552 inE->event.tcpEvent->segmentKey->tot_len=
553 ltt_event_get_unsigned(event,
554 lttv_trace_get_hook_field(traceHook, 3));
555 inE->event.tcpEvent->segmentKey->ihl=
556 ltt_event_get_unsigned(event,
557 lttv_trace_get_hook_field(traceHook, 4));
558 inE->event.tcpEvent->segmentKey->connectionKey.source=
559 ltt_event_get_unsigned(event,
560 lttv_trace_get_hook_field(traceHook, 5));
561 inE->event.tcpEvent->segmentKey->connectionKey.dest=
562 ltt_event_get_unsigned(event,
563 lttv_trace_get_hook_field(traceHook, 6));
564 inE->event.tcpEvent->segmentKey->seq=
565 ltt_event_get_unsigned(event,
566 lttv_trace_get_hook_field(traceHook, 7));
567 inE->event.tcpEvent->segmentKey->ack_seq=
568 ltt_event_get_unsigned(event,
569 lttv_trace_get_hook_field(traceHook, 8));
570 inE->event.tcpEvent->segmentKey->doff=
571 ltt_event_get_unsigned(event,
572 lttv_trace_get_hook_field(traceHook, 9));
573 inE->event.tcpEvent->segmentKey->ack=
574 ltt_event_get_unsigned(event,
575 lttv_trace_get_hook_field(traceHook, 10));
576 inE->event.tcpEvent->segmentKey->rst=
577 ltt_event_get_unsigned(event,
578 lttv_trace_get_hook_field(traceHook, 11));
579 inE->event.tcpEvent->segmentKey->syn=
580 ltt_event_get_unsigned(event,
581 lttv_trace_get_hook_field(traceHook, 12));
582 inE->event.tcpEvent->segmentKey->fin=
583 ltt_event_get_unsigned(event,
584 lttv_trace_get_hook_field(traceHook, 13));
585
586 syncState->matchingModule->matchEvent(syncState, inE);
70407e86 587
f6691532 588 g_debug("TCP input event %p for skb %p done\n", inE, skb);
70407e86
BP
589 }
590 }
f6691532 591 else if (info->name == LTT_EVENT_UDPV4_RCV_EXTENDED)
70407e86 592 {
f6691532
BP
593 Event* inE;
594 void* skb;
70407e86 595
f6691532
BP
596 // Search pendingRecv for an event with the same skb
597 skb= (void*) (long) ltt_event_get_long_unsigned(event,
598 lttv_trace_get_hook_field(traceHook, 0));
70407e86 599
f6691532
BP
600 inE= (Event*)
601 g_hash_table_lookup(processingData->pendingRecv[traceNum], skb);
602 if (inE == NULL)
603 {
604 // This should only happen in case of lost events
605 g_warning("No matching pending receive event found");
606 }
607 else
608 {
609 guint64 dataStart;
70407e86 610
f6691532
BP
611 if (syncState->stats)
612 {
613 processingData->stats->totRecvUDP++;
614 }
615
616 // If it's there, remove it and proceed with a receive event
617 g_hash_table_steal(processingData->pendingRecv[traceNum], skb);
618
619 inE->type= UDP;
620 inE->event.udpEvent= malloc(sizeof(UDPEvent));
d4721e1a 621 inE->copy= &copyUDPEvent;
f6691532
BP
622 inE->destroy= &destroyUDPEvent;
623 inE->event.udpEvent->direction= IN;
624 inE->event.udpEvent->datagramKey= malloc(sizeof(DatagramKey));
625 inE->event.udpEvent->datagramKey->saddr=
d4721e1a
BP
626 htonl(ltt_event_get_unsigned(event,
627 lttv_trace_get_hook_field(traceHook, 1)));
f6691532 628 inE->event.udpEvent->datagramKey->daddr=
d4721e1a
BP
629 htonl(ltt_event_get_unsigned(event,
630 lttv_trace_get_hook_field(traceHook, 2)));
f6691532
BP
631 inE->event.udpEvent->unicast= ltt_event_get_unsigned(event,
632 lttv_trace_get_hook_field(traceHook, 3)) == 0 ? false : true;
633 inE->event.udpEvent->datagramKey->ulen=
634 ltt_event_get_unsigned(event,
635 lttv_trace_get_hook_field(traceHook, 4));
636 inE->event.udpEvent->datagramKey->source=
637 ltt_event_get_unsigned(event,
638 lttv_trace_get_hook_field(traceHook, 5));
639 inE->event.udpEvent->datagramKey->dest=
640 ltt_event_get_unsigned(event,
641 lttv_trace_get_hook_field(traceHook, 6));
642 dataStart= ltt_event_get_long_unsigned(event,
643 lttv_trace_get_hook_field(traceHook, 7));
644 g_assert_cmpuint(sizeof(inE->event.udpEvent->datagramKey->dataKey),
645 ==, sizeof(guint64));
646 if (inE->event.udpEvent->datagramKey->ulen - 8 >=
647 sizeof(inE->event.udpEvent->datagramKey->dataKey))
648 {
649 memcpy(inE->event.udpEvent->datagramKey->dataKey, &dataStart,
650 sizeof(inE->event.udpEvent->datagramKey->dataKey));
651 }
652 else
653 {
654 memset(inE->event.udpEvent->datagramKey->dataKey, 0,
655 sizeof(inE->event.udpEvent->datagramKey->dataKey));
656 memcpy(inE->event.udpEvent->datagramKey->dataKey, &dataStart,
657 inE->event.udpEvent->datagramKey->ulen - 8);
658 }
659
660 syncState->matchingModule->matchEvent(syncState, inE);
661
662 g_debug("UDP input event %p for skb %p done\n", inE, skb);
663 }
70407e86
BP
664 }
665 else
666 {
667 g_assert_not_reached();
668 }
669
670 return FALSE;
671}
08365995
BP
672
673
674/*
d6ee5003 675 * Write the processing-specific options in the gnuplot script.
08365995
BP
676 *
677 * Args:
08365995
BP
678 * syncState: container for synchronization data
679 * i: first trace number
680 * j: second trace number, garanteed to be larger than i
681 */
8d7d16dd
BP
682static void writeProcessingGraphsOptionsLTTVStandard(SyncState* const
683 syncState, const unsigned int i, const unsigned int j)
08365995
BP
684{
685 ProcessingDataLTTVStandard* processingData;
1633c5a5 686 ProcessingGraphsLTTVStandard* traceI, * traceJ;
08365995
BP
687
688 processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
689
1633c5a5
BP
690 traceI= &processingData->graphs[i];
691 traceJ= &processingData->graphs[j];
08365995 692
8d7d16dd 693 fprintf(syncState->graphsStream,
d6ee5003
BP
694 "set key inside right bottom\n"
695 "set xlabel \"Clock %1$u\"\n"
696 "set xtics nomirror\n"
697 "set ylabel \"Clock %3$u\"\n"
698 "set ytics nomirror\n"
08365995
BP
699 "set x2label \"Clock %1$d (s)\"\n"
700 "set x2range [GPVAL_X_MIN / %2$.1f : GPVAL_X_MAX / %2$.1f]\n"
701 "set x2tics\n"
702 "set y2label \"Clock %3$d (s)\"\n"
703 "set y2range [GPVAL_Y_MIN / %4$.1f : GPVAL_Y_MAX / %4$.1f]\n"
1633c5a5
BP
704 "set y2tics\n", i, (double) traceI->startFreq / traceI->freqScale, j,
705 (double) traceJ->startFreq / traceJ->freqScale);
08365995 706}
This page took 0.050997 seconds and 4 git commands to generate.