Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass-dev] CTF trace reader: ordering events in multiple streams with same timestamp

I meant that the current epoch time in nanoseconds is approximately 0x15B0 0000 0000 0000. This fits in a 64-bit long. But in picoseconds this is... approximately 0xB780 0000 0000 0000.

Oh, OK, that also fits in 64-bits, although only if unsigned. Maybe it will work. The CTF event timestamps are in cycles, so the above values are for 1 GHz and 1 THz clocks, respectively.

But otherwise, you can set an offset in the clock in the CTF metadata (for example offset to Jan 1, 2019), and then the event timestamps only need to be the cycles since Jan 1, 2019.

https://diamon.org/ctf/#spec8

Note that the clock 'offset' is in cycles, there is a clock 'offset_s' in seconds but this is not supported yet by Trace Compass, it is being implemented in patch https://git.eclipse.org/r/#/c/141278.

Patrick

On Wed, Jul 10, 2019 at 3:06 AM Phyo Kyaw <phyokyaw.uk@xxxxxxxxx> wrote:
Hi Patrick,

Thanks for this and suggestions. I think if CTFTraceReader can provide protected method that returns Comparator<>, by default returns existing StreamInputReaderTimestampComparator, would be the best option for us. We were looking into changing timestamp resolution and adding index as you suggested. For now we will go with that option. "Then to prevent timestamp overflow you can set a clock offset in the trace metadata." I don't quite set the connection between overflow and offset. Can you please elaborate a bit more? Do you mean precision in CTF meta?

Many thanks,
Phyo

On Tue, 9 Jul 2019 at 17:03, Patrick Tasse <patrick.tasse@xxxxxxxxx> wrote:
Hi Phyo,

If you look at patch https://git.eclipse.org/r/139675, the tie-breaker when timestamps are equal is the stream filename alphabetical order. It does not guarantee creation order, but at least it guarantees a predictable order.

To have some other order I think would involve:

- add custom extra attribute to the trace event, and add ability in CTF parser for the user to provide a custom tie-breaking comparator

- define some standard tie-breaking extra attribute in CTF events that would apply for all, and update CTF parser with a corresponding tie-breaking comparator

We can investigate if any of these solutions are possible.

In the meantime, just an idea, you might be able to do something in your trace by using a different clock frequency? For example if the CTF timestamps are in picoseconds maybe you can use the last 3 digits as some kind of sequence number? Then to prevent timestamp overflow you can set a clock offset in the trace metadata.

Patrick



On Tue, Jul 9, 2019 at 9:19 AM Phyo Kyaw <phyokyaw.uk@xxxxxxxxx> wrote:
Dear all,

We have generated CTF trace file with multiple streams for each core and in some cases CTF events can have same timestamp during to sampling rate faster than clock speed. In this case the order seems to be what ever created first and assigned reader.

Generated
Event in stream file 1:    001 Core 0 Started work
Event in stream file 2:    001 Core 1 Completed work

Read back
001 Core 1 Completed work
001 Core 0 Started work


Looks like CTFTraceReader() has StreamInputReaderTimestampComparator() which is a bit inflexible to extend or modify.

Any suggestions to make it shown as written. I understand no other information to order them but we can add extra attribute during creation to set the order.

Thanks
Phyo
_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tracecompass-dev
_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tracecompass-dev
_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tracecompass-dev

Back to the top