-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New logging subsystem's timestamps wrap a little before the 3-minute mark #9043
Comments
@jhedberg logger is using k_cycle_get_32() by default. So maybe it is wrapping that often? You can try disabling timestmap formatting (LOG_BACKEND_UART_FORMAT_TIMESTAMP) then timestamp is printed in raw format. If it still wraps it's on k_cycle_get_32(). |
I have verified the k_cycle_get_32() and I did not noticed any wrapping around there minutes. Code snipped which I used for verification:
Result:
I also verified if wrapping of RTC hardware counter (which has only 24-bits) is handled correctly:
@nordic-krch: Could you please check logger if it is handling time obtained from k_cycle_get_32*() correctly? |
Update: it appears the issue only occurs in qemu (I only tested qemu_x86). I cannot reproduce this e.g. on an nRF target. |
I got the same issue on an Atmel SAM E70 board, it wraps every 14 seconds. The CPU runs at 300MHz, and |
@aurel32 by default logger uses |
Could we close this? |
@pizi-nordic sure, though applications shouldn't be required to fix this, rather the commonly used boards that have this issue (e.g. qemu_x86) should come with a solution built-in and enabled by default. |
I think the issue is present on all ARM boards except the nRF52 based ones. The standard timer on ARM board is the ARM systick one, which usually runs in the range 10-500MHz. |
In frdm-k64f the counter wraps after 35 sec. I agree with @jhedberg here, there should be no need to application to "fix" this. In a way this is not really a logging subsystem issue but it is easy to see the problem when looking the logging output. |
So the only generic solution I see is introduction of |
see also #6498 |
|
That won't help, given |
@aurel32 it's clear now that i've probably returned from sick leave too early :) |
Wouldn't it be possible to use a combination of those two, i.e. k_uptime_get_32() to get the milliseconds and k_cycle_get_32() to get the microseconds? |
@jhedberg, I am not sure there is an easy relation between |
@aurel32 right, that's indeed an issue. I was thinking microseconds would always be wanted since the logger renders them in the output by default. Probably this all needs to be configurable, i.e. does the user want microsecond accuracy but is willing to accept a wrap-around in a bit more than an hour, or is millisecond accuracy sufficient. |
@nordic-krch and @pizi-nordic. Is there a possible workaround for this issue as it stands, or do we need additional functionality in the logging subsystem? |
@carlescufi |
@nordic-krch Thanks for the reply. What you propose is reasonable. Since we are trying to close the open bugs that are important to users for 1.14, would you mind sending a PR that does what you describe? |
@carlescufi sure, we'll do that. |
The log format implies that it can show up many hours, however it seems to be wrapping back to zero a little bit before the three minute mark.
The text was updated successfully, but these errors were encountered: