[Spice-devel] [PATCH 2/4] stat: fix stat_into_t initialization

Frediano Ziglio fziglio at redhat.com
Wed Dec 2 03:43:08 PST 2015


For compression statistics clock field was not initialized but used
computing statistics.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/display-channel.c | 14 +++++++-------
 server/stat.h            |  5 +++--
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index 580025f..4ef5524 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1794,13 +1794,13 @@ DisplayChannel* display_channel_new(RedWorker *worker, int migrate, int stream_v
     display->non_cache_counter = stat_add_counter(channel->stat,
                                                           "non_cache", TRUE);
 #endif
-    stat_compress_init(&display->lz_stat, "lz");
-    stat_compress_init(&display->glz_stat, "glz");
-    stat_compress_init(&display->quic_stat, "quic");
-    stat_compress_init(&display->jpeg_stat, "jpeg");
-    stat_compress_init(&display->zlib_glz_stat, "zlib");
-    stat_compress_init(&display->jpeg_alpha_stat, "jpeg_alpha");
-    stat_compress_init(&display->lz4_stat, "lz4");
+    stat_compress_init(&display->lz_stat, "lz", red_worker_get_clockid(worker));
+    stat_compress_init(&display->glz_stat, "glz", red_worker_get_clockid(worker));
+    stat_compress_init(&display->quic_stat, "quic", red_worker_get_clockid(worker));
+    stat_compress_init(&display->jpeg_stat, "jpeg", red_worker_get_clockid(worker));
+    stat_compress_init(&display->zlib_glz_stat, "zlib", red_worker_get_clockid(worker));
+    stat_compress_init(&display->jpeg_alpha_stat, "jpeg_alpha", red_worker_get_clockid(worker));
+    stat_compress_init(&display->lz4_stat, "lz4", red_worker_get_clockid(worker));
 
     display->n_surfaces = n_surfaces;
     display->num_renderers = num_renderers;
diff --git a/server/stat.h b/server/stat.h
index da432eb..5e8fc32 100644
--- a/server/stat.h
+++ b/server/stat.h
@@ -81,9 +81,10 @@ static inline void stat_reset(stat_info_t *info)
 }
 
 #ifdef COMPRESS_STAT
-static inline void stat_compress_init(stat_info_t *info, const char *name)
+static inline void stat_compress_init(stat_info_t *info, const char *name, clockid_t clock)
 {
     info->name = name;
+    info->clock = clock;
     stat_reset(info);
 }
 
@@ -107,7 +108,7 @@ static inline double stat_byte_to_mega(uint64_t size)
 }
 
 #else
-#define stat_compress_init(a, b)
+#define stat_compress_init(a, b, c)
 #define stat_compress_add(a, b, c, d)
 #endif
 
-- 
2.4.3



More information about the Spice-devel mailing list