Skip to content

Commit

Permalink
common/stats: hide stats of dormant entities
Browse files Browse the repository at this point in the history
Zero elapsed time only introduces noise in stats page. Print only
scripts/stats that are useful.
  • Loading branch information
kasper93 committed Feb 24, 2025
1 parent 806b3e4 commit c015a4e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ void stats_global_query(struct mpv_global *global, struct mpv_node *out)
e->cpu_start_ns = t;
}
double t_cpu = MP_TIME_NS_TO_MS(e->val_th);
if (e->cpu_start_ns >= 0)
if (e->cpu_start_ns >= 0 && t_cpu > 0)
add_stat(out, e, "cpu", t_cpu, FMT_T(t_cpu, t_ms));
double t_rt = MP_TIME_NS_TO_MS(e->val_rt);
add_stat(out, e, "time", t_rt, FMT_T(t_rt, t_ms));
if (t_cpu > 0)
add_stat(out, e, "time", t_rt, FMT_T(t_rt, t_ms));
e->val_rt = e->val_th = 0;
break;
}
Expand All @@ -197,7 +198,7 @@ void stats_global_query(struct mpv_global *global, struct mpv_node *out)
if (!e->cpu_start_ns)
e->cpu_start_ns = t;
double t_msec = MP_TIME_NS_TO_MS(t - e->cpu_start_ns);
if (e->cpu_start_ns >= 0)
if (e->cpu_start_ns >= 0 && t_msec > 0)
add_stat(out, e, NULL, t_msec, FMT_T(t_msec, t_ms));
e->cpu_start_ns = t;
break;
Expand Down

0 comments on commit c015a4e

Please sign in to comment.