From e7ee0bf5d1229e6f7d507e8d8929860410f6a854 Mon Sep 17 00:00:00 2001 From: Igor Nabirushkin Date: Mon, 16 Mar 2015 18:08:36 +0400 Subject: misc: tegra-profiler: add task states * Add task states into sched samples. * Store task exit_state field. Bug 1624099 Change-Id: I4a25aa6c15b59da987688342478127dccc5c0a1c Signed-off-by: Igor Nabirushkin Reviewed-on: http://git-master/r/717839 (cherry picked from commit 9c512cace5ad5d8719a5a8df553cd313e41f4402) Reviewed-on: http://git-master/r/747753 GVS: Gerrit_Virtual_Submit Reviewed-by: Andrey Trachenko Reviewed-by: Winnie Hsu --- drivers/misc/tegra-profiler/hrt.c | 14 +++++++++++--- drivers/misc/tegra-profiler/version.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/tegra-profiler/hrt.c b/drivers/misc/tegra-profiler/hrt.c index 8081a03cd6b1..88a0d967e096 100644 --- a/drivers/misc/tegra-profiler/hrt.c +++ b/drivers/misc/tegra-profiler/hrt.c @@ -51,6 +51,11 @@ struct hrt_event_value { u32 value; }; +static inline u32 get_task_state(struct task_struct *task) +{ + return (u32)(task->state | task->exit_state); +} + static enum hrtimer_restart hrtimer_handler(struct hrtimer *hrtimer) { struct pt_regs *regs; @@ -231,8 +236,8 @@ put_sched_sample(struct task_struct *task, int is_sched_in) s->reserved = 0; - s->data[0] = 0; - s->data[1] = 0; + s->data[QUADD_SCHED_IDX_TASK_STATE] = get_task_state(task); + s->data[QUADD_SCHED_IDX_RESERVED] = 0; quadd_put_sample_this_cpu(&record, NULL, 0); } @@ -354,6 +359,9 @@ read_all_sources(struct pt_regs *regs, struct task_struct *task) if (!task) task = current; + if (task_is_dead(task)) + return; + rcu_read_lock(); if (!task_nsproxy(task)) { rcu_read_unlock(); @@ -458,7 +466,7 @@ read_all_sources(struct pt_regs *regs, struct task_struct *task) vec[vec_idx].len = nr_positive_events * sizeof(events_extra[0]); vec_idx++; - state = task->state; + state = get_task_state(task); if (state) { s->state = 1; vec[vec_idx].base = &state; diff --git a/drivers/misc/tegra-profiler/version.h b/drivers/misc/tegra-profiler/version.h index bf4c27597c4a..f956c1d40861 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.95" +#define QUADD_MODULE_VERSION "1.96" #define QUADD_MODULE_BRANCH "Dev" #endif /* __QUADD_VERSION_H */ -- cgit v1.2.3