IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Lib::ThreadPerformanceTest Class Reference

Used to measure performance of the currend thread. A standard unit operation is provided for which number of executions per second is measured. Beside number of unit operations per second, the ratio between the CPU time and the clock time is calculated, which gives the feeling of how much the processor on which the thread executes is loaded. Measurements can be performed by specifying the requested number of cycles, but also by specifying the requested time in seconds. More...

Collaboration diagram for IG::Lib::ThreadPerformanceTest:

List of all members.

Public Member Functions

 ThreadPerformanceTest ()
void TestPerformanceNum (int numCycles, out ThreadPerformanceData data)
 Execute performance test with specified number of standard cycles. WARNING: Usually the TestPerformance should be used which prescribes the approximate time used for the test.
void TestPerformanceNum (int numCycles, out double cyclesPerSec, out double performanceRatio)
 Execute performance test with specified number of standard cycles. WARNING: Usually the TestPerformance should be used which prescribes the approximate time used for the test.
double TestPerformanceNum (int numCycles)
 Execute performance test with specified number of standard cycles, and returns the measured number of standard cycles performed per second (which is the relevant performance measure). WARNING: Usually the TestPerformance should be used which prescribes the approximate time used for the test.
void TestPerformance (double testDuration, out ThreadPerformanceData data)
 Execute performance test with specified measurement duration.
void TestPerformance (double testDuration, out double cyclesPerSec, out double performanceRatio)
 Execute performance test with specified measurement duration.
double TestPerformance (double testDuration)
 Execute performance test with specified measurement duration, and returns the measured number of standard cycles performed per second (which is the relevant performance measure).
override string ToString ()

Static Public Member Functions

static void StandardCycle ()
 A standard unit operation that is repeated in order to measure performance.
static void CreateThreadLoads (int numThreads)
 Starts the specified number of new load threads, each of which causes a full load to a CPU core until it stops. IMPORTANT: The load threads are switched off by setting ThreadPerformanceTest.PerformLoad to false. It can happen that this must be repeated several times to take effect.
static void Example ()
 Examples and tests for this class.

Public Attributes

const int NumInner = 10000
 Number of inner iterations. This number is chosen such that there are over 1000 outer cycles per second on medium speed modern processors.
const double RefCyclesPerSecond = 1600
 A reference number of cycles per second. This can be used for orientation of how many cycles to request.
const int MinCycles = 20
 Minimial number of cycles. Test never executes with less cycles because of accuracy of results.
ThreadPerformanceData Last
 Performance data of the last measurement performed.

Protected Member Functions

void StoreLast ()
 Stores the last performance data.

Static Protected Member Functions

static void ThreadLoadFunction ()
 Performed by load threads.

Static Protected Attributes

static bool _performLoad = false
static int _numLoadThreads = 0

Properties

object Lock [get]
List< ThreadPerformanceDataData [get]
 List of data aboud the performed tests.
static int NumLoadThreds [get, set]
 Returns the current number of alive loading threads performing full CPU load.
static bool PerformLoad [get, set]
 Specifies whether load should be performed. Setting this to false makes eventual threads to exit.

Private Attributes

object _lock = new Object()
List< ThreadPerformanceData_data = new List<ThreadPerformanceData>()

Detailed Description

Used to measure performance of the currend thread. A standard unit operation is provided for which number of executions per second is measured. Beside number of unit operations per second, the ratio between the CPU time and the clock time is calculated, which gives the feeling of how much the processor on which the thread executes is loaded. Measurements can be performed by specifying the requested number of cycles, but also by specifying the requested time in seconds.


Constructor & Destructor Documentation

IG::Lib::ThreadPerformanceTest::ThreadPerformanceTest ( ) [inline]

Member Function Documentation

void IG::Lib::ThreadPerformanceTest::StoreLast ( ) [inline, protected]

Stores the last performance data.

static void IG::Lib::ThreadPerformanceTest::StandardCycle ( ) [inline, static]

A standard unit operation that is repeated in order to measure performance.

void IG::Lib::ThreadPerformanceTest::TestPerformanceNum ( int  numCycles,
out ThreadPerformanceData  data 
) [inline]

