From 6bf0a4b49ef81a0affbb642bfaf67e33b37c2f12 Mon Sep 17 00:00:00 2001 From: Saleh Dindar Date: Tue, 15 May 2018 09:35:02 -0700 Subject: nvhost:pva: Add VPU performance tracking VPU performance tracking is added by using post-actions and delivering results to the trace JIRA PVA-1087 Change-Id: Ia0030348665c8c0857cf107f4f76d9cc6052f1f2 Signed-off-by: Saleh Dindar Reviewed-on: https://git-master.nvidia.com/r/1719719 Reviewed-by: mobile promotions Tested-by: mobile promotions --- include/trace/events/nvhost_pva.h | 53 ++++++++++++++++++++++++++++++++++++++ include/uapi/linux/nvhost_events.h | 15 ++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/trace/events/nvhost_pva.h b/include/trace/events/nvhost_pva.h index 4571739f3..c921c5e08 100644 --- a/include/trace/events/nvhost_pva.h +++ b/include/trace/events/nvhost_pva.h @@ -140,6 +140,59 @@ TRACE_EVENT(nvhost_pva_task_stats, __entry->complete_time, __entry->vpu_assigned) ); +TRACE_EVENT(nvhost_pva_task_vpu_perf, + + TP_PROTO( + const char *name, + u32 index, + u32 count, + u32 sum, + u64 sum_squared, + u32 min, + u32 max + ), + + TP_ARGS( + name, + index, + count, + sum, + sum_squared, + min, + max + ), + + TP_STRUCT__entry( + __field(const char *, name) + __field(u32, index) + __field(u32, count) + __field(u32, sum) + __field(u64, sum_squared) + __field(u32, min) + __field(u32, max) + ), + + TP_fast_assign( + __entry->name = name; + __entry->index = index; + __entry->count = count; + __entry->sum = sum; + __entry->sum_squared = sum_squared; + __entry->min = min; + __entry->max = max; + ), + + TP_printk("%s\tindex: %u\tcount: %u\taverage: %u\t" + "variance: %llu\tminimum: %u\t" + "maximum: %u", + __entry->name, __entry->index, __entry->count, + __entry->sum / __entry->count, + ((u64)__entry->count * __entry->sum_squared - + (u64)__entry->sum * (u64)__entry->sum) + / __entry->count / __entry->count, + __entry->min, __entry->max) +); + #endif /* _TRACE_NVHOST_PVA_H */ /* This part must be outside protection */ diff --git a/include/uapi/linux/nvhost_events.h b/include/uapi/linux/nvhost_events.h index 0f1da7064..1282ee38a 100644 --- a/include/uapi/linux/nvhost_events.h +++ b/include/uapi/linux/nvhost_events.h @@ -67,6 +67,16 @@ struct nvhost_task_end { u32 syncpt_thresh; } __packed; +struct nvhost_vpu_perf_counter { + u32 operation; + u32 tag; + u32 count; + u32 average; + u64 variance; + u32 minimum; + u32 maximum; +} __packed; + enum { /* struct nvhost_task_submit */ NVHOST_TASK_SUBMIT = 0, @@ -77,7 +87,10 @@ enum { /* struct nvhost_task_end */ NVHOST_TASK_END = 2, - NVHOST_NUM_EVENT_TYPES = 3 + /* struct nvhost_vpu_perf_counter */ + NVHOST_VPU_PERF_COUNTER = 3, + + NVHOST_NUM_EVENT_TYPES = 4 }; enum { -- cgit v1.2.2