[Spice-devel] [PATCH 10/11] worker: fix compiling with COMPRESS_STAT enabled

Frediano Ziglio fziglio at redhat.com
Wed Nov 11 06:58:20 PST 2015


> 
> On Wed, Nov 11, 2015 at 1:20 PM, Frediano Ziglio <fziglio at redhat.com> wrote:
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >  server/display-channel.c |  2 +-
> >  server/red_worker.c      | 18 +++++++++---------
> >  server/stat.h            |  6 +++---
> >  3 files changed, 13 insertions(+), 13 deletions(-)
> >
> > diff --git a/server/display-channel.c b/server/display-channel.c
> > index fbd8a0e..824f601 100644
> > --- a/server/display-channel.c
> > +++ b/server/display-channel.c
> > @@ -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 2132a3e..f37da2b 100644
> > --- a/server/red_worker.c
> > +++ b/server/red_worker.c
> > @@ -4014,7 +4014,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;
> > @@ -4057,7 +4057,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;
> >
> > @@ -4120,7 +4120,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);
> > @@ -4181,7 +4181,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;
> >  }
> > @@ -4206,7 +4206,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:
> > @@ -4280,7 +4280,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;
> >      }
> > @@ -4323,7 +4323,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;
> >  }
> > @@ -4406,7 +4406,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) {
> > @@ -4476,7 +4476,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 52e6e78..3c980d0 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);
> >  }
> > --
> > 2.4.3
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> Looks good. But I would squash this one to the previous one. (Feel
> free to ignore the suggestion).
> 

Same comment and Signed-off-by me and Marc is it alright ?

Frediano


More information about the Spice-devel mailing list