Skip to content
This repository has been archived by the owner on May 31, 2019. It is now read-only.

Commit

Permalink
added return to docs for docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
richzeng committed Jul 26, 2012
1 parent 13edf6c commit 22738de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions yunomi/core/metrics_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,11 @@ def count_calls(fn):
"""
Decorator to track the number of times a function is called.
@param fn: the decorated function
@param fn: the function to be decorated
@type fn: C{func}
@return: the decorated function
@rtype: C{func}
"""
def wrapper(*args):
counter("%s_calls" % fn.__name__).inc()
Expand All @@ -187,8 +190,11 @@ def meter_calls(fn):
"""
Decorator to the rate at which a function is called.
@param fn: the decorated function
@param fn: the function to be decorated
@type fn: C{func}
@return: the decorated function
@rtype: C{func}
"""
def wrapper(*args):
meter("%s_calls" % fn.__name__).mark()
Expand All @@ -202,8 +208,11 @@ def dist_calls(fn):
"""
Decorator to check the distribution of return values of a function.
@param fn: the decorated function
@param fn: the function to be decorated
@type fn: C{func}
@return: the decorated function
@rtype: C{func}
"""
def wrapper(*args):
_histogram = histogram("%s_calls" % fn.__name__)
Expand All @@ -219,8 +228,11 @@ def time_calls(fn):
"""
Decorator to time the execution of the function.
@param fn: the decorated function
@param fn: the function to be decorated
@type fn: C{func}
@return: the decorated function
@rtype: C{func}
"""
def wrapper(*args):
_timer = timer("%s_calls" % fn.__name__)
Expand Down
2 changes: 1 addition & 1 deletion yunomi/tests/test_metrics_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ def test():

for i in xrange(10):
test()
self.twisted_clock.advance(1)
#some kind of timing thing here
self.assertAlmostEqual(meter("test_calls").get_mean_rate(), 1.0)

0 comments on commit 22738de

Please sign in to comment.