[Spice-devel] [PATCH spice-server] worker: Add some loop statistics
Jonathon Jongsma
jjongsma at redhat.com
Tue Aug 29 15:08:22 UTC 2017
Sure.
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
On Fri, 2017-08-25 at 15:00 +0100, Frediano Ziglio wrote:
> Trace the number of loops done processing display commands
> and the number of loops in which the queue was full.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> This patch came from quite ancien time when we were debugging
> the loop to understand some issues due to GLib integration.
> Was marked as "statistics from Jonathon".
> The initial patch was composed by a set of simple logs.
> As now the statistics code is compiled out by default is worth
> having in the main code.
> ---
> server/red-worker.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/server/red-worker.c b/server/red-worker.c
> index 03a409cd..ed538e95 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -77,6 +77,8 @@ struct RedWorker {
> RedStatNode stat;
> RedStatCounter wakeup_counter;
> RedStatCounter command_counter;
> + RedStatCounter full_loop_counter;
> + RedStatCounter total_loop_counter;
>
> int driver_cap_monitors_config;
>
> @@ -190,6 +192,8 @@ static int red_process_display(RedWorker *worker,
> int *ring_is_empty)
> return n;
> }
>
> + stat_inc_counter(worker->total_loop_counter, 1);
> +
> worker->process_display_generation++;
> *ring_is_empty = FALSE;
> while (red_channel_max_pipe_size(RED_CHANNEL(worker-
> >display_channel)) <= MAX_PIPE_SIZE) {
> @@ -270,6 +274,7 @@ static int red_process_display(RedWorker *worker,
> int *ring_is_empty)
> }
> }
> worker->was_blocked = TRUE;
> + stat_inc_counter(worker->full_loop_counter, 1);
> return n;
> }
>
> @@ -1322,6 +1327,8 @@ RedWorker* red_worker_new(QXLInstance *qxl,
> stat_init_node(&worker->stat, reds, NULL, worker_str, TRUE);
> stat_init_counter(&worker->wakeup_counter, reds, &worker->stat,
> "wakeups", TRUE);
> stat_init_counter(&worker->command_counter, reds, &worker->stat,
> "commands", TRUE);
> + stat_init_counter(&worker->full_loop_counter, reds, &worker-
> >stat, "full_loops", TRUE);
> + stat_init_counter(&worker->total_loop_counter, reds, &worker-
> >stat, "total_loops", TRUE);
>
> worker->dispatch_watch =
> worker->core.watch_add(&worker->core,
> dispatcher_get_recv_fd(dispatcher),
More information about the Spice-devel
mailing list