1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
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;
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.
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,
19 #define _ISOC99_SOURCE
25 #include <linux/if_ether.h>
27 #include <netinet/in.h>
33 #include "sync_chain.h"
34 #include "event_processing_lttng_common.h"
36 #include "event_processing_lttng_standard.h"
39 // Functions common to all processing modules
40 static void initProcessingLTTVStandard(SyncState
* const syncState
, ...);
41 static void destroyProcessingLTTVStandard(SyncState
* const syncState
);
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
);
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
);
58 static ProcessingModule processingModuleLTTVStandard
= {
59 .name
= "LTTV-standard",
60 .initProcessing
= &initProcessingLTTVStandard
,
61 .destroyProcessing
= &destroyProcessingLTTVStandard
,
62 .finalizeProcessing
= &finalizeProcessingLTTVStandard
,
63 .printProcessingStats
= &printProcessingStatsLTTVStandard
,
65 .writeVariables
= &writeProcessingGraphVariablesLTTVStandard
,
66 .writeTraceTraceOptions
= &writeProcessingTraceTraceOptionsLTTVStandard
,
67 .writeTraceTimeOptions
= &writeProcessingTraceTimeOptionsLTTVStandard
,
73 * Processing Module registering function
75 static void registerProcessingLTTVStandard()
77 g_queue_push_tail(&processingModules
, &processingModuleLTTVStandard
);
84 * Allocate and initialize data structures for synchronizing a traceset.
85 * Register event hooks.
88 * syncState: container for synchronization data.
89 * This function allocates these processingData members:
94 * traceSetContext: LttvTracesetContext*, set of LTTV traces
96 static void initProcessingLTTVStandard(SyncState
* const syncState
, ...)
99 ProcessingDataLTTVStandard
* processingData
;
102 processingData
= malloc(sizeof(ProcessingDataLTTVStandard
));
103 syncState
->processingData
= processingData
;
104 va_start(ap
, syncState
);
105 processingData
->traceSetContext
= va_arg(ap
, LttvTracesetContext
*);
108 lttv_traceset_number(processingData
->traceSetContext
->ts
);
109 processingData
->hookListList
= g_array_sized_new(FALSE
, FALSE
,
110 sizeof(GArray
*), syncState
->traceNb
);
112 processingData
->traceNumTable
= g_hash_table_new(&g_direct_hash
, NULL
);
113 for(i
= 0; i
< syncState
->traceNb
; i
++)
115 g_hash_table_insert(processingData
->traceNumTable
,
116 processingData
->traceSetContext
->traces
[i
]->t
, (gpointer
) i
);
119 processingData
->pendingRecv
= malloc(sizeof(GHashTable
*) *
121 for(i
= 0; i
< syncState
->traceNb
; i
++)
123 processingData
->pendingRecv
[i
]= g_hash_table_new_full(&g_direct_hash
,
124 NULL
, NULL
, &gdnDestroyEvent
);
127 if (syncState
->stats
)
129 processingData
->stats
= calloc(1, sizeof(ProcessingStatsLTTVStandard
));
133 processingData
->stats
= NULL
;
136 if (syncState
->graphsStream
)
138 processingData
->graphs
= malloc(syncState
->traceNb
*
139 sizeof(ProcessingGraphsLTTVStandard
));
141 for(i
= 0; i
< syncState
->traceNb
; i
++)
143 LttTrace
* traceI
= processingData
->traceSetContext
->traces
[i
]->t
;
145 processingData
->graphs
[i
].startFreq
= traceI
->start_freq
;
146 processingData
->graphs
[i
].freqScale
= traceI
->freq_scale
;
151 processingData
->graphs
= NULL
;
154 registerHooks(processingData
->hookListList
,
155 processingData
->traceSetContext
, &processEventLTTVStandard
, syncState
,
156 syncState
->matchingModule
->canMatch
);
161 * Call the partial processing destroyer, obtain and adjust the factors from
165 * syncState container for synchronization data.
167 static void finalizeProcessingLTTVStandard(SyncState
* const syncState
)
171 double minOffset
, minDrift
;
172 unsigned int refFreqTrace
;
173 ProcessingDataLTTVStandard
* processingData
;
175 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
177 partialDestroyProcessingLTTVStandard(syncState
);
179 factors
= syncState
->matchingModule
->finalizeMatching(syncState
);
181 /* The offsets are adjusted so the lowest one is 0. This is done because
182 * of a Lttv specific limitation: events cannot have negative times. By
183 * having non-negative offsets, events cannot be moved backwards to
187 for (i
= 0; i
< syncState
->traceNb
; i
++)
189 minOffset
= MIN(g_array_index(factors
, Factors
, i
).offset
, minOffset
);
192 for (i
= 0; i
< syncState
->traceNb
; i
++)
194 g_array_index(factors
, Factors
, i
).offset
-= minOffset
;
197 /* Because the timestamps are corrected at the TSC level (not at the
198 * LttTime level) all trace frequencies must be made equal. We choose to
199 * use the frequency of the system with the lowest drift
203 for (i
= 0; i
< syncState
->traceNb
; i
++)
205 if (g_array_index(factors
, Factors
, i
).drift
< minDrift
)
207 minDrift
= g_array_index(factors
, Factors
, i
).drift
;
211 g_assert(syncState
->traceNb
== 0 || minDrift
!= INFINITY
);
213 // Write the factors to the LttTrace structures
214 for (i
= 0; i
< syncState
->traceNb
; i
++)
217 Factors
* traceFactors
;
219 t
= processingData
->traceSetContext
->traces
[i
]->t
;
220 traceFactors
= &g_array_index(factors
, Factors
, i
);
222 t
->drift
= traceFactors
->drift
;
223 t
->offset
= traceFactors
->offset
;
225 processingData
->traceSetContext
->traces
[refFreqTrace
]->t
->start_freq
;
227 processingData
->traceSetContext
->traces
[refFreqTrace
]->t
->freq_scale
;
228 t
->start_time_from_tsc
=
229 ltt_time_from_uint64(tsc_to_uint64(t
->freq_scale
, t
->start_freq
,
230 t
->drift
* t
->start_tsc
+ t
->offset
));
233 g_array_free(factors
, TRUE
);
235 lttv_traceset_context_compute_time_span(processingData
->traceSetContext
,
236 &processingData
->traceSetContext
->time_span
);
238 g_debug("traceset start %ld.%09ld end %ld.%09ld",
239 processingData
->traceSetContext
->time_span
.start_time
.tv_sec
,
240 processingData
->traceSetContext
->time_span
.start_time
.tv_nsec
,
241 processingData
->traceSetContext
->time_span
.end_time
.tv_sec
,
242 processingData
->traceSetContext
->time_span
.end_time
.tv_nsec
);
247 * Print statistics related to processing Must be called after
248 * finalizeProcessing.
251 * syncState container for synchronization data.
253 static void printProcessingStatsLTTVStandard(SyncState
* const syncState
)
255 ProcessingDataLTTVStandard
* processingData
;
257 if (!syncState
->stats
)
262 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
264 printf("LTTV processing stats:\n");
265 printf("\treceived frames: %d\n", processingData
->stats
->totRecv
);
266 printf("\treceived frames that are IP: %d\n",
267 processingData
->stats
->totRecvIp
);
268 if (syncState
->matchingModule
->canMatch
[TCP
])
270 printf("\treceived and processed packets that are TCP: %d\n",
271 processingData
->stats
->totRecvTCP
);
273 if (syncState
->matchingModule
->canMatch
[UDP
])
275 printf("\treceived and processed packets that are UDP: %d\n",
276 processingData
->stats
->totRecvUDP
);
278 if (syncState
->matchingModule
->canMatch
[TCP
])
280 printf("\tsent packets that are TCP: %d\n",
281 processingData
->stats
->totOutE
);
287 * Unregister event hooks. Deallocate processingData.
290 * syncState: container for synchronization data.
291 * This function deallocates these processingData members:
294 static void destroyProcessingLTTVStandard(SyncState
* const syncState
)
296 ProcessingDataLTTVStandard
* processingData
;
298 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
300 if (processingData
== NULL
)
305 partialDestroyProcessingLTTVStandard(syncState
);
307 if (syncState
->stats
)
309 free(processingData
->stats
);
312 if (syncState
->graphsStream
)
314 free(processingData
->graphs
);
317 free(syncState
->processingData
);
318 syncState
->processingData
= NULL
;
323 * Unregister event hooks. Deallocate some of processingData.
325 * This function can be called right after the events have been processed to
326 * free some data structures that are not needed for finalization.
329 * syncState: container for synchronization data.
330 * This function deallocates these members:
335 static void partialDestroyProcessingLTTVStandard(SyncState
* const syncState
)
338 ProcessingDataLTTVStandard
* processingData
;
340 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
342 if (processingData
== NULL
|| processingData
->traceNumTable
== NULL
)
347 g_hash_table_destroy(processingData
->traceNumTable
);
348 processingData
->traceNumTable
= NULL
;
350 for(i
= 0; i
< syncState
->traceNb
; i
++)
353 g_debug("Cleaning up pendingRecv list");
354 g_hash_table_destroy(processingData
->pendingRecv
[i
]);
356 free(processingData
->pendingRecv
);
358 unregisterHooks(processingData
->hookListList
,
359 processingData
->traceSetContext
);
364 * Lttv hook function that will be called for network events
367 * hookData: LttvTraceHook* for the type of event that generated the call
368 * callData: LttvTracefileContext* at the moment of the event
371 * FALSE Always returns FALSE, meaning to keep processing hooks for
374 static gboolean
processEventLTTVStandard(void* hookData
, void* callData
)
376 LttvTraceHook
* traceHook
;
377 LttvTracefileContext
* tfc
;
383 unsigned long traceNum
;
384 struct marker_info
* info
;
385 SyncState
* syncState
;
386 ProcessingDataLTTVStandard
* processingData
;
388 traceHook
= (LttvTraceHook
*) hookData
;
389 tfc
= (LttvTracefileContext
*) callData
;
390 trace
= tfc
->t_context
->t
;
391 syncState
= (SyncState
*) traceHook
->hook_data
;
392 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
393 event
= ltt_tracefile_get_event(tfc
->tf
);
394 info
= marker_get_info_from_id(tfc
->tf
->mdata
, event
->event_id
);
395 tsc
= ltt_event_cycle_count(event
);
396 time
= ltt_event_time(event
);
397 wTime
.seconds
= time
.tv_sec
;
398 wTime
.nanosec
= time
.tv_nsec
;
400 g_assert(g_hash_table_lookup_extended(processingData
->traceNumTable
,
401 trace
, NULL
, (gpointer
*) &traceNum
));
403 g_debug("Process event: time: %ld.%09ld trace: %ld (%p) name: %s ",
404 time
.tv_sec
, time
.tv_nsec
, traceNum
, trace
,
405 g_quark_to_string(info
->name
));
407 if (info
->name
== LTT_EVENT_DEV_XMIT_EXTENDED
)
411 if (!ltt_event_get_unsigned(event
,
412 lttv_trace_get_hook_field(traceHook
, 1)) == ETH_P_IP
||
413 !ltt_event_get_unsigned(event
,
414 lttv_trace_get_hook_field(traceHook
, 2)) == IPPROTO_TCP
)
419 if (!syncState
->matchingModule
->canMatch
[TCP
])
424 if (syncState
->stats
)
426 processingData
->stats
->totOutE
++;
429 outE
= malloc(sizeof(Event
));
430 outE
->traceNum
= traceNum
;
432 outE
->wallTime
= wTime
;
434 outE
->copy
= ©TCPEvent
;
435 outE
->destroy
= &destroyTCPEvent
;
436 outE
->event
.tcpEvent
= malloc(sizeof(TCPEvent
));
437 outE
->event
.tcpEvent
->direction
= OUT
;
438 outE
->event
.tcpEvent
->segmentKey
= malloc(sizeof(SegmentKey
));
439 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.saddr
=
440 htonl(ltt_event_get_unsigned(event
,
441 lttv_trace_get_hook_field(traceHook
, 3)));
442 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.daddr
=
443 htonl(ltt_event_get_unsigned(event
,
444 lttv_trace_get_hook_field(traceHook
, 4)));
445 outE
->event
.tcpEvent
->segmentKey
->tot_len
=
446 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
448 outE
->event
.tcpEvent
->segmentKey
->ihl
= ltt_event_get_unsigned(event
,
449 lttv_trace_get_hook_field(traceHook
, 6));
450 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.source
=
451 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
453 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.dest
=
454 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
456 outE
->event
.tcpEvent
->segmentKey
->seq
= ltt_event_get_unsigned(event
,
457 lttv_trace_get_hook_field(traceHook
, 9));
458 outE
->event
.tcpEvent
->segmentKey
->ack_seq
=
459 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
461 outE
->event
.tcpEvent
->segmentKey
->doff
= ltt_event_get_unsigned(event
,
462 lttv_trace_get_hook_field(traceHook
, 11));
463 outE
->event
.tcpEvent
->segmentKey
->ack
= ltt_event_get_unsigned(event
,
464 lttv_trace_get_hook_field(traceHook
, 12));
465 outE
->event
.tcpEvent
->segmentKey
->rst
= ltt_event_get_unsigned(event
,
466 lttv_trace_get_hook_field(traceHook
, 13));
467 outE
->event
.tcpEvent
->segmentKey
->syn
= ltt_event_get_unsigned(event
,
468 lttv_trace_get_hook_field(traceHook
, 14));
469 outE
->event
.tcpEvent
->segmentKey
->fin
= ltt_event_get_unsigned(event
,
470 lttv_trace_get_hook_field(traceHook
, 15));
472 syncState
->matchingModule
->matchEvent(syncState
, outE
);
474 g_debug("Output event done");
476 else if (info
->name
== LTT_EVENT_DEV_RECEIVE
)
480 if (syncState
->stats
)
482 processingData
->stats
->totRecv
++;
485 protocol
= ltt_event_get_unsigned(event
,
486 lttv_trace_get_hook_field(traceHook
, 1));
488 if (protocol
== ETH_P_IP
)
493 if (syncState
->stats
)
495 processingData
->stats
->totRecvIp
++;
498 inE
= malloc(sizeof(Event
));
499 inE
->traceNum
= traceNum
;
501 inE
->wallTime
= wTime
;
502 inE
->event
.tcpEvent
= NULL
;
503 inE
->copy
= ©Event
;
504 inE
->destroy
= &destroyEvent
;
506 skb
= (void*) (long) ltt_event_get_long_unsigned(event
,
507 lttv_trace_get_hook_field(traceHook
, 0));
508 g_hash_table_replace(processingData
->pendingRecv
[traceNum
], skb
,
511 g_debug("Adding inE %p for skb %p to pendingRecv", inE
, skb
);
514 else if (info
->name
== LTT_EVENT_TCPV4_RCV_EXTENDED
)
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));
524 g_hash_table_lookup(processingData
->pendingRecv
[traceNum
], skb
);
527 // This should only happen in case of lost events
528 g_warning("No matching pending receive event found");
532 if (syncState
->stats
)
534 processingData
->stats
->totRecvTCP
++;
537 // If it's there, remove it and proceed with a receive event
538 g_hash_table_steal(processingData
->pendingRecv
[traceNum
], skb
);
541 inE
->event
.tcpEvent
= malloc(sizeof(TCPEvent
));
542 inE
->copy
= ©TCPEvent
;
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
=
547 htonl(ltt_event_get_unsigned(event
,
548 lttv_trace_get_hook_field(traceHook
, 1)));
549 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.daddr
=
550 htonl(ltt_event_get_unsigned(event
,
551 lttv_trace_get_hook_field(traceHook
, 2)));
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));
586 syncState
->matchingModule
->matchEvent(syncState
, inE
);
588 g_debug("TCP input event %p for skb %p done", inE
, skb
);
591 else if (info
->name
== LTT_EVENT_UDPV4_RCV_EXTENDED
)
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));
601 g_hash_table_lookup(processingData
->pendingRecv
[traceNum
], skb
);
604 // This should only happen in case of lost events
605 g_warning("No matching pending receive event found");
611 if (syncState
->stats
)
613 processingData
->stats
->totRecvUDP
++;
616 // If it's there, remove it and proceed with a receive event
617 g_hash_table_steal(processingData
->pendingRecv
[traceNum
], skb
);
620 inE
->event
.udpEvent
= malloc(sizeof(UDPEvent
));
621 inE
->copy
= ©UDPEvent
;
622 inE
->destroy
= &destroyUDPEvent
;
623 inE
->event
.udpEvent
->direction
= IN
;
624 inE
->event
.udpEvent
->datagramKey
= malloc(sizeof(DatagramKey
));
625 inE
->event
.udpEvent
->datagramKey
->saddr
=
626 htonl(ltt_event_get_unsigned(event
,
627 lttv_trace_get_hook_field(traceHook
, 1)));
628 inE
->event
.udpEvent
->datagramKey
->daddr
=
629 htonl(ltt_event_get_unsigned(event
,
630 lttv_trace_get_hook_field(traceHook
, 2)));
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
))
649 memcpy(inE
->event
.udpEvent
->datagramKey
->dataKey
, &dataStart
,
650 sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
));
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);
660 syncState
->matchingModule
->matchEvent(syncState
, inE
);
662 g_debug("UDP input event %p for skb %p done", inE
, skb
);
667 g_assert_not_reached();
675 * Write the processing-specific variables in the gnuplot script.
678 * syncState: container for synchronization data
681 static void writeProcessingGraphVariablesLTTVStandard(SyncState
* const
682 syncState
, const unsigned int i
)
684 ProcessingDataLTTVStandard
* processingData
= syncState
->processingData
;
685 ProcessingGraphsLTTVStandard
* traceI
= &processingData
->graphs
[i
];
687 fprintf(syncState
->graphsStream
, "clock_freq_%u= %.3f\n", i
, (double)
688 traceI
->startFreq
/ traceI
->freqScale
);
693 * Write the processing-specific options in the gnuplot script.
696 * syncState: container for synchronization data
697 * i: first trace number
698 * j: second trace number, garanteed to be larger than i
700 static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState
* const
701 syncState
, const unsigned int i
, const unsigned int j
)
703 ProcessingDataLTTVStandard
* processingData
;
704 ProcessingGraphsLTTVStandard
* traceI
, * traceJ
;
706 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
708 traceI
= &processingData
->graphs
[i
];
709 traceJ
= &processingData
->graphs
[j
];
711 fprintf(syncState
->graphsStream
,
712 "set key inside right bottom\n"
713 "set xlabel \"Clock %1$u\"\n"
714 "set xtics nomirror\n"
715 "set ylabel \"Clock %2$u\"\n"
716 "set ytics nomirror\n"
717 "set x2label \"Clock %1$d (s)\"\n"
718 "set x2range [GPVAL_X_MIN / clock_freq_%1$u : GPVAL_X_MAX / clock_freq_%1$u]\n"
720 "set y2label \"Clock %2$d (s)\"\n"
721 "set y2range [GPVAL_Y_MIN / clock_freq_%2$u : GPVAL_Y_MAX / clock_freq_%2$u]\n"
722 "set y2tics\n", i
, j
);
727 * Write the processing-specific options in the gnuplot script.
730 * syncState: container for synchronization data
731 * i: first trace number
732 * j: second trace number, garanteed to be larger than i
734 static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState
* const
735 syncState
, const unsigned int i
, const unsigned int j
)
737 ProcessingDataLTTVStandard
* processingData
;
738 ProcessingGraphsLTTVStandard
* traceI
, * traceJ
;
740 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
742 traceI
= &processingData
->graphs
[i
];
743 traceJ
= &processingData
->graphs
[j
];
745 fprintf(syncState
->graphsStream
,
746 "set key inside right bottom\n"
747 "set xlabel \"Clock %1$u\"\n"
748 "set xtics nomirror\n"
749 "set ylabel \"time (s)\"\n"
750 "set ytics nomirror\n"
751 "set x2label \"Clock %1$d (s)\"\n"
752 "set x2range [GPVAL_X_MIN / clock_freq_%1$u : GPVAL_X_MAX / clock_freq_%1$u]\n"