- fann-1_2_0.zip
- fann-1.2.0
- aclocal.m4
- AUTHORS
- benchmarks
- .cvsignore
- benchmark.sh
- benchmarks.pdf
- ctimer.h
- datasets
- building.test
- building.train
- diabetes.test
- diabetes.train
- gene.test
- gene.train
- mushroom.test
- mushroom.train
- parity13.test
- parity13.train
- parity8.test
- parity8.train
- pumadyn-32fm.test
- pumadyn-32fm.train
- robot.test
- robot.train
- soybean.test
- soybean.train
- thyroid.test
- thyroid.train
- two-spiral.test
- two-spiral.train
- gnuplot
- Makefile
- parity.c
- performance.cc
- quality.cc
- quality_fixed.c
- README
- shuffle.c
- two-spirals.c
- ChangeLog
- config.guess
- config.in
- config.sub
- configure
- configure.in
- COPYING
- debian
- changelog
- compat
- control
- copyright
- docs
- libfann1.dirs
- libfann1.files
- libfann1.install
- libfann1-dev.dirs
- libfann1-dev.examples
- libfann1-dev.files
- libfann1-dev.install
- rules
- depcomp
- doc
- examples
- fann.pc.in
- fann.spec.in
- INSTALL
- install-sh
- ltmain.sh
- Makefile.am
- Makefile.in
- missing
- mkinstalldirs
- MSVC++
- all.dsw
- libfann.dsp
- simple_test.dsp
- simple_train.dsp
- steepness_train.dsp
- xor_test.dsp
- xor_train.dsp
- NEWS
- python
- README
- src
- TODO
- win32_dll
- vs_net2003.zip
- VS.NET2003
- all.sln
- libfann.vcproj
- simple_test.vcproj
- simple_train.vcproj
- steepness_train.vcproj
- xor_test.vcproj
- xor_train.vcproj
- fann_win32_dll-1_2_0.zip
|
#include <time.h>
clock_t startTime = 0;
clock_t middleEnd = 0;
clock_t middleBegin = 0;
clock_t endTime = 0;
clock_t curtime = 0;
double timePerIteration = 0;
clock_t getBeginTime()
{
clock_t beginTime;
clock_t lastTime = clock();
while((beginTime = clock()) == lastTime);
return beginTime;
}
clock_t getEndTime()
{
unsigned int i = 0;
clock_t beginTime = clock();
clock_t endTime = beginTime;
clock_t newEnd;
while((endTime = clock()) == beginTime) ++i;
newEnd = endTime - (clock_t)(timePerIteration * (double)(i));
return (newEnd > beginTime) ? newEnd : beginTime;
}
void start_timer()
{
middleEnd = 0;
middleBegin = 0;
endTime = 0;
curtime = 0;
startTime = getBeginTime();
}
void middle_time()
{
middleEnd = getEndTime();
middleBegin = getBeginTime();
}
double time_elapsed()
{
return (double)(clock() - startTime) / (double)(CLOCKS_PER_SEC);
}
void stop_timer()
{
endTime = getEndTime();
if(middleEnd){
curtime = (endTime - middleEnd) - (middleBegin - startTime);
}else{
curtime = endTime - startTime;
}
}
double getSecs()
{
return (double)(curtime) / (double)(CLOCKS_PER_SEC);
}
double getNanoPerN(unsigned int N)
{
return (getSecs() / (double)(N)) * (double)(1.0e9);
}
void calibrate_timer()
{
/* Calculating timePerIteration this will take arround a second. */
clock_t real_begin;
clock_t real_end;
unsigned int i = 0;
clock_t lastTime = getBeginTime();
real_begin = lastTime;
real_end = real_begin + CLOCKS_PER_SEC;
/* Looks a lot like the loop in getEndTime */
while((lastTime = clock()) < real_end) ++i;
timePerIteration = (double)(i) / (double)(lastTime - real_begin);
}
void printStatus()
{
printf("startTime = %lu, middleEnd = %lu, middleBegin = %lu, endTime = %lu, curtime = %lu, timePerIteration = %f\n",
startTime, middleEnd, middleBegin, endTime, curtime, timePerIteration);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.