Skip to content
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

Give monotonic time offset from real time. #1916

Closed
MatthewKhouzam opened this issue Apr 11, 2024 · 4 comments · Fixed by #1923
Closed

Give monotonic time offset from real time. #1916

MatthewKhouzam opened this issue Apr 11, 2024 · 4 comments · Fixed by #1923

Comments

@MatthewKhouzam
Copy link

It would be nice to have the option to get the offset between clock_monotonic and clock_realtime. There is a simple-ish solution.

When uftrace starts, record quickly both clock_realtime and clock_monotonic. In task.txt, the timestamps can then be offset and the traces can then be correlated with lttng traces as well as system logs.

@namhyung
Copy link
Owner

Sounds good. I think we can add something in the info file where we have record data and elapsed time.

@honggyukim
Copy link
Collaborator

Hi @MatthewKhouzam,

You explained this issue but I actually couldn't fully understand what the problem is. Could you please explain the following questions?

  1. What's the meaning of the offset between clock_monotonic and clock_realtime?
  2. Why this offset adjustment is needed for lttng?
  3. Is is possible to change the way to get timestamps from lttng itself simply with either CLOCK_MONOTONIC or CLOCK_REALTIME?

Thanks.

@honggyukim
Copy link
Collaborator

Hi @MatthewKhouzam, you may want to have #1923. Please have a look. This patch simply prints the UTC offset, but we might be able to provide a tool that does post processing for each <tid>.dat so that you can avoid time adjustment whenever you open tracecompass.

@honggyukim
Copy link
Collaborator

Another idea is that you can modify uftrace parser of tracecompass so that it can understand this new info field and use it for automatic time adjustment.

honggyukim added a commit to honggyukim/uftrace that referenced this issue May 12, 2024
In some cases, there is a requirement to get the time offset between UTC
time and our timestamp from the given clock source, CLOCK_MONOTONIC by
default.

This patch provides an additional info to provide UTC time offset in the
output of uftrace info.

This number can be used to make time adjustment easier for external
tools such as tracecompass[1].

Closes: namhyung#1916

[1] https://eclipse.dev/tracecompass
Requested-by: Matthew Khouzam <matthew.khouzam@gmail.com>
Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
honggyukim added a commit to honggyukim/uftrace that referenced this issue May 12, 2024
In some cases, there is a requirement to get the time offset between UTC
time and our timestamp from the given clock source, CLOCK_MONOTONIC by
default.

This patch provides an additional info to provide UTC time offset in the
output of uftrace info.

This number can be used to make time adjustment easier for external
tools such as tracecompass[1].

Closes: namhyung#1916

[1] https://eclipse.dev/tracecompass
Requested-by: Matthew Khouzam <matthew.khouzam@gmail.com>
Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
namhyung pushed a commit that referenced this issue May 18, 2024
In some cases, there is a requirement to get the time offset between UTC
time and our timestamp from the given clock source, CLOCK_MONOTONIC by
default.

This patch provides an additional info to provide UTC time offset in the
output of uftrace info.

This number can be used to make time adjustment easier for external
tools such as tracecompass[1].

Closes: #1916

[1] https://eclipse.dev/tracecompass
Requested-by: Matthew Khouzam <matthew.khouzam@gmail.com>
Signed-off-by: Honggyu Kim <honggyu.kp@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants