diff options
author | Bryan O'Donoghue <bryan.odonoghue@linaro.org> | 2016-06-05 14:03:28 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-06-06 20:50:08 -0700 |
commit | 6da7c88972a0153db427c14c6c5b2c4e2ccaefb7 (patch) | |
tree | 1f8f06b99758603dcca55cfaf51f5c0c122d97ac | |
parent | 4a4484274f7431c68e104a66b497639e1ac9022c (diff) | |
download | op-kernel-dev-6da7c88972a0153db427c14c6c5b2c4e2ccaefb7.zip op-kernel-dev-6da7c88972a0153db427c14c6c5b2c4e2ccaefb7.tar.gz |
greybus: tracepoints: Add standard Linux tracepoint for TimeSync event
This patch adds a tracepoint to the TimeSync ISR, the purpose of which is
to indicate a TimeSync event has happened. This tracepoint can be enabled
by issuing the following command:
echo 1 > /sys/kernel/debug/tracing/events/greybus/gb_timesync_irq/enable
Synchronization looks like this:
TIMESTAMP FUNCTION
| |
147.865788: gb_timesync_irq: strobe 1/4 frame-time 2910076529
147.866781: gb_timesync_irq: strobe 2/4 frame-time 2910095689
147.867777: gb_timesync_irq: strobe 3/4 frame-time 2910114820
147.868791: gb_timesync_irq: strobe 4/4 frame-time 2910134038
A ping can be triggered like this:
cat /sys/kernel/debug/greybus/frame-time
And that ping looks like this:
TIMESTAMP FUNCTION
| |
147.934678: gb_timesync_irq: ping 4/4 frame-time 2911380356
169.280551: gb_timesync_irq: ping 4/4 frame-time 3321221069
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Acked-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r-- | drivers/staging/greybus/greybus_trace.h | 28 | ||||
-rw-r--r-- | drivers/staging/greybus/timesync.c | 17 |
2 files changed, 40 insertions, 5 deletions
diff --git a/drivers/staging/greybus/greybus_trace.h b/drivers/staging/greybus/greybus_trace.h index 342f5ad..7249b8a 100644 --- a/drivers/staging/greybus/greybus_trace.h +++ b/drivers/staging/greybus/greybus_trace.h @@ -488,6 +488,34 @@ DEFINE_HD_EVENT(gb_hd_in); #undef DEFINE_HD_EVENT +/* + * Occurs on a TimeSync synchronization event or a TimeSync ping event. + */ +TRACE_EVENT(gb_timesync_irq, + + TP_PROTO(u8 ping, u8 strobe, u8 count, u64 frame_time), + + TP_ARGS(ping, strobe, count, frame_time), + + TP_STRUCT__entry( + __field(u8, ping) + __field(u8, strobe) + __field(u8, count) + __field(u64, frame_time) + ), + + TP_fast_assign( + __entry->ping = ping; + __entry->strobe = strobe; + __entry->count = count; + __entry->frame_time = frame_time; + ), + + TP_printk("%s %d/%d frame-time %llu\n", + __entry->ping ? "ping" : "strobe", __entry->strobe, + __entry->count, __entry->frame_time) +); + #endif /* _TRACE_GREYBUS_H */ /* This part must be outside protection */ diff --git a/drivers/staging/greybus/timesync.c b/drivers/staging/greybus/timesync.c index 260b670..4bf62ad 100644 --- a/drivers/staging/greybus/timesync.c +++ b/drivers/staging/greybus/timesync.c @@ -9,6 +9,7 @@ #include <linux/debugfs.h> #include "greybus.h" #include "timesync.h" +#include "greybus_trace.h" /* * Minimum inter-strobe value of one millisecond is chosen because it @@ -974,17 +975,19 @@ void gb_timesync_irq(struct gb_timesync_svc *timesync_svc) { unsigned long flags; u64 strobe_time; + bool strobe_is_ping = true; strobe_time = __gb_timesync_get_frame_time(timesync_svc); spin_lock_irqsave(×ync_svc->spinlock, flags); if (timesync_svc->state == GB_TIMESYNC_STATE_PING) { - if (timesync_svc->capture_ping) - timesync_svc->ap_ping_frame_time = strobe_time; - goto done; + if (!timesync_svc->capture_ping) + goto done_nolog; + timesync_svc->ap_ping_frame_time = strobe_time; + goto done_log; } else if (timesync_svc->state != GB_TIMESYNC_STATE_WAIT_SVC) { - goto done; + goto done_nolog; } timesync_svc->strobe_time[timesync_svc->strobe] = strobe_time; @@ -993,7 +996,11 @@ void gb_timesync_irq(struct gb_timesync_svc *timesync_svc) gb_timesync_set_state(timesync_svc, GB_TIMESYNC_STATE_AUTHORITATIVE); } -done: + strobe_is_ping = false; +done_log: + trace_gb_timesync_irq(strobe_is_ping, timesync_svc->strobe, + GB_TIMESYNC_MAX_STROBES, strobe_time); +done_nolog: spin_unlock_irqrestore(×ync_svc->spinlock, flags); } EXPORT_SYMBOL(gb_timesync_irq); |