Package coro :: Module _coro :: Class bench
[hide private]
[frames] | no frames]

Class bench

object --+
         |
        bench
Known Subclasses:

Base benchmarking class.

Bench classes are passed to the main profiler class to indicate what type of benchmarking you want to perform.

This is a simple benchmarker that uses x86 TSC ticks as a measurement of time spent in a function.

A bench instance is created for each unique function. Additional bench objects are created for the main thread (the scheduler) and the poller.

A special bench object, the "counter", is created in the profiler, and is the baseline that all other bench objects are related to. The mark method is only called on the "counter" object. All other bench objects (those for all the functions) are implicitly modified by the mark method. The value of the bench object depends whether or not it is the "counter". The "counter" object contains the absolute value of what is being monitored. For this discussion, we will assume TSC, but this is applicable to the rusage benchmarker as well.

The "counter" ticks value contains the current TSC value whenever mark is called. All other bench objects contain cumulative ticks which is computed by comparing the current TSC value with the value in the "counter" object. One way to think about this is that the "counter" object contains the current wall-clock time, and the other objects have the total time spent in that object.

Instance Methods [hide private]
 
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
 
get_data(...)
Get the data for this bench object.
 
get_headings(...)
Get a description of the data elements.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  aggregate_ticks
: The total number of ticks spent in the function including the functions it calls.
  calls
: Number of times this element/function has been called.
  ticks
: The total number of ticks spent in the function (for the "counter" object, contains the current processor TSC value).
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(...)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

get_data(...)

 
Get the data for this bench object.
Returns:
Returns a tuple (calls, regular_time, aggregate_time). The values regular_time and aggregate_time are both tuples of values. Call the get_headings method for a description of each element in the tuple.

get_headings(...)

 
Get a description of the data elements.
Returns:
Returns a tuple of strings describing the data elements from get_data.

Instance Variable Details [hide private]

aggregate_ticks

: The total number of ticks spent in the function including the functions it calls. Not used by the "counter" object.

calls

: Number of times this element/function has been called. Not used by the "counter" object.