Browse Source

video: driver: Add support to print decode/encode stats

Add support to calculate and print encode and decode
time, and average time consumption per fbd sample.

Change-Id: I5e867833d1d88285bfebc8c9b9a593e3ed975ed5
Signed-off-by: Akshata Sahukar <[email protected]>
Akshata Sahukar 4 years ago
parent
commit
90658c5592

+ 1 - 0
driver/vidc/inc/msm_vidc_debug.h

@@ -135,5 +135,6 @@ void msm_vidc_debugfs_deinit_inst(void *inst);
 void msm_vidc_debugfs_update(void *inst,
 		enum msm_vidc_debugfs_event e);
 int msm_vidc_check_ratelimit(void);
+void msm_vidc_show_stats(void *inst);
 
 #endif

+ 4 - 4
driver/vidc/inc/msm_vidc_internal.h

@@ -637,12 +637,12 @@ struct buf_count {
 };
 
 struct profile_data {
-	u32                    start;
-	u32                    stop;
-	u32                    cumulative;
+	u64                    start;
+	u64                    stop;
+	u64                    cumulative;
 	char                   name[64];
 	u32                    sampling;
-	u32                    average;
+	u64                    average;
 };
 
 struct msm_vidc_debug {

+ 1 - 0
driver/vidc/src/msm_vidc.c

@@ -917,6 +917,7 @@ int msm_vidc_close(void *instance)
 	msm_vidc_remove_session(inst);
 	msm_vidc_destroy_buffers(inst);
 	mutex_unlock(&inst->lock);
+	msm_vidc_show_stats(inst);
 	put_inst(inst);
 	msm_vidc_schedule_core_deinit(core);
 

+ 32 - 3
driver/vidc/src/msm_vidc_debug.c

@@ -91,16 +91,45 @@ struct core_inst_pair {
 };
 
 /* debug fs support */
-
 static inline void tic(struct msm_vidc_inst *i, enum profiling_points p,
 				 char *b)
 {
-	return;
+	if (!i->debug.pdata[p].name[0])
+		memcpy(i->debug.pdata[p].name, b, 64);
+	if (i->debug.pdata[p].sampling) {
+		i->debug.pdata[p].start = ktime_get_ns() / 1000 / 1000;
+		i->debug.pdata[p].sampling = false;
+	}
 }
 
 static inline void toc(struct msm_vidc_inst *i, enum profiling_points p)
 {
-	return;
+	if (!i->debug.pdata[p].sampling) {
+		i->debug.pdata[p].stop = ktime_get_ns() / 1000 / 1000;
+		i->debug.pdata[p].cumulative += i->debug.pdata[p].stop -
+			i->debug.pdata[p].start;
+		i->debug.pdata[p].sampling = true;
+	}
+}
+
+void msm_vidc_show_stats(void *inst)
+{
+	int x;
+	struct msm_vidc_inst *i = (struct msm_vidc_inst *) inst;
+
+	for (x = 0; x < MAX_PROFILING_POINTS; x++) {
+		if (i->debug.pdata[x].name[0]) {
+			if (i->debug.samples) {
+				i_vpr_p(i, "%s averaged %d ms/sample\n",
+						i->debug.pdata[x].name,
+						i->debug.pdata[x].cumulative /
+						i->debug.samples);
+			}
+
+			i_vpr_p(i, "%s Samples: %d\n",
+				i->debug.pdata[x].name, i->debug.samples);
+		}
+	}
 }
 
 static u32 write_str(char *buffer,