cros_ec_sensorhub_trace.h (3586B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Trace events for the ChromeOS Sensorhub kernel module 4 * 5 * Copyright 2021 Google LLC. 6 */ 7 8#undef TRACE_SYSTEM 9#define TRACE_SYSTEM cros_ec 10 11#if !defined(_CROS_EC_SENSORHUB_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) 12#define _CROS_EC_SENSORHUB_TRACE_H_ 13 14#include <linux/types.h> 15#include <linux/platform_data/cros_ec_sensorhub.h> 16 17#include <linux/tracepoint.h> 18 19TRACE_EVENT(cros_ec_sensorhub_timestamp, 20 TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp, 21 s64 current_timestamp, s64 current_time), 22 TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp, 23 current_time), 24 TP_STRUCT__entry( 25 __field(u32, ec_sample_timestamp) 26 __field(u32, ec_fifo_timestamp) 27 __field(s64, fifo_timestamp) 28 __field(s64, current_timestamp) 29 __field(s64, current_time) 30 __field(s64, delta) 31 ), 32 TP_fast_assign( 33 __entry->ec_sample_timestamp = ec_sample_timestamp; 34 __entry->ec_fifo_timestamp = ec_fifo_timestamp; 35 __entry->fifo_timestamp = fifo_timestamp; 36 __entry->current_timestamp = current_timestamp; 37 __entry->current_time = current_time; 38 __entry->delta = current_timestamp - current_time; 39 ), 40 TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", 41 __entry->ec_sample_timestamp, 42 __entry->ec_fifo_timestamp, 43 __entry->fifo_timestamp, 44 __entry->current_timestamp, 45 __entry->current_time, 46 __entry->delta 47 ) 48); 49 50TRACE_EVENT(cros_ec_sensorhub_data, 51 TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp, 52 s64 current_timestamp, s64 current_time), 53 TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time), 54 TP_STRUCT__entry( 55 __field(u32, ec_sensor_num) 56 __field(u32, ec_fifo_timestamp) 57 __field(s64, fifo_timestamp) 58 __field(s64, current_timestamp) 59 __field(s64, current_time) 60 __field(s64, delta) 61 ), 62 TP_fast_assign( 63 __entry->ec_sensor_num = ec_sensor_num; 64 __entry->ec_fifo_timestamp = ec_fifo_timestamp; 65 __entry->fifo_timestamp = fifo_timestamp; 66 __entry->current_timestamp = current_timestamp; 67 __entry->current_time = current_time; 68 __entry->delta = current_timestamp - current_time; 69 ), 70 TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld", 71 __entry->ec_sensor_num, 72 __entry->ec_fifo_timestamp, 73 __entry->fifo_timestamp, 74 __entry->current_timestamp, 75 __entry->current_time, 76 __entry->delta 77 ) 78); 79 80TRACE_EVENT(cros_ec_sensorhub_filter, 81 TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy), 82 TP_ARGS(state, dx, dy), 83 TP_STRUCT__entry( 84 __field(s64, dx) 85 __field(s64, dy) 86 __field(s64, median_m) 87 __field(s64, median_error) 88 __field(s64, history_len) 89 __field(s64, x) 90 __field(s64, y) 91 ), 92 TP_fast_assign( 93 __entry->dx = dx; 94 __entry->dy = dy; 95 __entry->median_m = state->median_m; 96 __entry->median_error = state->median_error; 97 __entry->history_len = state->history_len; 98 __entry->x = state->x_offset; 99 __entry->y = state->y_offset; 100 ), 101 TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld", 102 __entry->dx, 103 __entry->dy, 104 __entry->median_m, 105 __entry->median_error, 106 __entry->history_len, 107 __entry->x, 108 __entry->y 109 ) 110); 111 112 113#endif /* _CROS_EC_SENSORHUB_TRACE_H_ */ 114 115/* this part must be outside header guard */ 116 117#undef TRACE_INCLUDE_PATH 118#define TRACE_INCLUDE_PATH . 119 120#undef TRACE_INCLUDE_FILE 121#define TRACE_INCLUDE_FILE cros_ec_sensorhub_trace 122 123#include <trace/define_trace.h>