lasdi.timing

Classes

Timer

A light-weight timer class.

Module Contents

class lasdi.timing.Timer

A light-weight timer class.

names

Dictionary that maps job names to job indices.

Type:

dict(str:int)

calls = []

List that stores the number of calls for each job.

Type:

list(int)

times = []

List that stores the total time for each job.

Type:

list(float)

starts = []

List that stores the start time for each job. If the job is not running, None is stored instead.

Type:

list(float)

start(name)

Start a job named name. If the job is not listed, register the job in the job list.

Args:

name (str): Name of the job to be started.

Note:

The job must not have started before calling this method.

Returns:

Does not return a value.

end(name)

End a job named name. Increase the number of calls and the runtime for the job.

Args:

name (str): Name of the job to be ended.

Note:

The job must have started before calling this method.

Returns:

Does not return a value.

print()

Print the list of jobs and their number of calls, total time and time per each call.

Returns:

Does not return a value.

export()

Export the list of jobs and their number of calls and total time into a dictionary.

Note:

All jobs must be ended before calling this method.

Returns:

dict that contains “names”, “calls”, and “times” as keys

load(dict_)

Load the list of jobs and their number of calls and total time from a dictionary.

Args:

dict_ (dict): Dictionary that contains the list of jobs and their calls and times.

Note:

dict_['names'], dict_['calls'] and dict_['times'] must have the same size.

Returns:

Does not return a value