cloudmesh-common.cloudmesh.common.StopWatch

Class for starting and stopping named timers.

Module Contents

Classes

StopWatch

A class to measure times between events.

class cloudmesh-common.cloudmesh.common.StopWatch.StopWatch

Bases: object

A class to measure times between events.

debug = False
verbose = True
timer_start
timer_end
timer_elapsed
timer_status
timer_sum
classmethod keys(cls)

returns the names of the timers

classmethod status(cls, name, value)

starts a timer with the given name.

Parameters
  • name (string) – the name of the timer

  • status (bool) – the name of a status

classmethod start(cls, name)

starts a timer with the given name.

Parameters

name (string) – the name of the timer

classmethod stop(cls, name)

stops the timer with a given name.

Parameters

name (string) – the name of the timer

classmethod get_status(cls, name)

sets the status of the timer with a given name.

Parameters

name (string) – the name of the timer

classmethod get(cls, name, digits=4)

returns the time of the timer.

Parameters

name (string) – the name of the timer

Return type

the elapsed time

classmethod sum(cls, name, digits=4)

returns the sum of the timer if used multiple times

Parameters

name (string) – the name of the timer

Return type

the elapsed time

classmethod clear(cls)

clear start and end timer_start

classmethod print(cls, *args)

prints a timer. The first argument is the label if it exists, the last is the timer :param args: label, name :return:

classmethod __str__(cls)

Return str(self).

classmethod benchmark(cls, sysinfo=True, csv=True, prefix='# csv', tag=None, sum=True)

prints out all timers in a convenient benchmark table :return: :rtype: