J
Jakub Moskal
Hi,
I want to write a benchmark that will measure performance of several
different algorithms for the same problem. There is a set time bound
though, the algorithm cannot run longer than n minutes.
Here is what the main program would do:
initializeVariables();
try
{
Timer.start(int n);
performAlgorithm_1();
Timer.stop();
cout << "Running time for algorithm_1 was " << Timer.runningTime();
}
catch (OutOfTimeException e)
{
cout << "Algorithm didin't finish in" << Timer.getN() << " minutes.";
}
The only way I see the timer to work and throw exception is to run it
as a thread in the background. If so, how do I stop the timer thread?
Any other ideas how to approach this problem?
Jakub
I want to write a benchmark that will measure performance of several
different algorithms for the same problem. There is a set time bound
though, the algorithm cannot run longer than n minutes.
Here is what the main program would do:
initializeVariables();
try
{
Timer.start(int n);
performAlgorithm_1();
Timer.stop();
cout << "Running time for algorithm_1 was " << Timer.runningTime();
}
catch (OutOfTimeException e)
{
cout << "Algorithm didin't finish in" << Timer.getN() << " minutes.";
}
The only way I see the timer to work and throw exception is to run it
as a thread in the background. If so, how do I stop the timer thread?
Any other ideas how to approach this problem?
Jakub