[Xorp-users] CLI spin fix (hack)
Pavlin Radoslavov
pavlin at icir.org
Sat Sep 29 21:15:02 PDT 2007
Ben Greear <greearb at candelatech.com> wrote:
> It seems that if you pipe multiple commands into the CLI, it will busy
> spin waiting for the previous command to complete. Since 'commit'
> can take multiple seconds when adding an interface, this eats a lot
> of CPU.
Could you clarify what you mean by piping multiple commands into the
CLI. Is it when you use multiple "-c <cmd>" arguments after applying
your second patch.
> This hack below to cli/cli_node_net.cc 'fixes' the busy spin. It actually seems
> to me that we should block instead on receiving response from the manager
> process, or create the timer with a timeout, but I got lost in a maze of
> typedefs and templates trying to figure out how to do it right. Hopefully
> someone will know the right way to do this.
>
> if (! _pending_input_data.empty()) {
> schedule_process_input_data();
> // Sleep so we don't busy-spin when we have multiple
> // commands queued up and are waiting on response before
> // allowing the next command.
> usleep(50 * 1000); //50ms
> }
>
> Also, this patch below allows multiple -c "cmd" arguments to allow multiple commands
> to be piped into xorpsh from the command line. This patch may actually be
> worth applying as is.
Thanks, this seems a nice new feature so I just committed it.
Pavlin
>
> [root at nx5000 rtrmgr]# cvs diff -u xorpsh_main.cc
> Index: xorpsh_main.cc
> ===================================================================
> RCS file: /cvs/xorp/rtrmgr/xorpsh_main.cc,v
> retrieving revision 1.67
> diff -u -r1.67 xorpsh_main.cc
> --- xorpsh_main.cc 23 May 2007 04:08:30 -0000 1.67
> +++ xorpsh_main.cc 29 Sep 2007 18:28:00 -0000
> @@ -851,7 +853,8 @@
> while ((c = getopt(argc, argv, "c:t:x:vh")) != EOF) {
> switch(c) {
> case 'c':
> - commands = optarg;
> + commands += optarg;
> + commands += "\n";
> break;
> case 't':
> template_dir = optarg;
>
>
>
> --
> Ben Greear <greearb at candelatech.com>
> Candela Technologies Inc http://www.candelatech.com
>
> _______________________________________________
> Xorp-users mailing list
> Xorp-users at xorp.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-users
More information about the Xorp-users
mailing list