On 2016-12-19 19:47-0000 p.d.rosenb...@gmail.com wrote: > Hi Alan
> I am on my commute home right now. But if you want to test if the random > number generator is the cause then find the Rand constructor – Rand::Rand() > and comment out everything, replacing it with a single line that sets the > seed (probably m_seed or something) to a fixed value, like 0. That will show > whether generating the seed is causing the slowdown. Hi Phil: Thanks to your leap of insight that it was entropy and the random number generator that was the source of the issue, I have now found the fix! My tests show all pauses are now gone after the following local change, but I need C++ help to finalize this fix. diff --git a/drivers/wxwidgets_dev.cpp b/drivers/wxwidgets_dev.cpp index 1131e9b..e0f215f 100644 --- a/drivers/wxwidgets_dev.cpp +++ b/drivers/wxwidgets_dev.cpp @@ -603,7 +603,7 @@ public: #ifdef WIN32 rand_s( &m_seed ); #else - std::fstream fin( "/dev/random", std::ios::in ); + std::fstream fin( "/dev/urandom", std::ios::in ); fin.read( (char *) ( &m_seed ), sizeof ( m_seed ) ); fin.close(); #endif The difference between /dev/random and /dev/urandom on Linux is the former is blocking (and therefore only recommended if you need highest security and are willing to wait for it) while the latter is not blocking and gives adequate pseudo-randomness for most purposes (such as ours). See <https://en.wikipedia.org/wiki//dev/random> for further details. The only trouble with the above fix is not every Unix platform has /dev/urandom (although from the above URL most do). So I would like to change the above fix to check for /dev/urandom and use it if it exists, but otherwise fall back to using /dev/random. How do I do that in C++? Or, better yet show me by going ahead and making the commit to that effect. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/intel _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel