diff options
author | Igor Nabirushkin <inabirushkin@nvidia.com> | 2014-06-24 12:18:29 +0400 |
---|---|---|
committer | Mandar Padmawar <mpadmawar@nvidia.com> | 2014-07-07 01:41:54 -0700 |
commit | af592f50958d0d9ea21ae43459fa0a421f1a1fab (patch) | |
tree | 6e623aa2344b693fa2c80ebba330e1ed33798418 /drivers/misc | |
parent | 344d03dde436b11fdff8aeec826af54e1a6cb7be (diff) |
misc: tegra-profiler: add time source option
* Add time source option (CNTVCT or kernel monotonic clock).
* Do not use arch timer if user does not have direct access to
CNTVCT register.
Bug 1508327
Change-Id: I0efc619146c1256ac57120b8646ecd8e819a1315
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/427620
(cherry picked from commit 5e375e6dbca8211bb2af04bd25d5e5d66371aa4f)
Reviewed-on: http://git-master/r/433507
Reviewed-by: Andrey Trachenko <atrachenko@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Maxim Morin <mmorin@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/tegra-profiler/hrt.c | 49 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/hrt.h | 2 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/main.c | 2 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/quadd_proc.c | 4 | ||||
-rw-r--r-- | drivers/misc/tegra-profiler/version.h | 2 |
5 files changed, 40 insertions, 19 deletions
diff --git a/drivers/misc/tegra-profiler/hrt.c b/drivers/misc/tegra-profiler/hrt.c index 22ba32ef37c3..0a1da9145c11 100644 --- a/drivers/misc/tegra-profiler/hrt.c +++ b/drivers/misc/tegra-profiler/hrt.c @@ -114,10 +114,9 @@ u64 quadd_get_time(void) { struct timecounter *tc = hrt.tc; - if (tc) - return get_arch_time(tc); - else - return get_posix_clock_monotonic_time(); + return (tc && hrt.use_arch_timer) ? + get_arch_time(tc) : + get_posix_clock_monotonic_time(); } static void put_header(void) @@ -161,6 +160,9 @@ static void put_header(void) hdr->reserved |= hrt.unw_method << QUADD_HDR_UNW_METHOD_SHIFT; + if (hrt.use_arch_timer) + hdr->reserved |= QUADD_HDR_USE_ARCH_TIMER; + if (pmu) nr_events += pmu->get_current_events(events, max_events); @@ -591,18 +593,8 @@ int quadd_hrt_start(void) reset_cpu_ctx(); - put_header(); - extra = param->reserved[QUADD_PARAM_IDX_EXTRA]; - if (extra & QUADD_PARAM_EXTRA_GET_MMAP) { - err = quadd_get_current_mmap(param->pids[0]); - if (err) { - pr_err("error: quadd_get_current_mmap\n"); - return err; - } - } - if (extra & QUADD_PARAM_EXTRA_BT_MIXED) hrt.unw_method = QUADD_UNW_METHOD_MIXED; else if (extra & QUADD_PARAM_EXTRA_BT_UNWIND_TABLES) @@ -612,6 +604,23 @@ int quadd_hrt_start(void) else hrt.unw_method = QUADD_UNW_METHOD_NONE; + if (hrt.tc && (extra & QUADD_PARAM_EXTRA_USE_ARCH_TIMER)) + hrt.use_arch_timer = 1; + else + hrt.use_arch_timer = 0; + + pr_info("timer: %s\n", hrt.use_arch_timer ? "arch" : "monotonic clock"); + + put_header(); + + if (extra & QUADD_PARAM_EXTRA_GET_MMAP) { + err = quadd_get_current_mmap(param->pids[0]); + if (err) { + pr_err("error: quadd_get_current_mmap\n"); + return err; + } + } + if (ctx->pl310) ctx->pl310->start(); @@ -656,6 +665,16 @@ void quadd_hrt_get_state(struct quadd_module_state *state) state->nr_skipped_samples = 0; } +static void init_arch_timer(void) +{ + u32 cntkctl = arch_timer_get_cntkctl(); + + if (cntkctl & ARCH_TIMER_USR_VCT_ACCESS_EN) + hrt.tc = arch_timer_get_timecounter(); + else + hrt.tc = NULL; +} + struct quadd_hrt_ctx *quadd_hrt_init(struct quadd_ctx *ctx) { int cpu_id; @@ -677,7 +696,7 @@ struct quadd_hrt_ctx *quadd_hrt_init(struct quadd_ctx *ctx) hrt.ma_period = 0; atomic64_set(&hrt.counter_samples, 0); - hrt.tc = arch_timer_get_timecounter(); + init_arch_timer(); hrt.cpu_ctx = alloc_percpu(struct quadd_cpu_context); if (!hrt.cpu_ctx) diff --git a/drivers/misc/tegra-profiler/hrt.h b/drivers/misc/tegra-profiler/hrt.h index b32f037dba3e..c4393aa8562b 100644 --- a/drivers/misc/tegra-profiler/hrt.h +++ b/drivers/misc/tegra-profiler/hrt.h @@ -58,6 +58,8 @@ struct quadd_hrt_ctx { unsigned long rss_size_prev; struct timecounter *tc; + int use_arch_timer; + unsigned int unw_method; }; diff --git a/drivers/misc/tegra-profiler/main.c b/drivers/misc/tegra-profiler/main.c index 555cc259a0ce..0f364d773084 100644 --- a/drivers/misc/tegra-profiler/main.c +++ b/drivers/misc/tegra-profiler/main.c @@ -433,7 +433,7 @@ static void get_capabilities(struct quadd_comm_cap *cap) extra |= QUADD_COMM_CAP_EXTRA_UNW_ENTRY_TYPE; if (ctx.hrt->tc) - extra |= QUADD_COMM_CAP_EXTRA_USE_ARCH_TIMER; + extra |= QUADD_COMM_CAP_EXTRA_ARCH_TIMER; cap->reserved[QUADD_COMM_CAP_IDX_EXTRA] = extra; } diff --git a/drivers/misc/tegra-profiler/quadd_proc.c b/drivers/misc/tegra-profiler/quadd_proc.c index 12f5fc90cd91..779c79a9fb31 100644 --- a/drivers/misc/tegra-profiler/quadd_proc.c +++ b/drivers/misc/tegra-profiler/quadd_proc.c @@ -96,8 +96,8 @@ static int show_capabilities(struct seq_file *f, void *offset) YES_NO(extra & QUADD_COMM_CAP_EXTRA_UNWIND_MIXED)); seq_printf(f, "information about unwind entry: %s\n", YES_NO(extra & QUADD_COMM_CAP_EXTRA_UNW_ENTRY_TYPE)); - seq_printf(f, "use arch timer: %s\n", - YES_NO(extra & QUADD_COMM_CAP_EXTRA_USE_ARCH_TIMER)); + seq_printf(f, "arch timer is available: %s\n", + YES_NO(extra & QUADD_COMM_CAP_EXTRA_ARCH_TIMER)); seq_puts(f, "\n"); diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h index 1225073e2219..96299d576c4c 100644 --- a/drivers/misc/tegra-profiler/version.h +++ b/drivers/misc/tegra-profiler/version.h @@ -18,7 +18,7 @@ #ifndef __QUADD_VERSION_H #define __QUADD_VERSION_H -#define QUADD_MODULE_VERSION "1.75" +#define QUADD_MODULE_VERSION "1.76" #define QUADD_MODULE_BRANCH "Dev" #endif /* __QUADD_VERSION_H */ |