summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2015-11-12 13:25:09 +0000
committerFrediano Ziglio <fziglio@redhat.com>2015-11-12 13:25:09 +0000
commit1ab8df03ce0c731df0f93f4c334682782759d030 (patch)
treef8a80c365ada7ce2c346e834ea15e3fe1f211c45
parentf4810b0065c17506039e981349557cf95a8b08f7 (diff)
worker: fix compiling with COMPRESS_STAT enabled
Signed-off-by: Marc-AndrĂ© Lureau <marcandre.lureau@gmail.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Fabiano FidĂȘncio <fidencio@redhat.com>
-rw-r--r--server/display-channel.c20
-rw-r--r--server/red_worker.c18
-rw-r--r--server/stat.h6
3 files changed, 22 insertions, 22 deletions
diff --git a/server/display-channel.c b/server/display-channel.c
index b5d8830a..51302bdc 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -20,18 +20,18 @@
#include "display-channel.h"
-void display_channel_compress_stats_reset(DisplayChannel *display_channel)
+void display_channel_compress_stats_reset(DisplayChannel *display)
{
- spice_return_if_fail(display_channel);
+ spice_return_if_fail(display);
#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);
+ stat_reset(&display->quic_stat);
+ stat_reset(&display->lz_stat);
+ stat_reset(&display->glz_stat);
+ stat_reset(&display->jpeg_stat);
+ stat_reset(&display->zlib_glz_stat);
+ stat_reset(&display->jpeg_alpha_stat);
+ stat_reset(&display->lz4_stat);
#endif
}
@@ -46,7 +46,7 @@ void display_channel_compress_stats_print(const DisplayChannel *display_channel)
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("==> 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,
diff --git a/server/red_worker.c b/server/red_worker.c
index 633e1d0c..6bc015f3 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4180,7 +4180,7 @@ static inline int red_glz_compress_image(DisplayChannelClient *dcc,
DisplayChannel *display_channel = DCC_TO_DC(dcc);
RedWorker *worker = display_channel->common.worker;
#ifdef COMPRESS_STAT
- stat_time_t start_time = stat_now(worker->clockid);
+ stat_time_t start_time = stat_now(display_channel->zlib_glz_stat.clock);
#endif
spice_assert(bitmap_fmt_is_rgb(src->format));
GlzData *glz_data = &dcc->glz_data;
@@ -4223,7 +4223,7 @@ static inline int red_glz_compress_image(DisplayChannelClient *dcc,
goto glz;
}
#ifdef COMPRESS_STAT
- start_time = stat_now(worker->clockid);
+ start_time = stat_now(display_channel->zlib_glz_stat.clock);
#endif
zlib_data = &worker->zlib_data;
@@ -4286,7 +4286,7 @@ static inline int red_lz_compress_image(DisplayChannelClient *dcc,
int size; // size of the compressed data
#ifdef COMPRESS_STAT
- stat_time_t start_time = stat_now(worker->clockid);
+ stat_time_t start_time = stat_now(DCC_TO_DC(dcc)->lz_stat.clock);
#endif
lz_data->data.bufs_tail = red_display_alloc_compress_buf(dcc);
@@ -4347,7 +4347,7 @@ static inline int red_lz_compress_image(DisplayChannelClient *dcc,
o_comp_data->lzplt_palette = dest->u.lz_plt.palette;
}
- stat_compress_add(&display_channel->lz_stat, start_time, src->stride * src->y,
+ stat_compress_add(&DCC_TO_DC(dcc)->lz_stat, start_time, src->stride * src->y,
o_comp_data->comp_buf_size);
return TRUE;
}
@@ -4372,7 +4372,7 @@ static int red_jpeg_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
uint8_t *lz_out_start_byte;
#ifdef COMPRESS_STAT
- stat_time_t start_time = stat_now(worker->clockid);
+ stat_time_t start_time = stat_now(DCC_TO_DC(dcc)->jpeg_alpha_stat.clock);
#endif
switch (src->format) {
case SPICE_BITMAP_FMT_16BIT:
@@ -4446,7 +4446,7 @@ static int red_jpeg_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
o_comp_data->comp_buf_size = jpeg_size;
o_comp_data->is_lossy = TRUE;
- stat_compress_add(&display_channel->jpeg_stat, start_time, src->stride * src->y,
+ stat_compress_add(&DCC_TO_DC(dcc)->jpeg_stat, start_time, src->stride * src->y,
o_comp_data->comp_buf_size);
return TRUE;
}
@@ -4489,7 +4489,7 @@ static int red_jpeg_compress_image(DisplayChannelClient *dcc, SpiceImage *dest,
o_comp_data->comp_buf = jpeg_data->data.bufs_head;
o_comp_data->comp_buf_size = jpeg_size + alpha_lz_size;
o_comp_data->is_lossy = TRUE;
- stat_compress_add(&display_channel->jpeg_alpha_stat, start_time, src->stride * src->y,
+ stat_compress_add(&DCC_TO_DC(dcc)->jpeg_alpha_stat, start_time, src->stride * src->y,
o_comp_data->comp_buf_size);
return TRUE;
}
@@ -4572,7 +4572,7 @@ static inline int red_quic_compress_image(DisplayChannelClient *dcc, SpiceImage
int size, stride;
#ifdef COMPRESS_STAT
- stat_time_t start_time = stat_now(worker->clockid);
+ stat_time_t start_time = stat_now(DCC_TO_DC(dcc)->quic_stat.clock);
#endif
switch (src->format) {
@@ -4642,7 +4642,7 @@ static inline int red_quic_compress_image(DisplayChannelClient *dcc, SpiceImage
o_comp_data->comp_buf = quic_data->data.bufs_head;
o_comp_data->comp_buf_size = size << 2;
- stat_compress_add(&display_channel->quic_stat, start_time, src->stride * src->y,
+ stat_compress_add(&DCC_TO_DC(dcc)->quic_stat, start_time, src->stride * src->y,
o_comp_data->comp_buf_size);
return TRUE;
}
diff --git a/server/stat.h b/server/stat.h
index 52e6e781..3c980d04 100644
--- a/server/stat.h
+++ b/server/stat.h
@@ -87,13 +87,13 @@ static inline void stat_compress_init(stat_info_t *info, const char *name)
stat_reset(info);
}
-static inline void stat_compress_add(RedWorker *worker, stat_info_t *info,
+static inline void stat_compress_add(stat_info_t *info,
stat_time_t start, int orig_size,
int comp_size)
{
stat_time_t time;
++info->count;
- time = stat_now(worker) - start;
+ time = stat_now(info->clock) - start;
info->total += time;
info->max = MAX(info->max, time);
info->min = MIN(info->min, time);
@@ -101,7 +101,7 @@ static inline void stat_compress_add(RedWorker *worker, stat_info_t *info,
info->comp_size += comp_size;
}
-double inline stat_byte_to_mega(uint64_t size)
+static inline double stat_byte_to_mega(uint64_t size)
{
return (double)size / (1000 * 1000);
}