summaryrefslogtreecommitdiffstats
path: root/server/display-channel.c
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 /server/display-channel.c
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>
Diffstat (limited to 'server/display-channel.c')
-rw-r--r--server/display-channel.c100
1 files changed, 100 insertions, 0 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,