networkit.stopwatch

class networkit.stopwatch.Timer

Bases: object

Main stopwatch object, providing functionality to measure time.

DEPRECATED. This class (and the networkit.stopwatch module) will be removed in future updates.

property elapsed

The number of seconds since the current time that the Timer object was created. If stop() was called, it is the number of seconds from the instance creation until stop() was called.

Returns

Elapsed time.

Return type

float

property start_time

The time at which the Timer instance was created.

Returns

Starting time.

Return type

float

stop()

Stops the clock permanently for the instance of the Timer. Returns the time at which the instance was stopped.

Returns

Stop time.

Return type

float

property stop_time

The time at which stop() was called, or None if stop was never called.

Returns

Stop time.

Return type

float or None

networkit.stopwatch.clockit(func)

Function decorator that times the evaluation of func and prints the execution time.

DEPRECATED. This function (and the networkit.stopwatch module) will be removed in future updates.

Example

..code

>>> from stopwatch import clockit
>>> @clockit
        def mult(a, b):
                return a * b
>>> print mult(2, 6)
mult in 1.38282775879e-05 sec