summaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorRobert Collins <rcollins@nvidia.com>2017-08-10 12:05:32 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-19 15:36:49 -0400
commitc8dfd0c5eec992065535129295bb9eaa7597e9fc (patch)
treed4c4ebbe6abfc7ac4107b0caede05e0675c468bb /include/trace
parent8760c3237b25856507fa60185e8d81d5185dea81 (diff)
trace: sensors: Add ATRACE macros for sensor events
Adding ATRACE macros will enable tracking motion sensor events for end-to-end latency. AV-388 Change-Id: I774dff325d92b954aaecb660f81899f277566cf2 Signed-off-by: Robert Collins <rcollins@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1536969 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Akhilesh Khumbum <akhumbum@nvidia.com>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/atrace.h2
-rw-r--r--include/trace/events/nvs_sensors.h53
2 files changed, 54 insertions, 1 deletions
diff --git a/include/trace/events/atrace.h b/include/trace/events/atrace.h
index 7fe8b30d9..486809336 100644
--- a/include/trace/events/atrace.h
+++ b/include/trace/events/atrace.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * atrace specific events 4 * atrace specific events
5 * 5 *
6 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 6 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
diff --git a/include/trace/events/nvs_sensors.h b/include/trace/events/nvs_sensors.h
new file mode 100644
index 000000000..13de3ea53
--- /dev/null
+++ b/include/trace/events/nvs_sensors.h
@@ -0,0 +1,53 @@
1/*
2 * include/trace/events/nvs_sensors.h
3 *
4 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef _LINUX_TRACE_EVENTS_NVS_SENSORS_H
12#define _LINUX_TRACE_EVENTS_NVS_SENSORS_H
13
14#include <trace/events/atrace.h>
15#define TRACE_SENSOR_ID (100)
16
17/*
18 * (keep sync with sensor HAL trace.h)
19 * COOKIE defintion for sensor HAL ATRACE events
20 *
21 * 3322222222221111111111000 0 000000 - Bit
22 * 1098765432109876543210987 6 543210 Position
23 * +-------------------------+-+------+
24 * | TIMESTAMP |P| STYPE|
25 * +-------------------------+-+------+
26 *
27 * Where:
28 * TIMESTAMP = Sensor event timestamp
29 * P = Private sensor bit indicator (1=private, 0=not private)
30 * STYPE = Sensor TYPE
31 */
32#define COOKIE_TOTAL_BITS 32
33#define COOKIE_SENSOR_TYPE_BITS 6
34#define COOKIE_SENSOR_PRIVATE_BITS 1
35#define COOKIE_TIMESTAMP_BITS (COOKIE_TOTAL_BITS - COOKIE_SENSOR_PRIVATE_BITS - COOKIE_SENSOR_TYPE_BITS)
36
37#define COOKIE_SENSOR_TYPE_SHIFT 0
38#define COOKIE_SENSOR_PRIVATE_SHIFT COOKIE_SENSOR_TYPE_BITS
39#define COOKIE_TIMESTAMP_SHIFT (COOKIE_SENSOR_PRIVATE_BITS + COOKIE_SENSOR_TYPE_BITS)
40
41#define COOKIE_SENSOR_TYPE_MASK (((1 << COOKIE_SENSOR_TYPE_BITS) - 1) << COOKIE_SENSOR_TYPE_SHIFT)
42#define COOKIE_SENSOR_PRIVATE_MASK (((1 << COOKIE_SENSOR_PRIVATE_BITS) - 1) << COOKIE_SENSOR_PRIVATE_SHIFT)
43#define COOKIE_TIMESTAMP_MASK (((1 << COOKIE_TIMESTAMP_BITS) - 1) << COOKIE_TIMESTAMP_SHIFT)
44
45#define SENSOR_TYPE_PRIVATE_BIT_POS 16
46#define TIMESTAMP_SCALE_SHIFT 16 // divide by 65536
47
48#define COOKIE(sensor_type,timestamp) \
49 (((sensor_type >> (COOKIE_TOTAL_BITS - SENSOR_TYPE_PRIVATE_BIT_POS - COOKIE_SENSOR_PRIVATE_SHIFT)) & COOKIE_SENSOR_PRIVATE_MASK) | \
50 ((sensor_type << COOKIE_SENSOR_TYPE_SHIFT) & COOKIE_SENSOR_TYPE_MASK) | \
51 (((timestamp >> TIMESTAMP_SCALE_SHIFT) << COOKIE_TIMESTAMP_SHIFT) & COOKIE_TIMESTAMP_MASK))
52
53#endif /* _LINUX_TRACE_EVENTS_NVS_SENSORS_H */