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