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