From f625f13d22999d00019d94e772fdc298033f7a23 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Wed, 11 Jan 2012 14:03:42 +0800 Subject: [PATCH] ENGR00171731 ipuv3 dev: add time statistic for each task add time statistic for each task Signed-off-by: Jason Chen --- drivers/mxc/ipu3/ipu_device.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/mxc/ipu3/ipu_device.c b/drivers/mxc/ipu3/ipu_device.c index 9395d8a6661c..15d7d1119c79 100644 --- a/drivers/mxc/ipu3/ipu_device.c +++ b/drivers/mxc/ipu3/ipu_device.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2011 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2005-2012 Freescale Semiconductor, Inc. All Rights Reserved. */ /* @@ -42,6 +42,8 @@ #include "ipu_regs.h" #include "ipu_param_mem.h" +#undef TIME_CALC + /* Strucutures and variables for exporting MXC IPU as device*/ typedef enum { STATE_OK = 0, @@ -1262,6 +1264,13 @@ int ipu_queue_task(struct ipu_task *task) struct ipu_task_entry *tsk; int ret; u32 tmp_task_no; +#ifdef TIME_CALC + struct timespec begin; + struct timespec end; + long time_per_frame; + + getnstimeofday(&begin); +#endif tsk = create_task_entry(task); if (IS_ERR(tsk)) @@ -1279,6 +1288,17 @@ int ipu_queue_task(struct ipu_task *task) ret = queue_split_task(tsk); else ret = queue_task(tsk); + +#ifdef TIME_CALC + getnstimeofday(&end); + if (end.tv_sec > begin.tv_sec) { + time_per_frame = (end.tv_sec - begin.tv_sec) * NSEC_PER_SEC; + time_per_frame += end.tv_nsec; + } else + time_per_frame = end.tv_nsec; + time_per_frame -= begin.tv_nsec; + dev_info(tsk->dev, "task take time %ld us\n", time_per_frame/1000); +#endif done: kfree(tsk); return ret; -- 2.39.5