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

Re: Odd lag on a Shell command


On Tue, 13 Aug 2024 at 11:13, Benoît Minisini <
benoit.minisini@xxxxxxxxxxxxxxxx> wrote:

> Le 13/08/2024 à 11:43, Bruce Steers a écrit :
> > I'm making a project to list all my VBox VMs and let me mount the drives.
> >
> > It has a strange issue though.
> >
> > It uses the following shell command...
> > vboximg-mount -lv
> >
> > wen i run that in a terminal the output happens very fast.
> >
> > When running via gambas Shell or Exec it's taking 5.2 seconds
> >    Exec ["vboximg-mount", "-l", "-v"] To sRes
> >
> > But i'll say "usually" some days it seems to load with speed other days
> > it's slow.
> >
> > I have no idea what causes the command to run fast or slow it just
> > changes as i modify other parts of the project.
> >
> > Any ideas why it seems to run the command so slow?
> >
> > Many thanks
> > BruceS
>
> During the 5 seconds, you can run 'top' to see if CPU time is spent
> either in 'vboximg-mount' or in Gambas.
>
> You can use 'sudo gdb vboximg-mount <pid>' to stops the 'vboximg-mount'
> process inside gdb and see what it does. Same thing with 'sudo gdb gbr3
> <pid>' to stop the Gambas process.
>
> If the Gambas parent process has a GUI, you can try to switch between Qt
> and GTK+ to see if it makes a difference.
>
> The GTK+ component has to implement specific workarounds when managing
> child processes, because of a bad design bug in the underlying 'glib'
> library.
>
> --
> Benoît Minisini.
>

Cheers Ben

From what i can tell gbr3 shows higher with top in the 5 seconds.

I tried with qt , no difference to gtk.

I have worked around it like this...

  Shell "vboximg-mount -lv >/tmp/vms" Wait
  sRes = File.Load("/tmp/vms")

The above method is working in 204 miliseconds , much faster than this..
  Shell "vboximg-mount -lv" Wait To sRes

That is taking 5.2 seconds
Something seems not right

Respects
BruceS

References:
Odd lag on a Shell commandBruce Steers <bsteers4@xxxxxxxxx>
Re: Odd lag on a Shell commandBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>