help-octave
[Top][All Lists]
Advanced

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

Re: Plotting with 3.2.0 on Windows is SLOOOOOOWWWW


From: Olli Saarela
Subject: Re: Plotting with 3.2.0 on Windows is SLOOOOOOWWWW
Date: Mon, 3 Aug 2009 13:41:02 +0300

Hi,

> octave-3.2.0 occupied 99% cpu activity and thus I guessed that
> the speed gnuplot made slower and thus led to slooooow plotting.

Such symptoms can arise if the lack of select() in Windows is worked
around with something like

  time_t now = time(NULL);
  while (time(NULL) < now + timeout) {
    PeekNamedPipe(read_handle, NULL, 0, NULL, &len, NULL));
    if (len > 0) // data is available
      break;
  }

which would consume all available CPU time until the program at the
other end of the pipe has written something.  If this is the case,
instead of treating the symptoms with changed process priorities you
might want to go closer to the root cause by adding a short sleep to
the code, e.g.,

  DWORD sleeptime = 1; // 1 millisecond
  time_t now = time(NULL);
  while (time(NULL) < now + timeout) {
    PeekNamedPipe(read_handle, NULL, 0, NULL, &len, NULL));
    if (len > 0) // data is available
      break;
    Sleep(sleeptime);
    if (sleeptime < 64)
       sleeptime *= 2;
  }

I don’t know my way around Octave’s C++ sources and couldn’t find
PeekNamedPipe in them, so I don’t really know if this is the case. The
actual loop structure (if any) could involve calling several functions
and instead of PeekNamedPipe can, e.g., call an unblocking read.
Anyway, I hope this helps debugging.

Cheers, Olli



reply via email to

[Prev in Thread] Current Thread [Next in Thread]