diff options
| author | Suril <sdhruv@nvidia.com> | 2017-06-30 19:55:13 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-09-15 20:28:01 -0400 |
| commit | 90cb89ffc2b184618cbf34a2a1a9ab378458bca7 (patch) | |
| tree | 700b7b807edb5d0bc2bf3d6812e849ac17de9fee | |
| parent | 7ba0863b1c302187eacbdb65d35b9ba57b870724 (diff) | |
drivers: nvs-dfsh: Add tracing for sensor events
Enable atraces for sensor events. This helps in monitoring
performance of sensor packets by injecting timestamps
AV-388
Change-Id: I923af58747d641d3c3067978a26f1297217b4a29
Reviewed-on: https://git-master.nvidia.com/r/1511854
Signed-off-by: Suril Dhruv <sdhruv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1560224
Reviewed-by: Maneet Maneet Singh <mmaneetsingh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
| -rw-r--r-- | drivers/misc/nvs-dfsh/nvs_dfsh.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/misc/nvs-dfsh/nvs_dfsh.c b/drivers/misc/nvs-dfsh/nvs_dfsh.c index df397e6ce..4b59fdd25 100644 --- a/drivers/misc/nvs-dfsh/nvs_dfsh.c +++ b/drivers/misc/nvs-dfsh/nvs_dfsh.c | |||
| @@ -23,9 +23,12 @@ | |||
| 23 | #include <linux/nvs.h> | 23 | #include <linux/nvs.h> |
| 24 | #include <linux/crc32.h> | 24 | #include <linux/crc32.h> |
| 25 | #include <linux/time.h> | 25 | #include <linux/time.h> |
| 26 | |||
| 27 | #include "nvs_dfsh.h" | 26 | #include "nvs_dfsh.h" |
| 28 | 27 | ||
| 28 | #define CREATE_TRACE_POINTS | ||
| 29 | #include <trace/events/atrace.h> | ||
| 30 | #define TRACE_SENSOR_ID (100) | ||
| 31 | |||
| 29 | #define DFSH_DRIVER_VERSION (1) | 32 | #define DFSH_DRIVER_VERSION (1) |
| 30 | #define DFSH_NAME "dfsh" | 33 | #define DFSH_NAME "dfsh" |
| 31 | #define DFSH_POR_DELAY_MS (100) | 34 | #define DFSH_POR_DELAY_MS (100) |
| @@ -498,6 +501,13 @@ static inline void dfsh_parse_pkt(struct tty_struct *tty, unsigned char c) | |||
| 498 | static s64 prev_ktime; | 501 | static s64 prev_ktime; |
| 499 | static s64 prev_mcutime; | 502 | static s64 prev_mcutime; |
| 500 | struct sensor_sync_pkt_t sensor_sync_pkt; | 503 | struct sensor_sync_pkt_t sensor_sync_pkt; |
| 504 | int cookie; | ||
| 505 | |||
| 506 | ktime_get_ts64(&k_ts); | ||
| 507 | k_ts_ns = timespec_to_ns(&k_ts); | ||
| 508 | cookie = (int) k_ts_ns; | ||
| 509 | trace_async_atrace_begin(__func__, TRACE_SENSOR_ID, cookie); | ||
| 510 | |||
| 501 | /* sanity check index */ | 511 | /* sanity check index */ |
| 502 | if (st->pkt_byte_idx >= sizeof(st->pkt_buf)) | 512 | if (st->pkt_byte_idx >= sizeof(st->pkt_buf)) |
| 503 | /* Reset if byte index longer than longest packet */ | 513 | /* Reset if byte index longer than longest packet */ |
| @@ -543,8 +553,6 @@ static inline void dfsh_parse_pkt(struct tty_struct *tty, unsigned char c) | |||
| 543 | sizeof(ts)); | 553 | sizeof(ts)); |
| 544 | /*convert timestamp from usec to nsec*/ | 554 | /*convert timestamp from usec to nsec*/ |
| 545 | ts = ts * 1000; | 555 | ts = ts * 1000; |
| 546 | ktime_get_ts64(&k_ts); | ||
| 547 | k_ts_ns = timespec_to_ns(&k_ts); | ||
| 548 | if (prev_mcutime == ts) | 556 | if (prev_mcutime == ts) |
| 549 | k_ts_ns = prev_ktime; | 557 | k_ts_ns = prev_ktime; |
| 550 | if (st->pkt.header.type == MSG_CAMERA) { | 558 | if (st->pkt.header.type == MSG_CAMERA) { |
| @@ -600,6 +608,7 @@ static inline void dfsh_parse_pkt(struct tty_struct *tty, unsigned char c) | |||
| 600 | } | 608 | } |
| 601 | break; | 609 | break; |
| 602 | } | 610 | } |
| 611 | trace_async_atrace_end(__func__, TRACE_SENSOR_ID, cookie); | ||
| 603 | } | 612 | } |
| 604 | 613 | ||
| 605 | static void dfsh_receive_buf(struct tty_struct *tty, const unsigned char *cp, | 614 | static void dfsh_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
