Search the Community
Showing results for tags 'xp sleep 500ms playsound'.
-
Hi, on different multicore PCs (I do not have this effect on single core machines.) Windows XP 32 bit (SP3) here behaves as follows: I run a small programm (like this in C++ for example) occupying the CPU and printing the time for one calculation step: #include <chrono> #include <iostream> #include <vector> void WasteTime() { std::vector<int> vec( 16777216, 42 ); for ( int i( 0 ); i < 8; ++i ) for ( auto it( vec.begin() ); it != vec.end(); ++it ) *it = (*it + 13)/2; } int main( int argc, char* argv[] ) { for (;;) { auto start(std::chrono::system_clock::now()); WasteTime(); auto end(std::chrono::system_clock::now()); int elapsed_milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count(); std::cout << "elapsed time in ms: " << elapsed_milliseconds << "\n"; } return 0; } Output: elapsed time in ms: 187 elapsed time in ms: 171 elapsed time in ms: 171 elapsed time in ms: 156 elapsed time in ms: 156 elapsed time in ms: 171 elapsed time in ms: 171 elapsed time in ms: 171 elapsed time in ms: 156 elapsed time in ms: 156 elapsed time in ms: 171 elapsed time in ms: 171 elapsed time in ms: 156 elapsed time in ms: 171 elapsed time in ms: 171 But if I play sounds in between, e.g. with clicking here ( http://daiw.de/share/PlaySound.jpg ), my program sometimes is put to sleep for 500ms: elapsed time in ms: 171 elapsed time in ms: 156 elapsed time in ms: 156 elapsed time in ms: 171 elapsed time in ms: 171 elapsed time in ms: 656 elapsed time in ms: 171 elapsed time in ms: 171 elapsed time in ms: 156 elapsed time in ms: 656 elapsed time in ms: 171 elapsed time in ms: 656 elapsed time in ms: 156 elapsed time in ms: 171 elapsed time in ms: 171 The ugly lines (six hundred something) occur frequently when I hit the play button in a rapid succession. Do you know this phenomenon of even its cause? If you have a XP PC there, could you check if your machine behaves the same way?