
// openpluginlib - A plugin interface to openlibraries.

// Copyright (C) 2005-2006 Editopia Inc.
// Released under the LGPL.
// For more information, see http://www.openlibraries.org.

#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

#include <iostream>

#include <openpluginlib/pl/timer.hpp>

namespace opl = olib::openpluginlib;

int main( )
{
#ifdef WIN32
	typedef opl::rdtsc_default_timer::value_type value_type;
	opl::rdtsc_default_timer r;
#endif

	r.reset( );
	std::cout << "rdtsc: ticks per microsecond " << r.ticks( ) << ".\n";

	value_type one_second = { 1, 0 };

	r.start( );
	r.sleep( one_second );
	r.stop( );
	
	value_type elapsed = r.elapsed( );
	std::cout << "rdtsc: elapsed time is " << elapsed.tv_sec << " seconds and " << elapsed.tv_usec << " microseconds.\n";
}
