[Spice-devel] [PATCH 16/18] server/red_worker: introduce an outgoing struct around out_bytes_counter
Alon Levy
alevy at redhat.com
Thu Feb 10 07:11:06 PST 2011
On Tue, Feb 08, 2011 at 10:00:33PM +0100, Marc-André Lureau wrote:
> Ok, I would get rid of "out_" prefix in out_bytes_counter.
>
> What's the motivation for this change?
Same as every change, to finally let red_worker.c reuse RedChannel. That
is all leading to making RedChannel handle multiple clients (which is
easier to do if you have a single RedChannel base struct), by introducing
a RedChannelClient (and later it becomes easy to hold all of a single client's
channels so there is a RedClient too at some point).
If you mean specifically here, I think the outgoing struct get's filled with
more later on, similar to what red_channel.c:RedChannel already has (so later
the final removal of the internal RedChannel in red_worker.c becomes a simpler
patch).
>
> On Mon, Feb 7, 2011 at 7:20 PM, Alon Levy <alevy at redhat.com> wrote:
> > ---
> > server/red_worker.c | 10 ++++++----
> > 1 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/server/red_worker.c b/server/red_worker.c
> > index 70ec871..0393d77 100644
> > --- a/server/red_worker.c
> > +++ b/server/red_worker.c
> > @@ -390,7 +390,9 @@ struct RedChannel {
> > release_item_proc release_item;
> > handle_parsed_proc handle_message;
> > #ifdef RED_STATISTICS
> > - uint64_t *out_bytes_counter;
> > + struct {
> > + uint64_t *out_bytes_counter;
> > + } outgoing;
> > #endif
> > };
> >
> > @@ -7367,7 +7369,7 @@ static void red_send_data(RedChannel *channel)
> > }
> > } else {
> > channel->send_data.pos += n;
> > - stat_inc_counter(channel->out_bytes_counter, n);
> > + stat_inc_counter(channel->outgoing.out_bytes_counter, n);
> > }
> > }
> > }
> > @@ -9497,7 +9499,7 @@ static void handle_new_display_channel(RedWorker *worker, RedsStreamContext *pee
> > }
> > #ifdef RED_STATISTICS
> > display_channel->stat = stat_add_node(worker->stat, "display_channel", TRUE);
> > - display_channel->common.base.out_bytes_counter = stat_add_counter(display_channel->stat,
> > + display_channel->common.base.outgoing.out_bytes_counter = stat_add_counter(display_channel->stat,
> > "out_bytes", TRUE);
> > display_channel->cache_hits_counter = stat_add_counter(display_channel->stat,
> > "cache_hits", TRUE);
> > @@ -9623,7 +9625,7 @@ static void red_connect_cursor(RedWorker *worker, RedsStreamContext *peer, int m
> > }
> > #ifdef RED_STATISTICS
> > channel->stat = stat_add_node(worker->stat, "cursor_channel", TRUE);
> > - channel->common.base.out_bytes_counter = stat_add_counter(channel->stat, "out_bytes", TRUE);
> > + channel->common.base.outgoing.out_bytes_counter = stat_add_counter(channel->stat, "out_bytes", TRUE);
> > #endif
> > ring_init(&channel->cursor_cache_lru);
> > channel->cursor_cache_available = CLIENT_CURSOR_CACHE_SIZE;
> > --
> > 1.7.4
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> >
>
>
>
> --
> Marc-André Lureau
More information about the Spice-devel
mailing list