M
Marcelo R
I am not sure this is the best place to ask this; suggestions of alternative
forums will be greatly appreciated.
I am at my wits' end trying to understand a problem that I have with my
software and/or hardware and/or Windows. My company's software runs on an
industrial PC with a framegrabber board and some other hardware. The OS is
Windows XP SP2 and the compiler is Visual C++ 6.0. We noticed that sometimes
the software is MUCH slower than normal. Instead of acquiring and processing
20 video frames per second, it can take more than one second per frame. If I
exit the program and start it again, everything is normal. The program can
run for hours without any problem. If I exit and restart it again, it might
right away run very slowly.
My initial suspicion was that there was something wrong with the
framegrabber board or drivers. That is definitely not the case though, as I
wrote a test program that doesn't use the framegrabber at all and the
slowdown still happens. My test program is fairly simple: it runs 2000
iterations of a complex calculation and it measures the time (using the high
resolution timer) that each iteration takes. At the end it saves to a file
the total time that it took and the minimum and maximum time that each
iteration took. I call the program from inside a loop in a batch file. The
results are very strange. The program will run dozens of times with very
consistent results (for example total time 29 seconds, shortest iteration 14
ms, longest 17 ms) and then suddenly it will slow down. One run will total
640 seconds, with a minimum and maximum of 320 and 322 ms, then the next will
take nearly half an hour, with each iteration taking between 839 and 841 ms.
I would understand if some iterations within each run would take much longer
- that would be an indication that Windows is busy doing something else. But
that's not what's happening. Either the program starts correctly, in which
case all iterations will run in around 15 ms (that seems to be true
regardless of the number of iterations, two thousand or ten million), or
right from the first iteration every single one will take much longer. And
the minimum and maximum execution time for each iteration are always close.
The speed is either constantly normal, constantly slow or constantly VERY
slow.
To make matters more mysterious, the same thing does NOT happen when I run
the exact same batch file on my desktop or on my laptop or on a few other
different computers. On the industrial computers that my company uses,
however, it happens very consistently. I have tried running it on one of
these computers after doing a fresh Windows XP install, before installing any
other drivers and without connecting to the internet even once (so definitely
no viruses there). Same thing.
Any ideas or suggestions of how to go about troubleshooting this thing? I
have been working with C for twenty years, but I am really not all that
familiar with Windows' innards.
forums will be greatly appreciated.
I am at my wits' end trying to understand a problem that I have with my
software and/or hardware and/or Windows. My company's software runs on an
industrial PC with a framegrabber board and some other hardware. The OS is
Windows XP SP2 and the compiler is Visual C++ 6.0. We noticed that sometimes
the software is MUCH slower than normal. Instead of acquiring and processing
20 video frames per second, it can take more than one second per frame. If I
exit the program and start it again, everything is normal. The program can
run for hours without any problem. If I exit and restart it again, it might
right away run very slowly.
My initial suspicion was that there was something wrong with the
framegrabber board or drivers. That is definitely not the case though, as I
wrote a test program that doesn't use the framegrabber at all and the
slowdown still happens. My test program is fairly simple: it runs 2000
iterations of a complex calculation and it measures the time (using the high
resolution timer) that each iteration takes. At the end it saves to a file
the total time that it took and the minimum and maximum time that each
iteration took. I call the program from inside a loop in a batch file. The
results are very strange. The program will run dozens of times with very
consistent results (for example total time 29 seconds, shortest iteration 14
ms, longest 17 ms) and then suddenly it will slow down. One run will total
640 seconds, with a minimum and maximum of 320 and 322 ms, then the next will
take nearly half an hour, with each iteration taking between 839 and 841 ms.
I would understand if some iterations within each run would take much longer
- that would be an indication that Windows is busy doing something else. But
that's not what's happening. Either the program starts correctly, in which
case all iterations will run in around 15 ms (that seems to be true
regardless of the number of iterations, two thousand or ten million), or
right from the first iteration every single one will take much longer. And
the minimum and maximum execution time for each iteration are always close.
The speed is either constantly normal, constantly slow or constantly VERY
slow.
To make matters more mysterious, the same thing does NOT happen when I run
the exact same batch file on my desktop or on my laptop or on a few other
different computers. On the industrial computers that my company uses,
however, it happens very consistently. I have tried running it on one of
these computers after doing a fresh Windows XP install, before installing any
other drivers and without connecting to the internet even once (so definitely
no viruses there). Same thing.
Any ideas or suggestions of how to go about troubleshooting this thing? I
have been working with C for twenty years, but I am really not all that
familiar with Windows' innards.