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 writeProcessingGraphVariablesLTTVStandard(SyncState
* const
51 syncState
, const unsigned int i
);
52 static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState
* const
53 syncState
, const unsigned int i
, const unsigned int j
);
54 static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState
* const
55 syncState
, const unsigned int i
, const unsigned int j
);
57 // Functions specific to this module
58 static void registerProcessingLTTVStandard() __attribute__((constructor (102)));
59 static gboolean
processEventLTTVStandard(void* hookData
, void* callData
);
60 static void partialDestroyProcessingLTTVStandard(SyncState
* const syncState
);
63 static ProcessingModule processingModuleLTTVStandard
= {
64 .name
= "LTTV-standard",
65 .initProcessing
= &initProcessingLTTVStandard
,
66 .destroyProcessing
= &destroyProcessingLTTVStandard
,
67 .finalizeProcessing
= &finalizeProcessingLTTVStandard
,
68 .printProcessingStats
= &printProcessingStatsLTTVStandard
,
70 .writeVariables
= &writeProcessingGraphVariablesLTTVStandard
,
71 .writeTraceTraceOptions
= &writeProcessingTraceTraceOptionsLTTVStandard
,
72 .writeTraceTimeOptions
= &writeProcessingTraceTimeOptionsLTTVStandard
,
78 * Processing Module registering function
80 static void registerProcessingLTTVStandard()
82 g_queue_push_tail(&processingModules
, &processingModuleLTTVStandard
);
89 * Allocate and initialize data structures for synchronizing a traceset.
90 * Register event hooks.
93 * syncState: container for synchronization data.
94 * This function allocates these processingData members:
99 * traceSetContext: set of LTTV traces
101 static void initProcessingLTTVStandard(SyncState
* const syncState
, LttvTracesetContext
*
102 const traceSetContext
)
105 ProcessingDataLTTVStandard
* processingData
;
107 processingData
= malloc(sizeof(ProcessingDataLTTVStandard
));
108 syncState
->processingData
= processingData
;
109 processingData
->traceSetContext
= traceSetContext
;
111 if (syncState
->stats
)
113 processingData
->stats
= calloc(1, sizeof(ProcessingStatsLTTVStandard
));
117 processingData
->stats
= NULL
;
120 processingData
->traceNumTable
= g_hash_table_new(&g_direct_hash
, NULL
);
121 processingData
->hookListList
= g_array_sized_new(FALSE
, FALSE
,
122 sizeof(GArray
*), syncState
->traceNb
);
123 processingData
->pendingRecv
= malloc(sizeof(GHashTable
*) *
126 for(i
= 0; i
< syncState
->traceNb
; i
++)
128 g_hash_table_insert(processingData
->traceNumTable
,
129 processingData
->traceSetContext
->traces
[i
]->t
, (gpointer
) i
);
132 if (syncState
->graphsStream
)
134 processingData
->graphs
= malloc(syncState
->traceNb
*
135 sizeof(ProcessingGraphsLTTVStandard
));
137 for(i
= 0; i
< syncState
->traceNb
; i
++)
139 LttTrace
* traceI
= traceSetContext
->traces
[i
]->t
;
141 processingData
->graphs
[i
].startFreq
= traceI
->start_freq
;
142 processingData
->graphs
[i
].freqScale
= traceI
->freq_scale
;
147 processingData
->graphs
= NULL
;
150 for(i
= 0; i
< syncState
->traceNb
; i
++)
152 processingData
->pendingRecv
[i
]= g_hash_table_new_full(&g_direct_hash
,
153 NULL
, NULL
, &gdnDestroyEvent
);
156 registerHooks(processingData
->hookListList
, traceSetContext
,
157 &processEventLTTVStandard
, syncState
,
158 syncState
->matchingModule
->canMatch
);
163 * Call the partial processing destroyer, obtain and adjust the factors from
167 * syncState container for synchronization data.
169 static void finalizeProcessingLTTVStandard(SyncState
* const syncState
)
173 double minOffset
, minDrift
;
174 unsigned int refFreqTrace
;
175 ProcessingDataLTTVStandard
* processingData
;
177 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
179 partialDestroyProcessingLTTVStandard(syncState
);
181 factors
= syncState
->matchingModule
->finalizeMatching(syncState
);
183 /* The offsets are adjusted so the lowest one is 0. This is done because
184 * of a Lttv specific limitation: events cannot have negative times. By
185 * having non-negative offsets, events cannot be moved backwards to
189 for (i
= 0; i
< syncState
->traceNb
; i
++)
191 minOffset
= MIN(g_array_index(factors
, Factors
, i
).offset
, minOffset
);
194 for (i
= 0; i
< syncState
->traceNb
; i
++)
196 g_array_index(factors
, Factors
, i
).offset
-= minOffset
;
199 /* Because the timestamps are corrected at the TSC level (not at the
200 * LttTime level) all trace frequencies must be made equal. We choose to
201 * use the frequency of the system with the lowest drift
205 for (i
= 0; i
< syncState
->traceNb
; i
++)
207 if (g_array_index(factors
, Factors
, i
).drift
< minDrift
)
209 minDrift
= g_array_index(factors
, Factors
, i
).drift
;
213 g_assert(syncState
->traceNb
== 0 || minDrift
!= INFINITY
);
215 // Write the factors to the LttTrace structures
216 for (i
= 0; i
< syncState
->traceNb
; i
++)
219 Factors
* traceFactors
;
221 t
= processingData
->traceSetContext
->traces
[i
]->t
;
222 traceFactors
= &g_array_index(factors
, Factors
, i
);
224 t
->drift
= traceFactors
->drift
;
225 t
->offset
= traceFactors
->offset
;
227 processingData
->traceSetContext
->traces
[refFreqTrace
]->t
->start_freq
;
229 processingData
->traceSetContext
->traces
[refFreqTrace
]->t
->freq_scale
;
230 t
->start_time_from_tsc
=
231 ltt_time_from_uint64(tsc_to_uint64(t
->freq_scale
, t
->start_freq
,
232 t
->drift
* t
->start_tsc
+ t
->offset
));
235 g_array_free(factors
, TRUE
);
237 lttv_traceset_context_compute_time_span(processingData
->traceSetContext
,
238 &processingData
->traceSetContext
->time_span
);
240 g_debug("traceset start %ld.%09ld end %ld.%09ld\n",
241 processingData
->traceSetContext
->time_span
.start_time
.tv_sec
,
242 processingData
->traceSetContext
->time_span
.start_time
.tv_nsec
,
243 processingData
->traceSetContext
->time_span
.end_time
.tv_sec
,
244 processingData
->traceSetContext
->time_span
.end_time
.tv_nsec
);
249 * Print statistics related to processing Must be called after
250 * finalizeProcessing.
253 * syncState container for synchronization data.
255 static void printProcessingStatsLTTVStandard(SyncState
* const syncState
)
257 ProcessingDataLTTVStandard
* processingData
;
259 if (!syncState
->stats
)
264 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
266 printf("LTTV processing stats:\n");
267 printf("\treceived frames: %d\n", processingData
->stats
->totRecv
);
268 printf("\treceived frames that are IP: %d\n",
269 processingData
->stats
->totRecvIp
);
270 if (syncState
->matchingModule
->canMatch
[TCP
])
272 printf("\treceived and processed packets that are TCP: %d\n",
273 processingData
->stats
->totRecvTCP
);
275 if (syncState
->matchingModule
->canMatch
[UDP
])
277 printf("\treceived and processed packets that are UDP: %d\n",
278 processingData
->stats
->totRecvUDP
);
280 if (syncState
->matchingModule
->canMatch
[TCP
])
282 printf("\tsent packets that are TCP: %d\n",
283 processingData
->stats
->totOutE
);
289 * Unregister event hooks. Deallocate processingData.
292 * syncState: container for synchronization data.
293 * This function deallocates these processingData members:
296 static void destroyProcessingLTTVStandard(SyncState
* const syncState
)
298 ProcessingDataLTTVStandard
* processingData
;
300 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
302 if (processingData
== NULL
)
307 partialDestroyProcessingLTTVStandard(syncState
);
309 if (syncState
->stats
)
311 free(processingData
->stats
);
314 if (syncState
->graphsStream
)
316 free(processingData
->graphs
);
319 free(syncState
->processingData
);
320 syncState
->processingData
= NULL
;
325 * Unregister event hooks. Deallocate some of processingData.
327 * This function can be called right after the events have been processed to
328 * free some data structures that are not needed for finalization.
331 * syncState: container for synchronization data.
332 * This function deallocates these members:
337 static void partialDestroyProcessingLTTVStandard(SyncState
* const syncState
)
340 ProcessingDataLTTVStandard
* processingData
;
342 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
344 if (processingData
== NULL
|| processingData
->traceNumTable
== NULL
)
349 g_hash_table_destroy(processingData
->traceNumTable
);
350 processingData
->traceNumTable
= NULL
;
352 for(i
= 0; i
< syncState
->traceNb
; i
++)
355 g_debug("Cleaning up pendingRecv list\n");
356 g_hash_table_destroy(processingData
->pendingRecv
[i
]);
358 free(processingData
->pendingRecv
);
360 unregisterHooks(processingData
->hookListList
,
361 processingData
->traceSetContext
);
366 * Lttv hook function that will be called for network events
369 * hookData: LttvTraceHook* for the type of event that generated the call
370 * callData: LttvTracefileContext* at the moment of the event
373 * FALSE Always returns FALSE, meaning to keep processing hooks for
376 static gboolean
processEventLTTVStandard(void* hookData
, void* callData
)
378 LttvTraceHook
* traceHook
;
379 LttvTracefileContext
* tfc
;
385 unsigned long traceNum
;
386 struct marker_info
* info
;
387 SyncState
* syncState
;
388 ProcessingDataLTTVStandard
* processingData
;
390 traceHook
= (LttvTraceHook
*) hookData
;
391 tfc
= (LttvTracefileContext
*) callData
;
392 trace
= tfc
->t_context
->t
;
393 syncState
= (SyncState
*) traceHook
->hook_data
;
394 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
395 event
= ltt_tracefile_get_event(tfc
->tf
);
396 info
= marker_get_info_from_id(tfc
->tf
->mdata
, event
->event_id
);
397 tsc
= ltt_event_cycle_count(event
);
398 time
= ltt_event_time(event
);
399 wTime
.seconds
= time
.tv_sec
;
400 wTime
.nanosec
= time
.tv_nsec
;
402 g_assert(g_hash_table_lookup_extended(processingData
->traceNumTable
,
403 trace
, NULL
, (gpointer
*) &traceNum
));
405 g_debug("XXXX process event: time: %ld.%09ld trace: %ld (%p) name: %s ",
406 time
.tv_sec
, time
.tv_nsec
, traceNum
, trace
,
407 g_quark_to_string(info
->name
));
409 if (info
->name
== LTT_EVENT_DEV_XMIT_EXTENDED
)
413 if (!ltt_event_get_unsigned(event
,
414 lttv_trace_get_hook_field(traceHook
, 1)) == ETH_P_IP
||
415 !ltt_event_get_unsigned(event
,
416 lttv_trace_get_hook_field(traceHook
, 2)) == IPPROTO_TCP
)
421 if (!syncState
->matchingModule
->canMatch
[TCP
])
426 if (syncState
->stats
)
428 processingData
->stats
->totOutE
++;
431 outE
= malloc(sizeof(Event
));
432 outE
->traceNum
= traceNum
;
434 outE
->wallTime
= wTime
;
436 outE
->copy
= ©TCPEvent
;
437 outE
->destroy
= &destroyTCPEvent
;
438 outE
->event
.tcpEvent
= malloc(sizeof(TCPEvent
));
439 outE
->event
.tcpEvent
->direction
= OUT
;
440 outE
->event
.tcpEvent
->segmentKey
= malloc(sizeof(SegmentKey
));
441 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.saddr
=
442 htonl(ltt_event_get_unsigned(event
,
443 lttv_trace_get_hook_field(traceHook
, 3)));
444 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.daddr
=
445 htonl(ltt_event_get_unsigned(event
,
446 lttv_trace_get_hook_field(traceHook
, 4)));
447 outE
->event
.tcpEvent
->segmentKey
->tot_len
=
448 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
450 outE
->event
.tcpEvent
->segmentKey
->ihl
= ltt_event_get_unsigned(event
,
451 lttv_trace_get_hook_field(traceHook
, 6));
452 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.source
=
453 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
455 outE
->event
.tcpEvent
->segmentKey
->connectionKey
.dest
=
456 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
458 outE
->event
.tcpEvent
->segmentKey
->seq
= ltt_event_get_unsigned(event
,
459 lttv_trace_get_hook_field(traceHook
, 9));
460 outE
->event
.tcpEvent
->segmentKey
->ack_seq
=
461 ltt_event_get_unsigned(event
, lttv_trace_get_hook_field(traceHook
,
463 outE
->event
.tcpEvent
->segmentKey
->doff
= ltt_event_get_unsigned(event
,
464 lttv_trace_get_hook_field(traceHook
, 11));
465 outE
->event
.tcpEvent
->segmentKey
->ack
= ltt_event_get_unsigned(event
,
466 lttv_trace_get_hook_field(traceHook
, 12));
467 outE
->event
.tcpEvent
->segmentKey
->rst
= ltt_event_get_unsigned(event
,
468 lttv_trace_get_hook_field(traceHook
, 13));
469 outE
->event
.tcpEvent
->segmentKey
->syn
= ltt_event_get_unsigned(event
,
470 lttv_trace_get_hook_field(traceHook
, 14));
471 outE
->event
.tcpEvent
->segmentKey
->fin
= ltt_event_get_unsigned(event
,
472 lttv_trace_get_hook_field(traceHook
, 15));
474 syncState
->matchingModule
->matchEvent(syncState
, outE
);
476 g_debug("Output event done\n");
478 else if (info
->name
== LTT_EVENT_DEV_RECEIVE
)
482 if (syncState
->stats
)
484 processingData
->stats
->totRecv
++;
487 protocol
= ltt_event_get_unsigned(event
,
488 lttv_trace_get_hook_field(traceHook
, 1));
490 if (protocol
== ETH_P_IP
)
495 if (syncState
->stats
)
497 processingData
->stats
->totRecvIp
++;
500 inE
= malloc(sizeof(Event
));
501 inE
->traceNum
= traceNum
;
503 inE
->wallTime
= wTime
;
504 inE
->event
.tcpEvent
= NULL
;
505 inE
->copy
= ©Event
;
506 inE
->destroy
= &destroyEvent
;
508 skb
= (void*) (long) ltt_event_get_long_unsigned(event
,
509 lttv_trace_get_hook_field(traceHook
, 0));
510 g_hash_table_replace(processingData
->pendingRecv
[traceNum
], skb
,
513 g_debug("Adding inE %p for skb %p to pendingRecv\n", inE
, skb
);
520 else if (info
->name
== LTT_EVENT_TCPV4_RCV_EXTENDED
)
525 // Search pendingRecv for an event with the same skb
526 skb
= (void*) (long) ltt_event_get_long_unsigned(event
,
527 lttv_trace_get_hook_field(traceHook
, 0));
530 g_hash_table_lookup(processingData
->pendingRecv
[traceNum
], skb
);
533 // This should only happen in case of lost events
534 g_warning("No matching pending receive event found");
538 if (syncState
->stats
)
540 processingData
->stats
->totRecvTCP
++;
543 // If it's there, remove it and proceed with a receive event
544 g_hash_table_steal(processingData
->pendingRecv
[traceNum
], skb
);
547 inE
->event
.tcpEvent
= malloc(sizeof(TCPEvent
));
548 inE
->copy
= ©TCPEvent
;
549 inE
->destroy
= &destroyTCPEvent
;
550 inE
->event
.tcpEvent
->direction
= IN
;
551 inE
->event
.tcpEvent
->segmentKey
= malloc(sizeof(SegmentKey
));
552 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.saddr
=
553 htonl(ltt_event_get_unsigned(event
,
554 lttv_trace_get_hook_field(traceHook
, 1)));
555 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.daddr
=
556 htonl(ltt_event_get_unsigned(event
,
557 lttv_trace_get_hook_field(traceHook
, 2)));
558 inE
->event
.tcpEvent
->segmentKey
->tot_len
=
559 ltt_event_get_unsigned(event
,
560 lttv_trace_get_hook_field(traceHook
, 3));
561 inE
->event
.tcpEvent
->segmentKey
->ihl
=
562 ltt_event_get_unsigned(event
,
563 lttv_trace_get_hook_field(traceHook
, 4));
564 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.source
=
565 ltt_event_get_unsigned(event
,
566 lttv_trace_get_hook_field(traceHook
, 5));
567 inE
->event
.tcpEvent
->segmentKey
->connectionKey
.dest
=
568 ltt_event_get_unsigned(event
,
569 lttv_trace_get_hook_field(traceHook
, 6));
570 inE
->event
.tcpEvent
->segmentKey
->seq
=
571 ltt_event_get_unsigned(event
,
572 lttv_trace_get_hook_field(traceHook
, 7));
573 inE
->event
.tcpEvent
->segmentKey
->ack_seq
=
574 ltt_event_get_unsigned(event
,
575 lttv_trace_get_hook_field(traceHook
, 8));
576 inE
->event
.tcpEvent
->segmentKey
->doff
=
577 ltt_event_get_unsigned(event
,
578 lttv_trace_get_hook_field(traceHook
, 9));
579 inE
->event
.tcpEvent
->segmentKey
->ack
=
580 ltt_event_get_unsigned(event
,
581 lttv_trace_get_hook_field(traceHook
, 10));
582 inE
->event
.tcpEvent
->segmentKey
->rst
=
583 ltt_event_get_unsigned(event
,
584 lttv_trace_get_hook_field(traceHook
, 11));
585 inE
->event
.tcpEvent
->segmentKey
->syn
=
586 ltt_event_get_unsigned(event
,
587 lttv_trace_get_hook_field(traceHook
, 12));
588 inE
->event
.tcpEvent
->segmentKey
->fin
=
589 ltt_event_get_unsigned(event
,
590 lttv_trace_get_hook_field(traceHook
, 13));
592 syncState
->matchingModule
->matchEvent(syncState
, inE
);
594 g_debug("TCP input event %p for skb %p done\n", inE
, skb
);
597 else if (info
->name
== LTT_EVENT_UDPV4_RCV_EXTENDED
)
602 // Search pendingRecv for an event with the same skb
603 skb
= (void*) (long) ltt_event_get_long_unsigned(event
,
604 lttv_trace_get_hook_field(traceHook
, 0));
607 g_hash_table_lookup(processingData
->pendingRecv
[traceNum
], skb
);
610 // This should only happen in case of lost events
611 g_warning("No matching pending receive event found");
617 if (syncState
->stats
)
619 processingData
->stats
->totRecvUDP
++;
622 // If it's there, remove it and proceed with a receive event
623 g_hash_table_steal(processingData
->pendingRecv
[traceNum
], skb
);
626 inE
->event
.udpEvent
= malloc(sizeof(UDPEvent
));
627 inE
->copy
= ©UDPEvent
;
628 inE
->destroy
= &destroyUDPEvent
;
629 inE
->event
.udpEvent
->direction
= IN
;
630 inE
->event
.udpEvent
->datagramKey
= malloc(sizeof(DatagramKey
));
631 inE
->event
.udpEvent
->datagramKey
->saddr
=
632 htonl(ltt_event_get_unsigned(event
,
633 lttv_trace_get_hook_field(traceHook
, 1)));
634 inE
->event
.udpEvent
->datagramKey
->daddr
=
635 htonl(ltt_event_get_unsigned(event
,
636 lttv_trace_get_hook_field(traceHook
, 2)));
637 inE
->event
.udpEvent
->unicast
= ltt_event_get_unsigned(event
,
638 lttv_trace_get_hook_field(traceHook
, 3)) == 0 ? false : true;
639 inE
->event
.udpEvent
->datagramKey
->ulen
=
640 ltt_event_get_unsigned(event
,
641 lttv_trace_get_hook_field(traceHook
, 4));
642 inE
->event
.udpEvent
->datagramKey
->source
=
643 ltt_event_get_unsigned(event
,
644 lttv_trace_get_hook_field(traceHook
, 5));
645 inE
->event
.udpEvent
->datagramKey
->dest
=
646 ltt_event_get_unsigned(event
,
647 lttv_trace_get_hook_field(traceHook
, 6));
648 dataStart
= ltt_event_get_long_unsigned(event
,
649 lttv_trace_get_hook_field(traceHook
, 7));
650 g_assert_cmpuint(sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
),
651 ==, sizeof(guint64
));
652 if (inE
->event
.udpEvent
->datagramKey
->ulen
- 8 >=
653 sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
))
655 memcpy(inE
->event
.udpEvent
->datagramKey
->dataKey
, &dataStart
,
656 sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
));
660 memset(inE
->event
.udpEvent
->datagramKey
->dataKey
, 0,
661 sizeof(inE
->event
.udpEvent
->datagramKey
->dataKey
));
662 memcpy(inE
->event
.udpEvent
->datagramKey
->dataKey
, &dataStart
,
663 inE
->event
.udpEvent
->datagramKey
->ulen
- 8);
666 syncState
->matchingModule
->matchEvent(syncState
, inE
);
668 g_debug("UDP input event %p for skb %p done\n", inE
, skb
);
673 g_assert_not_reached();
681 * Write the processing-specific variables in the gnuplot script.
684 * syncState: container for synchronization data
687 static void writeProcessingGraphVariablesLTTVStandard(SyncState
* const
688 syncState
, const unsigned int i
)
690 ProcessingDataLTTVStandard
* processingData
= syncState
->processingData
;
691 ProcessingGraphsLTTVStandard
* traceI
= &processingData
->graphs
[i
];
693 fprintf(syncState
->graphsStream
, "clock_freq_%u= %.3f\n", i
, (double)
694 traceI
->startFreq
/ traceI
->freqScale
);
699 * Write the processing-specific options in the gnuplot script.
702 * syncState: container for synchronization data
703 * i: first trace number
704 * j: second trace number, garanteed to be larger than i
706 static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState
* const
707 syncState
, const unsigned int i
, const unsigned int j
)
709 ProcessingDataLTTVStandard
* processingData
;
710 ProcessingGraphsLTTVStandard
* traceI
, * traceJ
;
712 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
714 traceI
= &processingData
->graphs
[i
];
715 traceJ
= &processingData
->graphs
[j
];
717 fprintf(syncState
->graphsStream
,
718 "set key inside right bottom\n"
719 "set xlabel \"Clock %1$u\"\n"
720 "set xtics nomirror\n"
721 "set ylabel \"Clock %2$u\"\n"
722 "set ytics nomirror\n"
723 "set x2label \"Clock %1$d (s)\"\n"
724 "set x2range [GPVAL_X_MIN / clock_freq_%1$u : GPVAL_X_MAX / clock_freq_%1$u]\n"
726 "set y2label \"Clock %2$d (s)\"\n"
727 "set y2range [GPVAL_Y_MIN / clock_freq_%2$u : GPVAL_Y_MAX / clock_freq_%2$u]\n"
728 "set y2tics\n", i
, j
);
733 * Write the processing-specific options in the gnuplot script.
736 * syncState: container for synchronization data
737 * i: first trace number
738 * j: second trace number, garanteed to be larger than i
740 static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState
* const
741 syncState
, const unsigned int i
, const unsigned int j
)
743 ProcessingDataLTTVStandard
* processingData
;
744 ProcessingGraphsLTTVStandard
* traceI
, * traceJ
;
746 processingData
= (ProcessingDataLTTVStandard
*) syncState
->processingData
;
748 traceI
= &processingData
->graphs
[i
];
749 traceJ
= &processingData
->graphs
[j
];
751 fprintf(syncState
->graphsStream
,
752 "set key inside right bottom\n"
753 "set xlabel \"Clock %1$u\"\n"
754 "set xtics nomirror\n"
755 "set ylabel \"time (s)\"\n"
756 "set ytics nomirror\n"
757 "set x2label \"Clock %1$d (s)\"\n"
758 "set x2range [GPVAL_X_MIN / clock_freq_%1$u : GPVAL_X_MAX / clock_freq_%1$u]\n"