[PATCH spice-server] worker: Add some loop statistics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
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),
-- 
2.13.5

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]