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 <asahukar@codeaurora.org>
This commit is contained in:
Akshata Sahukar
2021-04-21 18:04:44 -07:00
parent cf3fd457b3
commit 90658c5592
4 changed files with 38 additions and 7 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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,