diff options
| author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-06-23 18:43:33 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-01 16:22:47 +0100 |
| commit | eb36f0000205230e78ab326d8ae6a504939af9c8 (patch) | |
| tree | 8f3a47e766ac3530cb728ce990f34a67d9aa138a | |
| parent | 8c596369ddcd1d079bec5c163132676f3940767b (diff) | |
| download | poky-eb36f0000205230e78ab326d8ae6a504939af9c8.tar.gz | |
oe-build-perf-test: implement --globalres-file option
Using this option the script appends test results into a 'global results
file'. A CSV-formatted output of the results. This option is to provide
compatibility with the old build-perf-test.sh.
(From OE-Core rev: e9f18e63220e452f2b0c878998e57d944ae83980)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oeqa/buildperf/base.py | 32 | ||||
| -rwxr-xr-x | scripts/oe-build-perf-test | 5 |
2 files changed, 37 insertions, 0 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py index e10cbf4572..527563bb0b 100644 --- a/meta/lib/oeqa/buildperf/base.py +++ b/meta/lib/oeqa/buildperf/base.py | |||
| @@ -152,6 +152,38 @@ class BuildPerfTestRunner(object): | |||
| 152 | os.makedirs(os.path.dirname(tgt_dir)) | 152 | os.makedirs(os.path.dirname(tgt_dir)) |
| 153 | shutil.copytree(src_dir, tgt_dir) | 153 | shutil.copytree(src_dir, tgt_dir) |
| 154 | 154 | ||
| 155 | def update_globalres_file(self, filename): | ||
| 156 | """Write results to globalres csv file""" | ||
| 157 | if self.repo: | ||
| 158 | git_tag_rev = self.repo.run_cmd(['describe', self.git_rev]) | ||
| 159 | else: | ||
| 160 | git_tag_rev = self.git_rev | ||
| 161 | times = [] | ||
| 162 | sizes = [] | ||
| 163 | for test in self.results['tests'].values(): | ||
| 164 | for measurement in test['measurements']: | ||
| 165 | res_type = measurement['type'] | ||
| 166 | values = measurement['values'] | ||
| 167 | if res_type == BuildPerfTest.SYSRES: | ||
| 168 | e_sec = values['elapsed_time'].total_seconds() | ||
| 169 | times.append('{:d}:{:02d}:{:.2f}'.format( | ||
| 170 | int(e_sec / 3600), | ||
| 171 | int((e_sec % 3600) / 60), | ||
| 172 | e_sec % 60)) | ||
| 173 | elif res_type == BuildPerfTest.DISKUSAGE: | ||
| 174 | sizes.append(str(values['size'])) | ||
| 175 | else: | ||
| 176 | log.warning("Unable to handle '%s' values in " | ||
| 177 | "globalres.log", res_type) | ||
| 178 | |||
| 179 | log.debug("Writing globalres log to %s", filename) | ||
| 180 | with open(filename, 'a') as fobj: | ||
| 181 | fobj.write('{},{}:{},{},'.format(self.results['tester_host'], | ||
| 182 | self.results['git_branch'], | ||
| 183 | self.results['git_revision'], | ||
| 184 | git_tag_rev)) | ||
| 185 | fobj.write(','.join(times + sizes) + '\n') | ||
| 186 | |||
| 155 | 187 | ||
| 156 | def perf_test_case(obj): | 188 | def perf_test_case(obj): |
| 157 | """Decorator for adding test classes""" | 189 | """Decorator for adding test classes""" |
diff --git a/scripts/oe-build-perf-test b/scripts/oe-build-perf-test index ca90f69e1e..9dd073cdfb 100755 --- a/scripts/oe-build-perf-test +++ b/scripts/oe-build-perf-test | |||
| @@ -70,6 +70,8 @@ def parse_args(argv): | |||
| 70 | 70 | ||
| 71 | parser.add_argument('-D', '--debug', action='store_true', | 71 | parser.add_argument('-D', '--debug', action='store_true', |
| 72 | help='Enable debug level logging') | 72 | help='Enable debug level logging') |
| 73 | parser.add_argument('--globalres-file', | ||
| 74 | help="Append results to 'globalres' csv file") | ||
| 73 | 75 | ||
| 74 | return parser.parse_args(argv) | 76 | return parser.parse_args(argv) |
| 75 | 77 | ||
| @@ -94,6 +96,9 @@ def main(argv=None): | |||
| 94 | # Run actual tests | 96 | # Run actual tests |
| 95 | runner = BuildPerfTestRunner(out_dir) | 97 | runner = BuildPerfTestRunner(out_dir) |
| 96 | ret = runner.run_tests() | 98 | ret = runner.run_tests() |
| 99 | if not ret: | ||
| 100 | if args.globalres_file: | ||
| 101 | runner.update_globalres_file(args.globalres_file) | ||
| 97 | 102 | ||
| 98 | return ret | 103 | return ret |
| 99 | 104 | ||
