summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-09-13 21:25:29 +0200
committerFrediano Ziglio <fziglio@redhat.com>2015-11-06 09:35:16 +0000
commited70743f7c65a90b929c95b027080dc6efb5a945 (patch)
tree17ce98ca861e657c221060d90c4de3ab50afc71d
parente839dc23b3401fd93f13473af3301240418b0820 (diff)
downloadspice-ed70743f7c65a90b929c95b027080dc6efb5a945.tar.gz
spice-ed70743f7c65a90b929c95b027080dc6efb5a945.tar.xz
spice-ed70743f7c65a90b929c95b027080dc6efb5a945.zip
worker: move some compress stats to display
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
-rw-r--r--server/display-channel.c100
-rw-r--r--server/display-channel.h3
-rw-r--r--server/red_worker.c108
3 files changed, 107 insertions, 104 deletions
diff --git a/server/display-channel.c b/server/display-channel.c
index 3dc5a940..5deab130 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -16,6 +16,106 @@
*/
#include "display-channel.h"
+void display_channel_compress_stats_reset(DisplayChannel *display_channel)
+{
+ spice_return_if_fail(display_channel);
+
+#ifdef COMPRESS_STAT
+ stat_reset(&worker->display_channel->quic_stat);
+ stat_reset(&worker->display_channel->lz_stat);
+ stat_reset(&worker->display_channel->glz_stat);
+ stat_reset(&worker->display_channel->jpeg_stat);
+ stat_reset(&worker->display_channel->zlib_glz_stat);
+ stat_reset(&worker->display_channel->jpeg_alpha_stat);
+ stat_reset(&worker->display_channel->lz4_stat);
+#endif
+}
+
+void display_channel_compress_stats_print(const DisplayChannel *display_channel)
+{
+ spice_return_if_fail(display_channel);
+
+#ifdef COMPRESS_STAT
+ uint64_t glz_enc_size;
+
+ glz_enc_size = display_channel->enable_zlib_glz_wrap ?
+ display_channel->zlib_glz_stat.comp_size :
+ display_channel->glz_stat.comp_size;
+
+ spice_info("==> Compression stats for display %u", display_channel->common.id);
+ spice_info("Method \t count \torig_size(MB)\tenc_size(MB)\tenc_time(s)");
+ spice_info("QUIC \t%8d\t%13.2f\t%12.2f\t%12.2f",
+ display_channel->quic_stat.count,
+ stat_byte_to_mega(display_channel->quic_stat.orig_size),
+ stat_byte_to_mega(display_channel->quic_stat.comp_size),
+ stat_cpu_time_to_sec(display_channel->quic_stat.total)
+ );
+ spice_info("GLZ \t%8d\t%13.2f\t%12.2f\t%12.2f",
+ display_channel->glz_stat.count,
+ stat_byte_to_mega(display_channel->glz_stat.orig_size),
+ stat_byte_to_mega(display_channel->glz_stat.comp_size),
+ stat_cpu_time_to_sec(display_channel->glz_stat.total)
+ );
+ spice_info("ZLIB GLZ \t%8d\t%13.2f\t%12.2f\t%12.2f",
+ display_channel->zlib_glz_stat.count,
+ stat_byte_to_mega(display_channel->zlib_glz_stat.orig_size),
+ stat_byte_to_mega(display_channel->zlib_glz_stat.comp_size),
+ stat_cpu_time_to_sec(display_channel->zlib_glz_stat.total)
+ );
+ spice_info("LZ \t%8d\t%13.2f\t%12.2f\t%12.2f",
+ display_channel->lz_stat.count,
+ stat_byte_to_mega(display_channel->lz_stat.orig_size),
+ stat_byte_to_mega(display_channel->lz_stat.comp_size),
+ stat_cpu_time_to_sec(display_channel->lz_stat.total)
+ );
+ spice_info("JPEG \t%8d\t%13.2f\t%12.2f\t%12.2f",
+ display_channel->jpeg_stat.count,
+ stat_byte_to_mega(display_channel->jpeg_stat.orig_size),
+ stat_byte_to_mega(display_channel->jpeg_stat.comp_size),
+ stat_cpu_time_to_sec(display_channel->jpeg_stat.total)
+ );
+ spice_info("JPEG-RGBA\t%8d\t%13.2f\t%12.2f\t%12.2f",
+ display_channel->jpeg_alpha_stat.count,
+ stat_byte_to_mega(display_channel->jpeg_alpha_stat.orig_size),
+ stat_byte_to_mega(display_channel->jpeg_alpha_stat.comp_size),
+ stat_cpu_time_to_sec(display_channel->jpeg_alpha_stat.total)
+ );
+ spice_info("LZ4 \t%8d\t%13.2f\t%12.2f\t%12.2f",
+ display_channel->lz4_stat.count,
+ stat_byte_to_mega(display_channel->lz4_stat.orig_size),
+ stat_byte_to_mega(display_channel->lz4_stat.comp_size),
+ stat_cpu_time_to_sec(display_channel->lz4_stat.total)
+ );
+ spice_info("-------------------------------------------------------------------");
+ spice_info("Total \t%8d\t%13.2f\t%12.2f\t%12.2f",
+ display_channel->lz_stat.count + display_channel->glz_stat.count +
+ display_channel->quic_stat.count +
+ display_channel->jpeg_stat.count +
+ display_channel->lz4_stat.count +
+ display_channel->jpeg_alpha_stat.count,
+ stat_byte_to_mega(display_channel->lz_stat.orig_size +
+ display_channel->glz_stat.orig_size +
+ display_channel->quic_stat.orig_size +
+ display_channel->jpeg_stat.orig_size +
+ display_channel->lz4_stat.orig_size +
+ display_channel->jpeg_alpha_stat.orig_size),
+ stat_byte_to_mega(display_channel->lz_stat.comp_size +
+ glz_enc_size +
+ display_channel->quic_stat.comp_size +
+ display_channel->jpeg_stat.comp_size +
+ display_channel->lz4_stat.comp_size +
+ display_channel->jpeg_alpha_stat.comp_size),
+ stat_cpu_time_to_sec(display_channel->lz_stat.total +
+ display_channel->glz_stat.total +
+ display_channel->zlib_glz_stat.total +
+ display_channel->quic_stat.total +
+ display_channel->jpeg_stat.total +
+ display_channel->lz4_stat.total +
+ display_channel->jpeg_alpha_stat.total)
+ );
+#endif
+}
+
DisplayChannelClient *dcc_new(DisplayChannel *display,
RedClient *client, RedsStream *stream,
int mig_target,
diff --git a/server/display-channel.h b/server/display-channel.h
index d6d65e02..827a9d4f 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -360,4 +360,7 @@ struct DisplayChannel {
#endif
};
+void display_channel_compress_stats_print (const DisplayChannel *display);
+void display_channel_compress_stats_reset (DisplayChannel *display);
+
#endif /* DISPLAY_CHANNEL_H_ */
diff --git a/server/red_worker.c b/server/red_worker.c
index 31720d52..3ffb5768 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -604,95 +604,6 @@ void drawable_pipe_item_unref(DrawablePipeItem *dpi)
free(dpi);
}
-
-#ifdef COMPRESS_STAT
-static void print_compress_stats(DisplayChannel *display_channel)
-{
- uint64_t glz_enc_size;
-
- if (!display_channel) {
- return;
- }
-
- glz_enc_size = display_channel->enable_zlib_glz_wrap ?
- display_channel->zlib_glz_stat.comp_size :
- display_channel->glz_stat.comp_size;
-
- spice_info("==> Compression stats for display %u", display_channel->common.base.id);
- spice_info("Method \t count \torig_size(MB)\tenc_size(MB)\tenc_time(s)");
- spice_info("QUIC \t%8d\t%13.2f\t%12.2f\t%12.2f",
- display_channel->quic_stat.count,
- stat_byte_to_mega(display_channel->quic_stat.orig_size),
- stat_byte_to_mega(display_channel->quic_stat.comp_size),
- stat_cpu_time_to_sec(display_channel->quic_stat.total)
- );
- spice_info("GLZ \t%8d\t%13.2f\t%12.2f\t%12.2f",
- display_channel->glz_stat.count,
- stat_byte_to_mega(display_channel->glz_stat.orig_size),
- stat_byte_to_mega(display_channel->glz_stat.comp_size),
- stat_cpu_time_to_sec(display_channel->glz_stat.total)
- );
- spice_info("ZLIB GLZ \t%8d\t%13.2f\t%12.2f\t%12.2f",
- display_channel->zlib_glz_stat.count,
- stat_byte_to_mega(display_channel->zlib_glz_stat.orig_size),
- stat_byte_to_mega(display_channel->zlib_glz_stat.comp_size),
- stat_cpu_time_to_sec(display_channel->zlib_glz_stat.total)
- );
- spice_info("LZ \t%8d\t%13.2f\t%12.2f\t%12.2f",
- display_channel->lz_stat.count,
- stat_byte_to_mega(display_channel->lz_stat.orig_size),
- stat_byte_to_mega(display_channel->lz_stat.comp_size),
- stat_cpu_time_to_sec(display_channel->lz_stat.total)
- );
- spice_info("JPEG \t%8d\t%13.2f\t%12.2f\t%12.2f",
- display_channel->jpeg_stat.count,
- stat_byte_to_mega(display_channel->jpeg_stat.orig_size),
- stat_byte_to_mega(display_channel->jpeg_stat.comp_size),
- stat_cpu_time_to_sec(display_channel->jpeg_stat.total)
- );
- spice_info("JPEG-RGBA\t%8d\t%13.2f\t%12.2f\t%12.2f",
- display_channel->jpeg_alpha_stat.count,
- stat_byte_to_mega(display_channel->jpeg_alpha_stat.orig_size),
- stat_byte_to_mega(display_channel->jpeg_alpha_stat.comp_size),
- stat_cpu_time_to_sec(display_channel->jpeg_alpha_stat.total)
- );
- spice_info("LZ4 \t%8d\t%13.2f\t%12.2f\t%12.2f",
- display_channel->lz4_stat.count,
- stat_byte_to_mega(display_channel->lz4_stat.orig_size),
- stat_byte_to_mega(display_channel->lz4_stat.comp_size),
- stat_cpu_time_to_sec(display_channel->lz4_stat.total)
- );
- spice_info("-------------------------------------------------------------------");
- spice_info("Total \t%8d\t%13.2f\t%12.2f\t%12.2f",
- display_channel->lz_stat.count + display_channel->glz_stat.count +
- display_channel->quic_stat.count +
- display_channel->jpeg_stat.count +
- display_channel->lz4_stat.count +
- display_channel->jpeg_alpha_stat.count,
- stat_byte_to_mega(display_channel->lz_stat.orig_size +
- display_channel->glz_stat.orig_size +
- display_channel->quic_stat.orig_size +
- display_channel->jpeg_stat.orig_size +
- display_channel->lz4_stat.orig_size +
- display_channel->jpeg_alpha_stat.orig_size),
- stat_byte_to_mega(display_channel->lz_stat.comp_size +
- glz_enc_size +
- display_channel->quic_stat.comp_size +
- display_channel->jpeg_stat.comp_size +
- display_channel->lz4_stat.comp_size +
- display_channel->jpeg_alpha_stat.comp_size),
- stat_cpu_time_to_sec(display_channel->lz_stat.total +
- display_channel->glz_stat.total +
- display_channel->zlib_glz_stat.total +
- display_channel->quic_stat.total +
- display_channel->jpeg_stat.total +
- display_channel->lz4_stat.total +
- display_channel->jpeg_alpha_stat.total)
- );
-}
-
-#endif
-
QXLInstance* red_worker_get_qxl(RedWorker *worker)
{
spice_return_val_if_fail(worker != NULL, NULL);
@@ -7978,9 +7889,7 @@ static void display_channel_client_on_disconnect(RedChannelClient *rcc)
worker = common->worker;
display_channel = (DisplayChannel *)rcc->channel;
spice_assert(display_channel == worker->display_channel);
-#ifdef COMPRESS_STAT
- print_compress_stats(display_channel);
-#endif
+ display_channel_compress_stats_print(display_channel);
pixmap_cache_unref(dcc->pixmap_cache);
dcc->pixmap_cache = NULL;
red_release_glz(dcc);
@@ -10018,18 +9927,9 @@ void handle_dev_set_compression(void *opaque, void *payload)
default:
spice_warning("ic invalid");
}
-#ifdef COMPRESS_STAT
- print_compress_stats(worker->display_channel);
- if (worker->display_channel) {
- stat_reset(&worker->display_channel->quic_stat);
- stat_reset(&worker->display_channel->lz_stat);
- stat_reset(&worker->display_channel->glz_stat);
- stat_reset(&worker->display_channel->jpeg_stat);
- stat_reset(&worker->display_channel->zlib_glz_stat);
- stat_reset(&worker->display_channel->jpeg_alpha_stat);
- stat_reset(&worker->display_channel->lz4_stat);
- }
-#endif
+
+ display_channel_compress_stats_print(worker->display_channel);
+ display_channel_compress_stats_reset(worker->display_channel);
}
void handle_dev_set_streaming_video(void *opaque, void *payload)