From: kubi Date: Fri, 16 Oct 2015 03:38:12 +0000 (+0800) Subject: record the total time of test case running X-Git-Tag: brahmaputra.1.0~160 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=f37d291f6397891cd0dc37c6140b114868921b61;p=yardstick.git record the total time of test case running total time and one task time both will be put into console JIRA:YARDSTICK-166 Change-Id: I1422355c5ca0228c11e6334c13bb13554bdca4af Signed-off-by: kubi --- diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py index 8db6e77e6..0d7e9e66d 100755 --- a/yardstick/cmd/commands/task.py +++ b/yardstick/cmd/commands/task.py @@ -14,7 +14,8 @@ import os import yaml import atexit import ipaddress - +import time +import logging from yardstick.benchmark.contexts.base import Context from yardstick.benchmark.runners import base as base_runner from yardstick.common.task_template import TaskTemplate @@ -22,6 +23,7 @@ from yardstick.common.utils import cliargs output_file_default = "/tmp/yardstick.out" test_cases_dir_default = "tests/opnfv/test_cases/" +LOG = logging.getLogger(__name__) class TaskCommands(object): @@ -51,6 +53,7 @@ class TaskCommands(object): atexit.register(atexit_handler) + total_start_time = time.time() parser = TaskParser(args.inputfile[0]) suite_params = {} @@ -75,6 +78,7 @@ class TaskCommands(object): os.remove(args.output_file) for i in range(0, len(task_files)): + one_task_start_time = time.time() parser.path = task_files[i] scenarios, run_in_parallel = parser.parse_task(task_args[i], task_args_fnames[i]) @@ -89,6 +93,13 @@ class TaskCommands(object): for context in Context.list: context.undeploy() Context.list = [] + one_task_end_time = time.time() + LOG.info("task %s finished in %d secs", task_files[i], + one_task_end_time - one_task_start_time) + + total_end_time = time.time() + LOG.info("total finished in %d secs", + total_end_time - total_start_time) print "Done, exiting"