ARM-software / trappy

This repository has moved to https://gitlab.arm.com/tooling/trappy
Apache License 2.0
60 stars 39 forks source link

trappy/ftrace: add support for boot clock timestamp #255

Closed derkling closed 7 years ago

derkling commented 7 years ago

FTrace can be configured to report events timestamp using different clock sources which can be selected via the trace_clock sysfs attribute as described in: https://www.kernel.org/doc/Documentation/trace/ftrace.txt

The global clock source reports time in [s] with a [us] resolution. Other sources instead, like for example the boot clock, uses [ns]. Thus, in these last cases we do not have decimals in the timestamp.

Let's update the special fields regexp to match both [s] and [ns] formatted times. This also update the base test to add a set of trace events which are expressed in [ns] resolution.

Signed-off-by: Patrick Bellasi patrick.bellasi@arm.com

derkling commented 7 years ago

Maybe @joelagnel can be interested in having a look since I think he had a similar "issue" with some Android traces in the past.

bjackman commented 7 years ago

The documentation says "the timestamp in . format" so I wonder if this is a bug in a device kernel? If it's not going to be fixed in the kernel then yeah I guess we have to support it here.

derkling commented 7 years ago

@bjackman the only reference I can find related to the "." format is related to the specific description of the function tracer, I'm looking at this file: https://www.kernel.org/doc/Documentation/trace/ftrace.txt ... thus it could be very well a post-processing formatting.

Moreover, the description of the trace_clock parameter says that the boot clock comes from ktime_get_boot_fast_ns()... which name suggests it should return a ns based timestamp. There is also an explicit reference to possible required post-processing.

derkling commented 7 years ago

Update:

credp commented 7 years ago

As I understand it the timestamp format in a trace depends upon the configured trace_clock - it's perfectly possible and valid to use the nanosecond boot clock.

derkling commented 7 years ago

Update:

joelagnel commented 7 years ago

LGTM... Let's get it merged ASAP 😁😁

sinkap commented 7 years ago

Merged.