]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00171731 ipuv3 dev: add time statistic for each task
authorJason Chen <b02280@freescale.com>
Wed, 11 Jan 2012 06:03:42 +0000 (14:03 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:47 +0000 (08:33 +0200)
add time statistic for each task

Signed-off-by: Jason Chen <b02280@freescale.com>
drivers/mxc/ipu3/ipu_device.c

index 9395d8a6661cfd135c69ef73ce7a7b2d384541e6..15d7d1119c792eb6dd1ff30f189c04942e05bcb5 100644 (file)
@@ -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;