In a similar vein to my prior Python decorator metadata for functions (“meta_func” => github | PyPi | blog), this decorator is intended to help illuminate the number of calls and time taken per call aggregates.
It will keep track of each function by its uniquely assigned python object identifier, the total number of function calls, total time taken for all calls to that function, and min, max and average time for the function calls.
Sample usage:
@runtime_stats()
def self_mult(n):
sleep(0.2)
return n*n
print(self_mult(10)) # => 100
print(self_mult(7)) # => 49
print(self_mult.get_func_runtime_stats()) # => {'total_time': 401.668, 'avg': 200.834, 'func_uid': 4302206808, 'func_name': 'self_mult', 'min': 200.445, 'max': 201.223, 'total_calls': 2}
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in
/home/garrens3/public_html/blog/wp-includes/category.php on line
378
Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in
/home/garrens3/public_html/blog/wp-includes/category.php on line
379
Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in
/home/garrens3/public_html/blog/wp-includes/category.php on line
380
Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in
/home/garrens3/public_html/blog/wp-includes/category.php on line
381
Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in
/home/garrens3/public_html/blog/wp-includes/category.php on line
382
Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in
/home/garrens3/public_html/blog/wp-includes/category.php on line
383
Categories
Default