From a2846faa321fdfd57af01a21c2df08e5b5ffb6ca Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 10 Apr 2020 00:55:39 +0200 Subject: player, stats: more silly debug stuff In addition to stats.c being gross, I don't think master branch code should be littered with debug code. But it's a helpful abomination. --- player/core.h | 1 + player/loadfile.c | 3 +-- player/main.c | 2 ++ player/playloop.c | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) (limited to 'player') diff --git a/player/core.h b/player/core.h index a78b2b2a37..e9f9835f3a 100644 --- a/player/core.h +++ b/player/core.h @@ -240,6 +240,7 @@ typedef struct MPContext { struct mpv_global *global; struct MPOpts *opts; struct mp_log *log; + struct stats_ctx *stats; struct m_config *mconfig; struct input_ctx *input; struct mp_client_api *clients; diff --git a/player/loadfile.c b/player/loadfile.c index 2490cfa996..b922a46cc9 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1774,8 +1774,7 @@ struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction, // Return if all done. void mp_play_files(struct MPContext *mpctx) { - struct stats_ctx *stats = stats_ctx_create(mpctx, mpctx->global, "main"); - stats_register_thread_cputime(stats, "thread"); + stats_register_thread_cputime(mpctx->stats, "thread"); // Wait for all scripts to load before possibly starting playback. if (!mp_clients_all_initialized(mpctx)) { diff --git a/player/main.c b/player/main.c index b5695a663a..25bf22ef5a 100644 --- a/player/main.c +++ b/player/main.c @@ -283,6 +283,8 @@ struct MPContext *mp_create(void) mpctx->log = mp_log_new(mpctx, mpctx->global->log, "!cplayer"); mpctx->statusline = mp_log_new(mpctx, mpctx->log, "!statusline"); + mpctx->stats = stats_ctx_create(mpctx, mpctx->global, "main"); + // Create the config context and register the options mpctx->mconfig = m_config_new(mpctx, mpctx->log, &mp_opt_root); mpctx->opts = mpctx->mconfig->optstruct; diff --git a/player/playloop.c b/player/playloop.c index a103de59f1..c2e9f5efef 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -29,6 +29,7 @@ #include "common/common.h" #include "common/encode.h" #include "common/recorder.h" +#include "common/stats.h" #include "filters/f_decoder_wrapper.h" #include "options/m_config_frontend.h" #include "options/m_property.h" @@ -57,6 +58,8 @@ void mp_wait_events(struct MPContext *mpctx) { mp_client_send_property_changes(mpctx); + stats_event(mpctx->stats, "iterations"); + bool sleeping = mpctx->sleeptime > 0; if (sleeping) MP_STATS(mpctx, "start sleep"); -- cgit v1.2.3