Logging Event Timing Data [message #1841011] |
Fri, 30 April 2021 12:27 |
Eclipse User |
|
|
|
Hi!
I'm new to 4DIAC and currently writing my undergraduates thesis on timing analysis of event traces/chains.
I was wondering if there is a way to log tracing data of event input/outputs to the console or another output file.
My supervisor suggested that this was possible, so I wanted to ask how I could go about actually doing it.
Many thanks in advance.
|
|
|
Re: Logging Event Timing Data [message #1841018 is a reply to message #1841011] |
Fri, 30 April 2021 13:30 |
|
Hi,
we have an CMake configuration option that allows you to activate tracing of events to the console. you can find this option in the advanced section. However this tracing is implemented rather badly as it just writes timestamps and event names to the console. I guess if you want to do more accurate analysis you may want to replace that tracing feature. For that you need to main places one is the CFunctionBlock::receiveInputEvent() and the other is CFunctionBlock::sendOutputEvent() both can be found in the file funcbloc.cpp. In both functions you can find the line FORTE_TRACE which is our tracing facility.
If you wold also like to trace sent adapter events you need the method CFunctionBlock::sendAdapterEvent().
I hope this helps.
|
|
|
|
Re: Logging Event Timing Data [message #1841047 is a reply to message #1841033] |
Sat, 01 May 2021 19:24 |
|
Ah Barry, brought me to a further idea that I completely missed. Since about 4diac 1.12 we offer two methods: NOW and NOW_MONOTONIC. These methods can be used in ST and deliver you the current time. These values can be used for timestamps or implementing stopwatches for measuring times.
|
|
|
Re: Logging Event Timing Data [message #1841048 is a reply to message #1841047] |
Sat, 01 May 2021 20:52 |
Barry Dowdeswell Messages: 49 Registered: November 2018 |
Member |
|
|
Thank you Alois,
That's great. I use a C++ function to extract the Linux epoch time like this:
auto timeStamp = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
Is that similar to what NOW and NOW_MONOTONIC return?
Philipp - what Alois is suggesting works directly from a Structured Text algorithm that executes when the event is fired. That means you do not need to write in C++ (unless you enjoy writing in that beautiful language as I do :) )
I wish you every success with your undergraduate thesis: please let us know if you require any further help.
Regards,
Barry,
[Updated on: Sat, 01 May 2021 20:55] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04896 seconds