Execute performance test with specified number of standard cycles. WARNING: Usually the TestPerformance should be used which prescribes the approximate time used for the test.

Parameters:
numCyclesNumber of standard cycles to be performed.
dataOutput structure that returns the performance data.
void IG::Lib::ThreadPerformanceTest::TestPerformanceNum ( int  numCycles,
out double  cyclesPerSec,
out double  performanceRatio 
) [inline]

Execute performance test with specified number of standard cycles. WARNING: Usually the TestPerformance should be used which prescribes the approximate time used for the test.

Parameters:
numCyclesNumber of standard cycles to be performed performed.
cyclesPerSecReturns number of cycles per second, which is the relevant performance measure for the current thread.
performanceRatioReturns ratio between CPU time and clock time spen for the test. This is a measure of how much the CPU is loaded (smaller the value, more it is loaded).
double IG::Lib::ThreadPerformanceTest::TestPerformanceNum ( int  numCycles) [inline]

Execute performance test with specified number of standard cycles, and returns the measured number of standard cycles performed per second (which is the relevant performance measure). WARNING: Usually the TestPerformance should be used which prescribes the approximate time used for the test.

Parameters:
numCyclesNumber of standard cycles to be performed.
void IG::Lib::ThreadPerformanceTest::TestPerformance ( double  testDuration,
out ThreadPerformanceData  data 
) [inline]

Execute performance test with specified measurement duration.

Parameters:
requestedTimeRequested (approximate) duration of the test.
dataOutput structure that returns the performance data.
void IG::Lib::ThreadPerformanceTest::TestPerformance ( double  testDuration,
out double  cyclesPerSec,
out double  performanceRatio 
) [inline]

Execute performance test with specified measurement duration.

Parameters:
requestedTimeRequested (approximate) duration of the test.
cyclesPerSecReturns number of cycles per second, which is the relevant performance measure for the current thread.
performanceRatioReturns ratio between CPU time and clock time spen for the test. This is a measure of how much the CPU is loaded (smaller the value, more it is loaded).
double IG::Lib::ThreadPerformanceTest::TestPerformance ( double  testDuration) [inline]

Execute performance test with specified measurement duration, and returns the measured number of standard cycles performed per second (which is the relevant performance measure).

Parameters:
requestedTimeRequested (approximate) duration of the test.
static void IG::Lib::ThreadPerformanceTest::CreateThreadLoads ( int  numThreads) [inline, static]

Starts the specified number of new load threads, each of which causes a full load to a CPU core until it stops. IMPORTANT: The load threads are switched off by setting ThreadPerformanceTest.PerformLoad to false. It can happen that this must be repeated several times to take effect.

Parameters:
numThreads
static void IG::Lib::ThreadPerformanceTest::ThreadLoadFunction ( ) [inline, static, protected]

Performed by load threads.

override string IG::Lib::ThreadPerformanceTest::ToString ( ) [inline]
static void IG::Lib::ThreadPerformanceTest::Example ( ) [inline, static]

Examples and tests for this class.


Member Data Documentation

Number of inner iterations. This number is chosen such that there are over 1000 outer cycles per second on medium speed modern processors.

A reference number of cycles per second. This can be used for orientation of how many cycles to request.

Minimial number of cycles. Test never executes with less cycles because of accuracy of results.

object IG::Lib::ThreadPerformanceTest::_lock = new Object() [private]

Performance data of the last measurement performed.

bool IG::Lib::ThreadPerformanceTest::_performLoad = false [static, protected]

Property Documentation

object IG::Lib::ThreadPerformanceTest::Lock [get, protected]
List<ThreadPerformanceData> IG::Lib::ThreadPerformanceTest::Data [get]

List of data aboud the performed tests.

int IG::Lib::ThreadPerformanceTest::NumLoadThreds [static, get, set]

Returns the current number of alive loading threads performing full CPU load.

bool IG::Lib::ThreadPerformanceTest::PerformLoad [static, get, set]

Specifies whether load should be performed. Setting this to false makes eventual threads to exit.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events