calculate also speed-up factor
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@290 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
4e035929fd
commit
1eb831f009
2 changed files with 25 additions and 5 deletions
|
@ -29,19 +29,25 @@ public:
|
|||
|
||||
double sec(int t)
|
||||
{
|
||||
return floor(100.0*t/1000.0 )/100;
|
||||
return floor(100.0*double(t)/1000.0 )/100.0;
|
||||
}
|
||||
|
||||
int rel(int t)
|
||||
{
|
||||
return ( t100==0 ? 100 : (int) floor(100.0*t/t100+0.5) );
|
||||
}
|
||||
|
||||
double speedup(int t)
|
||||
{
|
||||
double tup=t;
|
||||
return (tup!=0 ? floor(100.0*(t100!=0?t100:tup)/tup+0.5)/100 : 1);
|
||||
}
|
||||
|
||||
double t100;
|
||||
|
||||
void print(int t, const char* s)
|
||||
{
|
||||
std::cout << s << rel(t) << "%, " << sec(t) << "s " << std::endl;
|
||||
std::cout << s <<"\trelative time: " << rel(t) << "%\tspeed-up factor: " << speedup(t) << "" << std::endl;
|
||||
}
|
||||
private:
|
||||
int t0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue