TPIE

2362a60
Fraction database

When using fractional progress reporting, TPIE is able to measure and remember the proportion of execution time spent between the fractions.

The TPIE Hello world example program writes, sorts and verifies a stream of numbers. In the source code we do not have to specify how much time writing takes compared to sorting. Instead, we keep track of this information in an auxiliary file.

If helloworld is compiled without the NO_FRACTION_STATS define, upon exiting, the program will write the fraction database to a file named fractiondb.gen.inl. When compiled with the NO_FRACTION_STATS define, this file is included in the source code.

The following example is from the main function in helloworld.cpp. For load_fractions and save_fractions, include fractional_progress.h.

#ifndef NO_FRACTION_STATS
// initialize tpie subsystems and begin tracking progress
load_fractions("fractiondb.gen.inl");
go();
save_fractions("fractiondb.gen.inl");
#else
#include "fractiondb.gen.inl"
go();
#endif