mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-26 11:43:25 +00:00
selfcheck.py: add parameter to print the time spent on each check
Usage: rosrun clover selfcheck.py _time:=1
This commit is contained in:
@@ -71,6 +71,7 @@ def info(text, *args):
|
||||
def check(name):
|
||||
def inner(fn):
|
||||
def wrapper(*args, **kwargs):
|
||||
start = rospy.get_time()
|
||||
thread_local.reports = []
|
||||
try:
|
||||
fn(*args, **kwargs)
|
||||
@@ -86,6 +87,8 @@ def check(name):
|
||||
rospy.loginfo('%s: %s', name, report['info'])
|
||||
if not thread_local.reports:
|
||||
rospy.loginfo('%s: OK', name)
|
||||
if rospy.get_param('~time', False):
|
||||
rospy.loginfo('%s: %.1f sec', name, rospy.get_time() - start)
|
||||
return wrapper
|
||||
return inner
|
||||
|
||||
|
||||
Reference in New Issue
Block a user