pg.utils.TimeIt¶
Accessible via pg.utils.TimeIt.
- class TimeIt(name='')[source]¶
Bases:
objectContext manager for timing the execution of a code block.
Classes:
Status(name[, elapse, has_ended, error])Status of a single pg.timeit.
StatusSummary([breakdown])Aggregated summary for repeated calls for pg.timeit.
Methods:
add(context)Adds a child context.
end([error])Ends timing.
start()Starts timing.
status()Gets the status of all timeit under this context.
Attributes:
Returns child contexts.
Returns the elapse since start until end.
Returns end time.
Returns error.
Returns whether the context has ended.
Returns whether the context has error.
Returns whether the context has started.
Returns the name of the context.
Returns start time.
- class Status(name, elapse=0.0, has_ended=True, error=None)[source]¶
Bases:
pg.JSONConvertibleStatus of a single pg.timeit.
Attributes:
has_errorReturns whether the context has error.
has_startedReturns whether the context has started.
Methods:
merge(other)Merges the status of two pg.timeit.
to_json(**kwargs)Returns a plain Python value as a representation for this object.
- merge(other)¶
Merges the status of two pg.timeit.
- Return type:
Status
- to_json(**kwargs)¶
Returns a plain Python value as a representation for this object.
A plain Python value are basic python types that can be serialized into JSON, e.g:
bool,int,float,str,dict(with string keys),list,tuplewhere the container types should have plain Python values as their values.
- class StatusSummary(breakdown=<factory>)[source]¶
Bases:
pg.JSONConvertibleAggregated summary for repeated calls for pg.timeit.
Classes:
Entry([num_started, num_ended, num_failed, ...])Aggregated status from the pg.timeit calls of the same name.
Methods:
to_json(**kwargs)Returns a plain Python value as a representation for this object.
- class Entry(num_started=0, num_ended=0, num_failed=0, avg_duration=0.0, error_tags=<factory>)¶
Bases:
pg.JSONConvertibleAggregated status from the pg.timeit calls of the same name.
Methods:
to_json(**kwargs)Returns a plain Python value as a representation for this object.
- to_json(**kwargs)¶
Returns a plain Python value as a representation for this object.
A plain Python value are basic python types that can be serialized into JSON, e.g:
bool,int,float,str,dict(with string keys),list,tuplewhere the container types should have plain Python values as their values.
- to_json(**kwargs)¶
Returns a plain Python value as a representation for this object.
A plain Python value are basic python types that can be serialized into JSON, e.g:
bool,int,float,str,dict(with string keys),list,tuplewhere the container types should have plain Python values as their values.