summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkubi <jean.gaoliang@huawei.com>2015-10-16 11:38:12 +0800
committerkubi <jean.gaoliang@huawei.com>2015-10-28 01:53:34 +0000
commitf37d291f6397891cd0dc37c6140b114868921b61 (patch)
tree8b1bc30d3f4b9b5c01ba31bcb0fe53369a6bcac4
parent2e1094d4aee93180126d3ce86db3cc7df2e87bc5 (diff)
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 <jean.gaoliang@huawei.com>
-rwxr-xr-xyardstick/cmd/commands/task.py13
1 files changed, 12 insertions, 1 deletions
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"