HID: Trace events for external sensor driver

These trace events are used to profile performance
of VR use cases.

Change-Id: Iba00ef71010a6a07809a23f631afba557c5dd822
Signed-off-by: rbandi <rohitbandi@codeaurora.org>
This commit is contained in:
rbandi 2018-10-05 13:50:45 -07:00
parent 3d43fd3787
commit 55d6c3af61
4 changed files with 82 additions and 1 deletions

View File

@ -139,4 +139,4 @@ obj-$(CONFIG_I2C_HID) += i2c-hid/
obj-$(CONFIG_INTEL_ISH_HID) += intel-ish-hid/
obj-$(INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ish-hid/
obj-$(CONFIG_HID_QVR) += hid-qvr.o
obj-$(CONFIG_HID_QVR) += hid-qvr.o hid-trace.o

View File

@ -38,6 +38,7 @@
#include <linux/soc/qcom/smem_state.h>
#include "hid-ids.h"
#include "hid-qvr.h"
#include "hid-trace.h"
static struct dma_buf *qvr_buf;
static void *vaddr;
@ -124,6 +125,9 @@ int qvr_send_package_wrap(u8 *message, int msize, struct hid_device *hid)
data->my = imuData.my0;
data->mz = -imuData.mz0;
trace_qvr_recv_sensor("gyro", data->gts, data->gx, data->gy, data->gz);
trace_qvr_recv_sensor("accel", data->ats, data->ax, data->ay, data->az);
index_buf->most_recent_index = buf_index;
buf_index = (buf_index == (8 - 1)) ? 0 : buf_index + 1;
return 0;

19
drivers/hid/hid-trace.c Normal file
View File

@ -0,0 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
/* Instantiate tracepoints */
#define CREATE_TRACE_POINTS
#include "hid-trace.h"

58
drivers/hid/hid-trace.h Normal file
View File

@ -0,0 +1,58 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#if !defined(_HID_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _HID_TRACE_H
#undef TRACE_SYSTEM
#define TRACE_SYSTEM hid
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE hid-trace
#include <linux/tracepoint.h>
TRACE_EVENT(qvr_recv_sensor,
TP_PROTO(char *sensor, uint64_t ts, s32 x, s32 y, s32 z),
TP_ARGS(sensor, ts, x, y, z),
TP_STRUCT__entry(
__field(char *, sensor)
__field(uint64_t, ts)
__field(int, x)
__field(int, y)
__field(int, z)
),
TP_fast_assign(
__entry->sensor = sensor;
__entry->ts = ts;
__entry->x = x;
__entry->y = y;
__entry->z = z;
),
TP_printk(
"%s - ts=%llu x=%d y=%d z=%d",
__entry->sensor,
__entry->ts,
__entry->x,
__entry->y,
__entry->z
)
);
#endif /* _HID_TRACE_H */
/* This part must be outside protection */
#include <trace/define_trace.h>