mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
video: rockchip: rve: Optimize statistics on bandwidth & cycle
Signed-off-by: Li Huang <putin.li@rock-chips.com> Change-Id: I9260b41adbc5a1a0bab6be099fd40971324586ce
This commit is contained in:
@@ -159,6 +159,10 @@ struct rve_sche_pid_info_t {
|
||||
pid_t pid;
|
||||
/* hw total use time, per hrtimer */
|
||||
u32 hw_time_total;
|
||||
|
||||
uint32_t last_job_rd_bandwidth;
|
||||
uint32_t last_job_wr_bandwidth;
|
||||
uint32_t last_job_cycle_cnt;
|
||||
};
|
||||
|
||||
struct rve_sche_session_info_t {
|
||||
|
||||
@@ -82,7 +82,7 @@ int rve_init_reg(struct rve_job *job);
|
||||
int rve_get_version(struct rve_scheduler_t *scheduler);
|
||||
|
||||
void rve_dump_read_back_reg(struct rve_scheduler_t *scheduler);
|
||||
void rve_get_monitor_info(struct rve_scheduler_t *scheduler);
|
||||
void rve_get_monitor_info(struct rve_job *job);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -171,11 +171,18 @@ static int rve_load_show(struct seq_file *m, void *data)
|
||||
|
||||
load = (busy_time_total * 100000 / RVE_LOAD_INTERVAL);
|
||||
seq_printf(m, "\t load = %d\n", load);
|
||||
seq_printf(m, "-----------------------------------\n");
|
||||
|
||||
seq_printf(m, "---------------- PID INFO ---------------\n");
|
||||
|
||||
for (i = 0; i < RVE_MAX_PID_INFO; i++) {
|
||||
seq_printf(m, "\t [pid: %d] hw_time_total = %llu us\n",
|
||||
pid_info[i].pid, ktime_to_us(pid_info[i].hw_time_total));
|
||||
seq_printf(m, "\t\t last_job_rd_bandwidth: %u bytes/s\n",
|
||||
pid_info[i].last_job_rd_bandwidth);
|
||||
seq_printf(m, "\t\t last_job_wr_bandwidth: %u bytes/s\n",
|
||||
pid_info[i].last_job_wr_bandwidth);
|
||||
seq_printf(m, "\t\t last_job_cycle_cnt/s: %u\n",
|
||||
pid_info[i].last_job_cycle_cnt);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,11 @@ static enum hrtimer_restart hrtimer_handler(struct hrtimer *timer)
|
||||
scheduler->timer.busy_time_record = scheduler->timer.busy_time;
|
||||
scheduler->timer.busy_time = 0;
|
||||
|
||||
/* monitor */
|
||||
scheduler->session.rd_bandwidth = 0;
|
||||
scheduler->session.wr_bandwidth = 0;
|
||||
scheduler->session.cycle_cnt = 0;
|
||||
|
||||
for (i = 0; i < RVE_MAX_PID_INFO; i++) {
|
||||
if (scheduler->session.pid_info[i].pid > 0)
|
||||
scheduler->session.pid_info[i].hw_time_total = 0;
|
||||
@@ -80,9 +85,6 @@ static enum hrtimer_restart hrtimer_handler(struct hrtimer *timer)
|
||||
idr_for_each(&ctx_manager->ctx_id_idr, &rve_ctx_set_debuf_info_cb, ctx_manager);
|
||||
|
||||
spin_unlock_irqrestore(&ctx_manager->lock, flags);
|
||||
|
||||
/* monitor */
|
||||
rve_get_monitor_info(scheduler);
|
||||
}
|
||||
|
||||
hrtimer_forward_now(timer, kt);
|
||||
|
||||
@@ -398,8 +398,10 @@ void rve_job_done(struct rve_scheduler_t *scheduler, int ret)
|
||||
|
||||
error_flag = rve_read(RVE_SWREG6_IVE_WORK_STA, scheduler);
|
||||
|
||||
rve_get_monitor_info(job);
|
||||
|
||||
if (DEBUGGER_EN(MSG))
|
||||
pr_err("irq thread work_status[%.8x]\n", error_flag);
|
||||
pr_info("irq thread work_status[%.8x]\n", error_flag);
|
||||
|
||||
/* disable llp enable, TODO: support pause mode */
|
||||
rve_write(0, RVE_SWLTB3_ENABLE, scheduler);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define pr_fmt(fmt) "rve_reg: " fmt
|
||||
|
||||
#include "rve_reg.h"
|
||||
#include "rve_job.h"
|
||||
|
||||
void rve_soft_reset(struct rve_scheduler_t *scheduler)
|
||||
{
|
||||
@@ -232,10 +233,16 @@ int rve_get_version(struct rve_scheduler_t *scheduler)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rve_get_monitor_info(struct rve_scheduler_t *scheduler)
|
||||
void rve_get_monitor_info(struct rve_job *job)
|
||||
{
|
||||
struct rve_sche_pid_info_t *pid_info = NULL;
|
||||
struct rve_scheduler_t *scheduler = NULL;
|
||||
unsigned long flags;
|
||||
uint32_t rd_bandwidth, wr_bandwidth, cycle_cnt;
|
||||
int i;
|
||||
|
||||
scheduler = rve_job_get_scheduler(job);
|
||||
pid_info = scheduler->session.pid_info;
|
||||
|
||||
/* monitor */
|
||||
if (DEBUGGER_EN(MONITOR)) {
|
||||
@@ -248,9 +255,22 @@ void rve_get_monitor_info(struct rve_scheduler_t *scheduler)
|
||||
|
||||
spin_lock_irqsave(&scheduler->irq_lock, flags);
|
||||
|
||||
scheduler->session.rd_bandwidth = rd_bandwidth;
|
||||
scheduler->session.wr_bandwidth = wr_bandwidth;
|
||||
scheduler->session.cycle_cnt = cycle_cnt;
|
||||
for (i = 0; i < RVE_MAX_PID_INFO; i++) {
|
||||
if (pid_info[i].pid == job->pid) {
|
||||
pid_info[i].last_job_rd_bandwidth = rd_bandwidth;
|
||||
pid_info[i].last_job_wr_bandwidth = wr_bandwidth;
|
||||
pid_info[i].last_job_cycle_cnt = cycle_cnt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (DEBUGGER_EN(MSG))
|
||||
pr_info("rd_bandwidth = %d, wd_bandwidth = %d, cycle_cnt = %d\n",
|
||||
rd_bandwidth, wr_bandwidth, cycle_cnt);
|
||||
|
||||
scheduler->session.rd_bandwidth += rd_bandwidth;
|
||||
scheduler->session.wr_bandwidth += wr_bandwidth;
|
||||
scheduler->session.cycle_cnt += cycle_cnt;
|
||||
|
||||
spin_unlock_irqrestore(&scheduler->irq_lock, flags);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user