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

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | Properties | Private Attributes | List of all members
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:
[legend]

## 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. More...
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. More...
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. More...
void | TestPerformance (double testDuration, out ThreadPerformanceData data)
| Execute performance test with specified measurement duration. More...
void | TestPerformance (double testDuration, out double cyclesPerSec, out double performanceRatio)
| Execute performance test with specified measurement duration. More...
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). More...
override string | ToString ()

## Static Public Member Functions
static void | StandardCycle ()
| A standard unit operation that is repeated in order to measure performance. More...
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. More...
static void | Example ()
| Examples and tests for this class. More...

## 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. More...
const double | RefCyclesPerSecond = 1600
| A reference number of cycles per second. This can be used for orientation of how many cycles to request. More...
const int | MinCycles = 20
| Minimial number of cycles. Test never executes with less cycles because of accuracy of results. More...
ThreadPerformanceData | Last
| Performance data of the last measurement performed. More...

## Protected Member Functions
void | StoreLast ()
| Stores the last performance data. More...

## Static Protected Member Functions
static void | ThreadLoadFunction ()
| Performed by load threads. More...

## Static Protected Attributes
static bool | _performLoad = false
static int | _numLoadThreads = 0

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

## 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

  numCycles | Number of standard cycles to be performed.
  data | Output structure that returns the performance data.

References IG.Lib.ThreadPerformanceData.CyclesPerSecond, IG.Lib.ThreadPerformanceData.NumCycles, IG.Lib.ThreadPerformanceData.NumIterations, IG.Lib.ThreadPerformanceData.PerformanceRatio, IG.Lib.StopWatch1.Start(), IG.Lib.StopWatch1.Stop(), IG.Lib.StopWatch1.Time, IG.Lib.ThreadPerformanceData.Time, IG.Lib.StopWatch1.TotalCpuTime, IG.Lib.StopWatch1.TotalTime, and IG.Lib.ThreadPerformanceData.TotalTime.

Referenced by IG.Lib.ThreadPerformanceTest.Example().

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

  numCycles | Number of standard cycles to be performed performed.
  cyclesPerSec | Returns number of cycles per second, which is the relevant performance measure for the current thread.
  performanceRatio | Returns 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

  numCycles | Number 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

  requestedTime | Requested (approximate) duration of the test.
  data | Output structure that returns the performance data.

References IG.Lib.ThreadPerformanceData.CyclesPerSecond, IG.Lib.ThreadPerformanceData.NumCycles, IG.Lib.ThreadPerformanceData.NumIterations, IG.Lib.ThreadPerformanceData.PerformanceRatio, IG.Lib.StopWatch1.Start(), IG.Lib.StopWatch1.Stop(), IG.Lib.StopWatch1.Time, IG.Lib.ThreadPerformanceData.Time, IG.Lib.StopWatch1.TotalCpuTime, IG.Lib.StopWatch1.TotalTime, and IG.Lib.ThreadPerformanceData.TotalTime.

Referenced by IG.Lib.ThreadPerformanceTest.Example().

void IG.Lib.ThreadPerformanceTest.TestPerformance | ( | double | testDuration,
|  | out double | cyclesPerSec,
|  | out double | performanceRatio
| ) |  |
| inline

Execute performance test with specified measurement duration.

Parameters

  requestedTime | Requested (approximate) duration of the test.
  cyclesPerSec | Returns number of cycles per second, which is the relevant performance measure for the current thread.
  performanceRatio | Returns 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

  requestedTime | Requested (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 |

Referenced by IG.Lib.ThreadPerformanceTest.Example().

static void IG.Lib.ThreadPerformanceTest.ThreadLoadFunction | ( |  | ) |
| inline static protected

Performed by load threads.

override string IG.Lib.ThreadPerformanceTest.ToString | ( |  | ) |
| inline

References IG.Lib.ThreadPerformanceData.ToString().

Referenced by IG.Lib.ThreadPerformanceTest.Example().

static void IG.Lib.ThreadPerformanceTest.Example | ( |  | ) |
| inline static

Examples and tests for this class.

References IG.Lib.ThreadPerformanceTest.CreateThreadLoads(), IG.Lib.ThreadPerformanceTest.NumLoadThreds, IG.Lib.ThreadPerformanceTest.PerformLoad, IG.Lib.ThreadPerformanceTest.TestPerformance(), IG.Lib.ThreadPerformanceTest.TestPerformanceNum(), and IG.Lib.ThreadPerformanceTest.ToString().

## Member Data Documentation

const int IG.Lib.ThreadPerformanceTest.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 IG.Lib.ThreadPerformanceTest.RefCyclesPerSecond = 1600

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

const int IG.Lib.ThreadPerformanceTest.MinCycles = 20

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

object IG.Lib.ThreadPerformanceTest._lock = new Object()
| private

ThreadPerformanceData IG.Lib.ThreadPerformanceTest.Last

Performance data of the last measurement performed.

List<ThreadPerformanceData> IG.Lib.ThreadPerformanceTest._data = new List<ThreadPerformanceData>()
| private

bool IG.Lib.ThreadPerformanceTest._performLoad = false
| static protected

int IG.Lib.ThreadPerformanceTest._numLoadThreads = 0
| 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 protected set

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

Referenced by IG.Lib.ThreadPerformanceTest.Example().

bool IG.Lib.ThreadPerformanceTest.PerformLoad
| static get set

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

Referenced by IG.Lib.ThreadPerformanceTest.Example().

The documentation for this class was generated from the following file:

- igbase/0unsorted/ThreadPerformanceTest.cs