Re: [server PATCH 2/3] replay: learn how to skip the first N (slow) commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> Note that the commands are executed by spice-server.
> The "skip" is only done on the "sleep" part of the
> "slow" command-line option.
> 
> This is helpful to run quickly through uninsteresting commands
> in a beginning of a recorded file and going slowly when
> interesting parts appear
> ---
>  server/tests/replay.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/server/tests/replay.c b/server/tests/replay.c
> index 83411d3..4fcbc3e 100644
> --- a/server/tests/replay.c
> +++ b/server/tests/replay.c
> @@ -47,6 +47,7 @@ static QXLWorker *qxl_worker = NULL;
>  static gboolean started = FALSE;
>  static QXLInstance display_sin = { 0, };
>  static gint slow = 0;
> +static gint skip = 0;
>  static gboolean do_count = 0;
>  static guint ncommands = 0;
>  static pid_t client_pid;
> @@ -123,8 +124,13 @@ static gboolean fill_queue_idle(gpointer user_data)
>              ncommands++;
>          }
>  
> -        if (slow)
> -            g_usleep(slow);
> +        if (slow) {
> +            if (skip > 0) {
> +                skip--;
> +            } else {
> +                g_usleep(slow);
> +            }
> +        }
>  

if you count always this can be something like

  if (slow && ncommands > skip) {
     g_usleep(slow);
  }

(not the style, we always use brackets for if).

>          wakeup = TRUE;
>          g_async_queue_push(aqueue, cmd);
> @@ -303,6 +309,7 @@ int main(int argc, char **argv)
>          { "port", 'p', 0, G_OPTION_ARG_INT, &port, "Server port (default
>          5000)", "PORT" },
>          { "wait", 'w', 0, G_OPTION_ARG_NONE, &wait, "Wait for client", NULL
>          },
>          { "slow", 's', 0, G_OPTION_ARG_INT, &slow, "Slow down replay. Delays
>          USEC microseconds before each command", "USEC" },
> +        { "skip", 0, 0, G_OPTION_ARG_INT, &skip, "skip 'slow' for the first
> n commands", NULL },

here start the help with a capital letter.

>          { "count", 0, 0, G_OPTION_ARG_NONE, &do_count, "count the number of
>          commands", NULL },
>          { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &file,
>          "replay file", "FILE" },
>          { NULL }

I think these patches are really helpful!
In some cases I changed the replay code in others I waited long times.

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]