Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   Related Pages   Examples  

test_timer.cpp

/* Copyright (c) 2001 C. Grigorescu */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tip.h>

int main(int argc, char *argv[])
{
  // Test for the correct number of arguments in the command line.
  if (argc != 2) {
    cout << "Usage: " << argv[0] << " <input_image>" << endl;
    exit(0);
  }

  FloatImage im0;
  im0.readImage(argv[1]);

  // Create a Timer object.
  Timer t;
  FourierTransform a(im0);

  // Start the timer.
  t.Start();

  // Get the current time.
  float f1 = t.getTime();
  float f2;
  for (int i=0;i<10;i++) {
    a.fft();  
    a.ifft();
    f2 = t.getTime();
    // Display the time elapsed between the last two calls to getTime method.
    cout << "Time: " << f2 - f1 << endl;
  }
  // Stop the timer.
  t.Stop();

  // Display the time elapsed between the starting and the stopping of the timer.
  t.Print();
}