diff options
author | cmtice <cmtice@google.com> | 2014-03-11 13:38:07 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-03-14 19:32:33 +0000 |
commit | 139092449a545d4d87c06af3a6d8f3d71e42e927 (patch) | |
tree | ede91dc3f94b8062ff60274bd57fca32cf9e8b41 /crosperf/image_checksummer.py | |
parent | 2317decf0e3f62297fc09a712bdf7fa253d560f3 (diff) | |
download | toolchain-utils-139092449a545d4d87c06af3a6d8f3d71e42e927.tar.gz |
Add --logging_level option to crosperf.
Add --logging_level={verbose, average, quiet} option to crosperf,
optionally reducing the amount of logging output. "verbose" gives
the same output Crosperf always gave; "quiet" gives minimal output, and
"average" is in the middle. The default for now is "verbose". Doing this
also involved adding logging levels to the command_executer, and to
image_chromeos (again, with the default being "verbose").
BUG=None
TEST=Tested all three levels of logging, with and without having to
reimage the DUT. It all worked properly.
Change-Id: Icf8c9a6831fe25202adcb624c6c7e1d1a7ac25a5
Reviewed-on: https://chrome-internal-review.googlesource.com/156883
Reviewed-by: Caroline Tice <cmtice@google.com>
Commit-Queue: Caroline Tice <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'crosperf/image_checksummer.py')
-rw-r--r-- | crosperf/image_checksummer.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crosperf/image_checksummer.py b/crosperf/image_checksummer.py index eeb4466e..2f6694d9 100644 --- a/crosperf/image_checksummer.py +++ b/crosperf/image_checksummer.py @@ -11,10 +11,11 @@ from utils.file_utils import FileUtils class ImageChecksummer(object): class PerImageChecksummer(object): - def __init__(self, label): + def __init__(self, label, log_level): self._lock = threading.Lock() self.label = label self._checksum = None + self.log_level = log_level def Checksum(self): with self._lock: @@ -26,7 +27,8 @@ class ImageChecksummer(object): raise Exception("Called Checksum on non-local image!") if self.label.chromeos_image: if os.path.exists(self.label.chromeos_image): - self._checksum = FileUtils().Md5File(self.label.chromeos_image) + self._checksum = FileUtils().Md5File(self.label.chromeos_image, + log_level=self.log_level) logger.GetLogger().LogOutput("Computed checksum is " ": %s" % self._checksum) if not self._checksum: @@ -50,13 +52,14 @@ class ImageChecksummer(object): *args, **kwargs) return cls._instance - def Checksum(self, label): + def Checksum(self, label, log_level): if label.image_type != "local": raise Exception("Attempt to call Checksum on non-local image.") with self._lock: if label.name not in self._per_image_checksummers: self._per_image_checksummers[label.name] = (ImageChecksummer. - PerImageChecksummer(label)) + PerImageChecksummer(label, + log_level)) checksummer = self._per_image_checksummers[label.name] try: |