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>
32 #include "sync_chain.h"
33 #include "event_processing_lttng_common.h"
35 #include "event_processing_lttng_standard.h"
39 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
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
);
48 static void finalizeProcessingLTTVStandard(SyncState
* const syncState
);
49 static void printProcessingStatsLTTVStandard(SyncState
* const syncState
);
50 static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState
* const
51 syncState
, const unsigned int i
, const unsigned int j
);
52 static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState
* const
53 syncState
, const unsigned int i
, const unsigned int j
);
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
);
61 static ProcessingModule processingModuleLTTVStandard
= {
62 .name
= "LTTV-standard",
63 .initProcessing
= &initProcessingLTTVStandard
,
64 .destroyProcessing
= &destroyProcessingLTTVStandard
,
65 .finalizeProcessing
= &finalizeProcessingLTTVStandard
,
66 .printProcessingStats
= &printProcessingStatsLTTVStandard
,
68 .writeTraceTraceOptions
= &writeProcessingTraceTraceOptionsLTTVStandard
,
69 .writeTraceTimeOptions
= &writeProcessingTraceTimeOptionsLTTVStandard
,
75 * Processing Module registering function
77 static void registerProcessingLTTVStandard()
79 g_queue_push_tail(&processingModules
, &processingModuleLTTVStandard
);
86 * Allocate and initialize data structures for synchronizing a traceset.
87 * Register event hooks.
90 * syncState: container for synchronization data.
91 * This function allocates these processingData members:
96 * traceSetContext: set of LTTV traces
98 static void initProcessingLTTVStandard(SyncState
* const syncState
, LttvTracesetContext
*
99 const traceSetContext
)
102 ProcessingDataLTTVStandard
* processingData
;
104 processingData
= malloc(sizeof(ProcessingDataLTTVStandard
));
105 syncState
->processingData
= processingData
;
106 processingData
->traceSetContext
= traceSetContext
;
108 if (syncState
->stats
)
110 processingData
->stats
= calloc(1, sizeof(ProcessingStatsLTTVStandard
));
114 processingData
->stats
= NULL
;
117 processingData
->traceNumTable
= g_hash_table_new(&g_direct_hash
, NULL
);
118 processingData
->hookListList
= g_array_sized_new(FALSE
, FALSE
,
119 sizeof(GArray
*), syncState
->traceNb
);
120 processingData
->pendingRecv
= malloc(sizeof(GHashTable
*) *
123 for(i
= 0; i
< syncState
->traceNb
; i
++)
125 g_hash_table_insert(processingData
->traceNumTable
,
126 processingData
->traceSetContext
->traces
[i
]->t
, (gpointer
) i
);
129 if (syncState
->graphsStream
)
131 processingData
->graphs
= malloc(syncState
->traceNb
*
132 sizeof(ProcessingGraphsLTTVStandard
));
134 for(i
= 0; i
< syncState
->traceNb
; i
++)
136 LttTrace
* traceI
= traceSetContext
->traces
[i
]->t
;
138 processingData
->graphs
[i
].startFreq
= traceI
->start_freq
;
139 processingData
->graphs
[i
].freqScale
= traceI
->freq_scale
;
144 processingData
->graphs
= NULL
;
147 for(i
= 0; i
< syncState
->traceNb
; i
++)
149 processingData
->pendingRecv
[i
]= g_hash_table_new_full(&g_direct_hash
,
150 NULL
, NULL
, &gdnDestroyEvent
);
153 registerHooks(processingData
->hookListList
, traceSetContext
,
154 &processEventLTTVStandard
, syncState
,
155 syncState
->matchingModule
->canMatch
);
160 * Call the partial processing destroyer, obtain and adjust the factors from
164 * syncState container for synchronization data.
166 static void finalizeProcessingLTTVStandard(SyncState
* const syncState
)
170 double minOffset
, minDrift
;
171 unsigned int refFreqTrace
;
172 ProcessingDataLTTVStandard
* processingData
;
174 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
176 partialDestroyProcessingLTTVStandard(syncState
);
178 factors
= syncState
->matchingModule
->finalizeMatching(syncState
);
180 /* The offsets are adjusted so the lowest one is 0. This is done because
181 * of a Lttv specific limitation: events cannot have negative times. By
182 * having non-negative offsets, events cannot be moved backwards to
186 for (i
= 0; i
< syncState
->traceNb
; i
++)
188 minOffset
= MIN(g_array_index(factors
, Factors
, i
).offset
, minOffset
);
191 for (i
= 0; i
< syncState
->traceNb
; i
++)
193 g_array_index(factors
, Factors
, i
).offset
-= minOffset
;
196 /* Because the timestamps are corrected at the TSC level (not at the
197 * LttTime level) all trace frequencies must be made equal. We choose to
198 * use the frequency of the system with the lowest drift
202 for (i
= 0; i
< syncState
->traceNb
; i
++)
204 if (g_array_index(factors
, Factors
, i
).drift
< minDrift
)
206 minDrift
= g_array_index(factors
, Factors
, i
).drift
;
210 g_assert(syncState
->traceNb
== 0 || minDrift
!= INFINITY
);
212 // Write the factors to the LttTrace structures
213 for (i
= 0; i
< syncState
->traceNb
; i
++)
216 Factors
* traceFactors
;
218 t
= processingData
->traceSetContext
->traces
[i
]->t
;
219 traceFactors
= &g_array_index(factors
, Factors
, i
);
221 t
->drift
= traceFactors
->drift
;
222 t
->offset
= traceFactors
->offset
;
224 processingData
->traceSetContext
->traces
[refFreqTrace
]->t
->start_freq
;
226 processingData
->traceSetContext
->traces
[refFreqTrace
]->t
->freq_scale
;
227 t
->start_time_from_tsc
=
228 ltt_time_from_uint64(tsc_to_uint64(t
->freq_scale
, t
->start_freq
,
229 t
->drift
* t
->start_tsc
+ t
->offset
));
232 g_array_free(factors
, TRUE
);
234 lttv_traceset_context_compute_time_span(processingData
->traceSetContext
,
235 &processingData
->traceSetContext
->time_span
);
237 g_debug("traceset start %ld.%09ld end %ld.%09ld\n",
238 processingData
->traceSetContext
->time_span
.start_time
.tv_sec
,
239 processingData
->traceSetContext
->time_span
.start_time
.tv_nsec
,
240 processingData
->traceSetContext
->time_span
.end_time
.tv_sec
,
241 processingData
->traceSetContext
->time_span
.end_time
.tv_nsec
);
246 * Print statistics related to processing Must be called after
247 * finalizeProcessing.
250 * syncState container for synchronization data.
252 static void printProcessingStatsLTTVStandard(SyncState
* const syncState
)
254 ProcessingDataLTTVStandard
* processingData
;
256 if (!syncState
->stats
)
261 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
263 printf("LTTV processing stats:\n");
264 printf("\treceived frames: %d\n", processingData
->stats
->totRecv
);
265 printf("\treceived frames that are IP: %d\n",
266 processingData
->stats
->totRecvIp
);
267 if (syncState
->matchingModule
->canMatch
[TCP
])
269 printf("\treceived and processed packets that are TCP: %d\n",
270 processingData
->stats
->totRecvTCP
);
272 if (syncState
->matchingModule
->canMatch
[UDP
])
274 printf("\treceived and processed packets that are UDP: %d\n",
275 processingData
->stats
->totRecvUDP
);
277 if (syncState
->matchingModule
->canMatch
[TCP
])
279 printf("\tsent packets that are TCP: %d\n",
280 processingData
->stats
->totOutE
);
286 * Unregister event hooks. Deallocate processingData.
289 * syncState: container for synchronization data.
290 * This function deallocates these processingData members:
293 static void destroyProcessingLTTVStandard(SyncState
* const syncState
)
295 ProcessingDataLTTVStandard
* processingData
;
297 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
299 if (processingData
== NULL
)
304 partialDestroyProcessingLTTVStandard(syncState
);
306 if (syncState
->stats
)
308 free(processingData
->stats
);
311 if (syncState
->graphsStream
)
313 free(processingData
->graphs
);
316 free(syncState
->processingData
);
317 syncState
->processingData
= NULL
;
322 * Unregister event hooks. Deallocate some of processingData.
324 * This function can be called right after the events have been processed to
325 * free some data structures that are not needed for finalization.
328 * syncState: container for synchronization data.
329 * This function deallocates these members:
334 static void partialDestroyProcessingLTTVStandard(SyncState
* const syncState
)
337 ProcessingDataLTTVStandard
* processingData
;
339 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
341 if (processingData
== NULL
|| processingData
->traceNumTable
== NULL
)
346 g_hash_table_destroy(processingData
->traceNumTable
);
347 processingData
->traceNumTable
= NULL
;
349 for(i
= 0; i
< syncState
->traceNb
; i
++)
352 g_debug("Cleaning up pendingRecv list\n");
353 g_hash_table_destroy(processingData
->pendingRecv
[i
]);
355 free(processingData
->pendingRecv
);
357 unregisterHooks(processingData
->hookListList
,
358 processingData
->traceSetContext
);
363 * Lttv hook function that will be called for network events
366 * hookData: LttvTraceHook* for the type of event that generated the call
367 * callData: LttvTracefileContext* at the moment of the event
370 * FALSE Always returns FALSE, meaning to keep processing hooks for
373 static gboolean
processEventLTTVStandard(void* hookData
, void* callData
)
375 LttvTraceHook
* traceHook
;
376 LttvTracefileContext
* tfc
;
382 unsigned long traceNum
;
383 struct marker_info
* info
;
384 SyncState
* syncState
;
385 ProcessingDataLTTVStandard
* processingData
;
387 traceHook
= (LttvTraceHook
*) hookData
;
388 tfc
= (LttvTracefileContext
*) callData
;
389 trace
= tfc
->t_context
->t
;
390 syncState
= (SyncState
*) traceHook
->hook_data
;
391 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
392 event
= ltt_tracefile_get_event(tfc
->tf
);
393 info
= marker_get_info_from_id(tfc
->tf
->mdata
, event
->event_id
);
394 tsc
= ltt_event_cycle_count(event
);
395 time
= ltt_event_time(event
);
396 wTime
.seconds
= time
.tv_sec
;
397 wTime
.nanosec
= time
.tv_nsec
;
399 g_assert(g_hash_table_lookup_extended(processingData
->traceNumTable
,
400 trace
, NULL
, (gpointer
*) &traceNum
));
402 g_debug("XXXX process event: time: %ld.%09ld trace: %ld (%p) name: %s ",
403 time
.tv_sec
, time
.tv_nsec
, traceNum
, trace
,
404 g_quark_to_string(info
->name
));
406 if (info
->name
== LTT_EVENT_DEV_XMIT_EXTENDED
)
410 if (!ltt_event_get_unsigned(event
,
411 lttv_trace_get_hook_field(traceHook
, 1)) == ETH_P_IP
||
412 !ltt_event_get_unsigned(event
,
413 lttv_trace_get_hook_field(traceHook
, 2)) == IPPROTO_TCP
)
418 if (!syncState
->matchingModule
->canMatch
[TCP
])
423 if (syncState
->stats
)
425 processingData
->stats
->totOutE
++;
428 outE
= malloc(sizeof(Event
));
429 outE
->traceNum
= traceNum
;
431 outE
->wallTime
= wTime
;
433 outE
->copy
= ©TCPEvent
;
434 outE
->destroy
= &destroyTCPEvent
;
435 outE
->event
.tcpEvent
= malloc(sizeof(TCPEvent
));
436 outE
->event
.tcpEvent
->direction
= OUT
;
437 outE
->event
.tcpEvent
->segmentKey
= malloc(sizeof(SegmentKey
));
438 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.saddr
=
439 htonl(ltt_event_get_unsigned(event
,
440 lttv_trace_get_hook_field(traceHook
, 3)));
441 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.daddr
=
442 htonl(ltt_event_get_unsigned(event
,
443 lttv_trace_get_hook_field(traceHook
, 4)));
444 outE
->event
.tcpEvent
->segmentKey
->tot_len
=
445 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
447 outE
->event
.tcpEvent
->segmentKey
->ihl
= ltt_event_get_unsigned(event
,
448 lttv_trace_get_hook_field(traceHook
, 6));
449 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.source
=
450 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
452 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.dest
=
453 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
455 outE
->event
.tcpEvent
->segmentKey
->seq
= ltt_event_get_unsigned(event
,
456 lttv_trace_get_hook_field(traceHook
, 9));
457 outE
->event
.tcpEvent
->segmentKey
->ack_seq
=
458 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
460 outE
->event
.tcpEvent
->segmentKey
->doff
= ltt_event_get_unsigned(event
,
461 lttv_trace_get_hook_field(traceHook
, 11));
462 outE
->event
.tcpEvent
->segmentKey
->ack
= ltt_event_get_unsigned(event
,
463 lttv_trace_get_hook_field(traceHook
, 12));
464 outE
->event
.tcpEvent
->segmentKey
->rst
= ltt_event_get_unsigned(event
,
465 lttv_trace_get_hook_field(traceHook
, 13));
466 outE
->event
.tcpEvent
->segmentKey
->syn
= ltt_event_get_unsigned(event
,
467 lttv_trace_get_hook_field(traceHook
, 14));
468 outE
->event
.tcpEvent
->segmentKey
->fin
= ltt_event_get_unsigned(event
,
469 lttv_trace_get_hook_field(traceHook
, 15));
471 syncState
->matchingModule
->matchEvent(syncState
, outE
);
473 g_debug("Output event done\n");
475 else if (info
->name
== LTT_EVENT_DEV_RECEIVE
)
479 if (syncState
->stats
)
481 processingData
->stats
->totRecv
++;
484 protocol
= ltt_event_get_unsigned(event
,
485 lttv_trace_get_hook_field(traceHook
, 1));
487 if (protocol
== ETH_P_IP
)
492 if (syncState
->stats
)
494 processingData
->stats
->totRecvIp
++;
497 inE
= malloc(sizeof(Event
));
498 inE
->traceNum
= traceNum
;
500 inE
->wallTime
= wTime
;
501 inE
->event
.tcpEvent
= NULL
;
502 inE
->copy
= ©Event
;
503 inE
->destroy
= &destroyEvent
;
505 skb
= (void*) (long) ltt_event_get_long_unsigned(event
,
506 lttv_trace_get_hook_field(traceHook
, 0));
507 g_hash_table_replace(processingData
->pendingRecv
[traceNum
], skb
,
510 g_debug("Adding inE %p for skb %p to pendingRecv\n", inE
, skb
);
517 else if (info
->name
== LTT_EVENT_TCPV4_RCV_EXTENDED
)
522 // Search pendingRecv for an event with the same skb
523 skb
= (void*) (long) ltt_event_get_long_unsigned(event
,
524 lttv_trace_get_hook_field(traceHook
, 0));
527 g_hash_table_lookup(processingData
->pendingRecv
[traceNum
], skb
);
530 // This should only happen in case of lost events
531 g_warning("No matching pending receive event found");
535 if (syncState
->stats
)
537 processingData
->stats
->totRecvTCP
++;
540 // If it's there, remove it and proceed with a receive event
541 g_hash_table_steal(processingData
->pendingRecv
[traceNum
], skb
);
544 inE
->event
.tcpEvent
= malloc(sizeof(TCPEvent
));
545 inE
->copy
= ©TCPEvent
;
546 inE
->destroy
= &destroyTCPEvent
;
547 inE
->event
.tcpEvent
->direction
= IN
;
548 inE
->event
.tcpEvent
->segmentKey
= malloc(sizeof(SegmentKey
));
549 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.saddr
=
550 htonl(ltt_event_get_unsigned(event
,
551 lttv_trace_get_hook_field(traceHook
, 1)));
552 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.daddr
=
553 htonl(ltt_event_get_unsigned(event
,
554 lttv_trace_get_hook_field(traceHook
, 2)));
555 inE
->event
.tcpEvent
->segmentKey
->tot_len
=
556 ltt_event_get_unsigned(event
,
557 lttv_trace_get_hook_field(traceHook
, 3));
558 inE
->event
.tcpEvent
->segmentKey
->ihl
=
559 ltt_event_get_unsigned(event
,
560 lttv_trace_get_hook_field(traceHook
, 4));
561 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.source
=
562 ltt_event_get_unsigned(event
,
563 lttv_trace_get_hook_field(traceHook
, 5));
564 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.dest
=
565 ltt_event_get_unsigned(event
,
566 lttv_trace_get_hook_field(traceHook
, 6));
567 inE
->event
.tcpEvent
->segmentKey
->seq
=
568 ltt_event_get_unsigned(event
,
569 lttv_trace_get_hook_field(traceHook
, 7));
570 inE
->event
.tcpEvent
->segmentKey
->ack_seq
=
571 ltt_event_get_unsigned(event
,
572 lttv_trace_get_hook_field(traceHook
, 8));
573 inE
->event
.tcpEvent
->segmentKey
->doff
=
574 ltt_event_get_unsigned(event
,
575 lttv_trace_get_hook_field(traceHook
, 9));
576 inE
->event
.tcpEvent
->segmentKey
->ack
=
577 ltt_event_get_unsigned(event
,
578 lttv_trace_get_hook_field(traceHook
, 10));
579 inE
->event
.tcpEvent
->segmentKey
->rst
=
580 ltt_event_get_unsigned(event
,
581 lttv_trace_get_hook_field(traceHook
, 11));
582 inE
->event
.tcpEvent
->segmentKey
->syn
=
583 ltt_event_get_unsigned(event
,
584 lttv_trace_get_hook_field(traceHook
, 12));
585 inE
->event
.tcpEvent
->segmentKey
->fin
=
586 ltt_event_get_unsigned(event
,
587 lttv_trace_get_hook_field(traceHook
, 13));
589 syncState
->matchingModule
->matchEvent(syncState
, inE
);
591 g_debug("TCP input event %p for skb %p done\n", inE
, skb
);
594 else if (info
->name
== LTT_EVENT_UDPV4_RCV_EXTENDED
)
599 // Search pendingRecv for an event with the same skb
600 skb
= (void*) (long) ltt_event_get_long_unsigned(event
,
601 lttv_trace_get_hook_field(traceHook
, 0));
604 g_hash_table_lookup(processingData
->pendingRecv
[traceNum
], skb
);
607 // This should only happen in case of lost events
608 g_warning("No matching pending receive event found");
614 if (syncState
->stats
)
616 processingData
->stats
->totRecvUDP
++;
619 // If it's there, remove it and proceed with a receive event
620 g_hash_table_steal(processingData
->pendingRecv
[traceNum
], skb
);
623 inE
->event
.udpEvent
= malloc(sizeof(UDPEvent
));
624 inE
->copy
= ©UDPEvent
;
625 inE
->destroy
= &destroyUDPEvent
;
626 inE
->event
.udpEvent
->direction
= IN
;
627 inE
->event
.udpEvent
->datagramKey
= malloc(sizeof(DatagramKey
));
628 inE
->event
.udpEvent
->datagramKey
->saddr
=
629 htonl(ltt_event_get_unsigned(event
,
630 lttv_trace_get_hook_field(traceHook
, 1)));
631 inE
->event
.udpEvent
->datagramKey
->daddr
=
632 htonl(ltt_event_get_unsigned(event
,
633 lttv_trace_get_hook_field(traceHook
, 2)));
634 inE
->event
.udpEvent
->unicast
= ltt_event_get_unsigned(event
,
635 lttv_trace_get_hook_field(traceHook
, 3)) == 0 ? false : true;
636 inE
->event
.udpEvent
->datagramKey
->ulen
=
637 ltt_event_get_unsigned(event
,
638 lttv_trace_get_hook_field(traceHook
, 4));
639 inE
->event
.udpEvent
->datagramKey
->source
=
640 ltt_event_get_unsigned(event
,
641 lttv_trace_get_hook_field(traceHook
, 5));
642 inE
->event
.udpEvent
->datagramKey
->dest
=
643 ltt_event_get_unsigned(event
,
644 lttv_trace_get_hook_field(traceHook
, 6));
645 dataStart
= ltt_event_get_long_unsigned(event
,
646 lttv_trace_get_hook_field(traceHook
, 7));
647 g_assert_cmpuint(sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
),
648 ==, sizeof(guint64
));
649 if (inE
->event
.udpEvent
->datagramKey
->ulen
- 8 >=
650 sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
))
652 memcpy(inE
->event
.udpEvent
->datagramKey
->dataKey
, &dataStart
,
653 sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
));
657 memset(inE
->event
.udpEvent
->datagramKey
->dataKey
, 0,
658 sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
));
659 memcpy(inE
->event
.udpEvent
->datagramKey
->dataKey
, &dataStart
,
660 inE
->event
.udpEvent
->datagramKey
->ulen
- 8);
663 syncState
->matchingModule
->matchEvent(syncState
, inE
);
665 g_debug("UDP input event %p for skb %p done\n", inE
, skb
);
670 g_assert_not_reached();
678 * Write the processing-specific options in the gnuplot script.
681 * syncState: container for synchronization data
682 * i: first trace number
683 * j: second trace number, garanteed to be larger than i
685 static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState
* const
686 syncState
, const unsigned int i
, const unsigned int j
)
688 ProcessingDataLTTVStandard
* processingData
;
689 ProcessingGraphsLTTVStandard
* traceI
, * traceJ
;
691 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
693 traceI
= &processingData
->graphs
[i
];
694 traceJ
= &processingData
->graphs
[j
];
696 fprintf(syncState
->graphsStream
,
697 "set key inside right bottom\n"
698 "set xlabel \"Clock %1$u\"\n"
699 "set xtics nomirror\n"
700 "set ylabel \"Clock %3$u\"\n"
701 "set ytics nomirror\n"
702 "set x2label \"Clock %1$d (s)\"\n"
703 "set x2range [GPVAL_X_MIN / %2$.1f : GPVAL_X_MAX / %2$.1f]\n"
705 "set y2label \"Clock %3$d (s)\"\n"
706 "set y2range [GPVAL_Y_MIN / %4$.1f : GPVAL_Y_MAX / %4$.1f]\n"
707 "set y2tics\n", i
, (double) traceI
->startFreq
/ traceI
->freqScale
, j
,
708 (double) traceJ
->startFreq
/ traceJ
->freqScale
);
713 * Write the processing-specific options in the gnuplot script.
716 * syncState: container for synchronization data
717 * i: first trace number
718 * j: second trace number, garanteed to be larger than i
720 static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState
* const
721 syncState
, const unsigned int i
, const unsigned int j
)
723 ProcessingDataLTTVStandard
* processingData
;
724 ProcessingGraphsLTTVStandard
* traceI
, * traceJ
;
726 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
728 traceI
= &processingData
->graphs
[i
];
729 traceJ
= &processingData
->graphs
[j
];
731 fprintf(syncState
->graphsStream
,
732 "set key inside right bottom\n"
733 "set xlabel \"Clock %1$u\"\n"
734 "set xtics nomirror\n"
735 "set ylabel \"time (s)\"\n"
736 "set ytics nomirror\n"
737 "set x2label \"Clock %1$d (s)\"\n"
738 "set x2range [GPVAL_X_MIN / %2$.1f : GPVAL_X_MAX / %2$.1f]\n"
739 "set x2tics\n", i
, (double) traceI
->startFreq
/ traceI
->freqScale
);