Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

Measure Class Reference

#include <Measure.hpp>

List of all members.

Public Methods

 Measure ()
void setClockPeriod (ULONG nsec=Period_1_ms)
__inline _uint64 getCycles ()
__inline double getCPUfreq ()
__inline ULONG getClockPeriod ()
__inline double start ()
__inline double stop ()
__inline double getElapsed ()
__inline void print ()
 Measure (const Measure &src)
const Measure & operator= (const Measure &src)

Static Public Attributes

const ULONG Period_1_ms = 1000000L
const ULONG Period_10_ms = 10000000L
const ULONG Period_100_ms = 100000000L

Static Protected Attributes

double cpu_freq = 0.00f
ULONG clock_period = Period_1_ms

Private Attributes

double elapsed
_uint64 start_time
_uint64 stop_time
_clockperiod clkper


Constructor & Destructor Documentation

Measure::Measure  
 

Definition at line 15 of file Measure.cpp.

00016  : elapsed( 0.0f ), start_time( 0ull ), stop_time( 0ull )
00017 { 
00018 
00019   // Get the CPU frequency in order to do a precide time calculation
00020   cpu_freq = SYSPAGE_ENTRY( qtime )->cycles_per_sec;
00021 
00022   setClockPeriod();
00023 }

Measure::Measure const Measure &    src [inline]
 

Definition at line 43 of file Measure.inl.

00044  : elapsed( src.elapsed ),
00045    start_time( src.start_time ), stop_time( src.stop_time ) { }


Member Function Documentation

double Measure::getCPUfreq   [inline]
 

Definition at line 9 of file Measure.inl.

00010 {
00011   return cpu_freq;
00012 }

ULONG Measure::getClockPeriod   [inline]
 

Definition at line 14 of file Measure.inl.

00015 { 
00016   return clock_period;
00017 }

_uint64 Measure::getCycles   [inline]
 

Definition at line 4 of file Measure.inl.

00005 {
00006   return ClockCycles();
00007 }

double Measure::getElapsed   [inline]
 

Definition at line 32 of file Measure.inl.

00033 {
00034    elapsed = ( stop_time - start_time ) / cpu_freq;
00035    return elapsed;
00036 }

const Measure & Measure::operator= const Measure &    src [inline]
 

Definition at line 47 of file Measure.inl.

00048 {
00049   elapsed    = src.elapsed;
00050   start_time = src.start_time;
00051   stop_time  = src.stop_time;
00052 }

void Measure::print   [inline]
 

Definition at line 38 of file Measure.inl.

00039 {
00040   printf( "%6.4f ms", elapsed * Period_1_ms );
00041 }

void Measure::setClockPeriod ULONG    nsec = Period_1_ms
 

Definition at line 25 of file Measure.cpp.

00026 {
00027   // Set the system clock period to 1 ms, 
00028   // a frequency that works with any 40 MHz or higher speed
00029   // processor, including the low speed Elan-104 boards running at 66 MHz
00030   // and the blazing fast Pentium III.
00031 
00032   clock_period = nsec;
00033 
00034   // There is only two data member in clkper:
00035   clkper.nsec  = nsec;
00036   clkper.fract = 0;
00037   ClockPeriod( CLOCK_REALTIME, &clkper, NULL, 0 );  // 1 ms
00038 }

double Measure::start   [inline]
 

Definition at line 19 of file Measure.inl.

00020 {
00021   start_time = ClockCycles();
00022   return ( start_time / cpu_freq );
00023 }

double Measure::stop   [inline]
 

Definition at line 25 of file Measure.inl.

00026 {
00027   stop_time  = ClockCycles();
00028   return ( stop_time  / cpu_freq );
00029 }


Member Data Documentation

const ULONG Measure::Period_100_ms = 100000000L [static]
 

Definition at line 10 of file Measure.cpp.

const ULONG Measure::Period_10_ms = 10000000L [static]
 

Definition at line 9 of file Measure.cpp.

const ULONG Measure::Period_1_ms = 1000000L [static]
 

Definition at line 8 of file Measure.cpp.

struct _clockperiod Measure::clkper [private]
 

Definition at line 45 of file Measure.hpp.

ULONG Measure::clock_period = Period_1_ms [static, protected]
 

Definition at line 13 of file Measure.cpp.

double Measure::cpu_freq = 0.00f [static, protected]
 

Definition at line 12 of file Measure.cpp.

double Measure::elapsed [private]
 

Definition at line 40 of file Measure.hpp.

Referenced by operator=().

_uint64 Measure::start_time [private]
 

Definition at line 42 of file Measure.hpp.

Referenced by operator=().

_uint64 Measure::stop_time [private]
 

Definition at line 43 of file Measure.hpp.

Referenced by operator=().


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:49:23 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001