record the total time of test case running 83/2783/3
authorkubi <jean.gaoliang@huawei.com>
Fri, 16 Oct 2015 03:38:12 +0000 (11:38 +0800)
committerkubi <jean.gaoliang@huawei.com>
Wed, 28 Oct 2015 01:53:34 +0000 (01:53 +0000)
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>
yardstick/cmd/commands/task.py

index 8db6e77..0d7e9e6 100755 (executable)
@@ -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"