diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-04-04 15:08:29 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-05-01 14:32:56 -0700 |
commit | 30b992bdc047073e1fe99b1ac622f026618a8081 (patch) | |
tree | 60c07c6a5c4a29ddc32e2675fca3d7ab37935984 /framework | |
parent | 2f02cf0d4c2d7e901415d2325200deccc4230123 (diff) |
profile: use gz to compress profiles
This results in substantially smaller profiles and doesn't seem to
affect runtime.
v2: - install xml and xml.gz files. This is needed so that meta profiles
will be installed.
Tested-by: Rafael Antognolli <rafael.antognolli@intel.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/profile.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/framework/profile.py b/framework/profile.py index 3975d0606..1c75025b3 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -34,8 +34,8 @@ import ast import collections import contextlib import copy +import gzip import importlib -import io import itertools import multiprocessing import multiprocessing.dummy @@ -318,7 +318,7 @@ class XMLProfile(object): def __len__(self): if not (self.filters or self.forced_test_list): - with io.open(self.filename, 'rt') as f: + with gzip.open(self.filename, 'rt') as f: iter_ = et.iterparse(f, events=(b'start', )) for _, elem in iter_: if elem.tag == 'PiglitTestList': @@ -333,7 +333,7 @@ class XMLProfile(object): def _itertests(self): """Always iterates tests instead of using the forced test_list.""" - with io.open(self.filename, 'rt') as f: + with gzip.open(self.filename, 'rt') as f: doc = et.iterparse(f, events=(b'end', )) _, root = next(doc) # get the root so we can keep clearing it for _, e in doc: @@ -517,13 +517,13 @@ def load_test_profile(filename, python=None): if os.path.exists(meta): return MetaProfile(meta) - xml = os.path.join(ROOT_DIR, 'tests', name + '.xml') + xml = os.path.join(ROOT_DIR, 'tests', name + '.xml.gz') if os.path.exists(xml): return XMLProfile(xml) if python is False: raise exceptions.PiglitFatalError( - 'Cannot open "tests/{0}.xml" or "tests/{0}.meta.xml"'.format(name)) + 'Cannot open "tests/{0}.xml.gz" or "tests/{0}.meta.xml"'.format(name)) try: mod = importlib.import_module('tests.{0}'.format(name)) |