@@ -44,6 +44,7 @@ stats.norm(loc=1, scale=0.02).pdf(1)
4444# Retrieve statistics for wrapped functions
4545print (" Call counts:" , stats.norm.pdf._get_counts())
4646print (" Parameter stats:" , stats.norm.pdf._get_param_stats())
47+ print (" Timing stats:" , stats.norm.pdf._get_timing())
4748```
4849
4950The ` _get_counts() ` method returns a tuple of:
@@ -59,6 +60,16 @@ The `_get_param_stats()` method returns detailed statistics for each parameter:
5960- Tracked parameter values (if specified)
6061- Counts for each tracked value (if specified)
6162
63+ The ` _get_timing() ` method returns a dictionary with timing statistics:
64+
65+ - ` 'total' ` : Total time spent in all calls (seconds)
66+ - ` 'average' ` : Average time per call (seconds)
67+ - ` 'min' ` : Minimum time for a single call (seconds)
68+ - ` 'max' ` : Maximum time for a single call (seconds)
69+
70+ Timing measurements use ` time.perf_counter() ` for high-resolution timing with
71+ nanosecond-level accuracy on most platforms.
72+
6273### Manual Function Decoration
6374
6475For more control, use the ` stats_deco_auto ` decorator to automatically track all
@@ -79,6 +90,7 @@ my_function(5, 20, "custom")
7990
8091print (my_function._get_counts())
8192print (my_function._get_param_stats())
93+ print (my_function._get_timing())
8294```
8395
8496For fine-grained control over which parameter values to track, use ` stats_deco ` :
@@ -107,8 +119,17 @@ from telemetric.statswrapper import print_all_stats
107119
108120# After your code has run
109121print_all_stats()
122+
123+ # Control timing precision with scientific notation (default: 6 digits)
124+ print_all_stats(timing_digits = 3 ) # Display timing with 3 decimal places
125+
126+ # Or disable rounding for full precision
127+ print_all_stats(timing_digits = None )
110128```
111129
130+ The output includes call counts, parameter usage, and timing statistics in
131+ scientific notation for each wrapped function.
132+
112133### OpenTelemetry Integration (Legacy)
113134
114135The library also supports OpenTelemetry-based tracing for distributed systems:
0 commit comments