Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: tools/test_gpuveto.py

Issue 334053005: Remove dashing from gpu veto (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/test_gpuveto.py
diff --git a/tools/test_gpuveto.py b/tools/test_gpuveto.py
old mode 100644
new mode 100755
index 2116179ac5b1a6a84b821bc659ee49ceb051e8d9..23e666d0f6212cfc2dde360965ca4bff4435f798
--- a/tools/test_gpuveto.py
+++ b/tools/test_gpuveto.py
@@ -57,26 +57,39 @@ class GpuVeto(object):
def __init__(self):
self.bench_pictures = find_run_binary.find_path_to_program(
'bench_pictures')
+ sys.stdout.write('Running: %s\n' % (self.bench_pictures))
self.gpuveto = find_run_binary.find_path_to_program('gpuveto')
assert os.path.isfile(self.bench_pictures)
assert os.path.isfile(self.gpuveto)
+ self.indeterminate = 0
self.truePositives = 0
self.falsePositives = 0
self.trueNegatives = 0
self.falseNegatives = 0
- def process_skps(self, dir_or_file):
+ def process_skps(self, dir_or_file, timer):
+ if ('c' == timer):
+ timer_str = 'CPU'
bsalomon 2014/06/18 13:26:25 This is going away, Joe is going to remove the CPU
+ elif ('w' == timer):
+ timer_str = 'Wall'
+ else:
+ sys.stderr.write('Invalid timer parameter. Must be either \'c\' or \'w\'\n')
+ return
+ sys.stdout.write('Using Timer: %s\n' % (timer_str))
+
for skp in enumerate(dir_or_file):
- self.process_skp(skp[1])
+ self.process_skp(skp[1], timer)
- sys.stdout.write('TP %d FP %d TN %d FN %d\n' % (self.truePositives,
- self.falsePositives,
- self.trueNegatives,
- self.falseNegatives))
+ sys.stdout.write('TP %d FP %d TN %d FN %d IND %d\n' % (self.truePositives,
+ self.falsePositives,
+ self.trueNegatives,
+ self.falseNegatives,
+ self.indeterminate))
- def process_skp(self, skp_file):
+ def process_skp(self, skp_file, timer):
assert os.path.isfile(skp_file)
+ #print skp_file
# run gpuveto on the skp
args = [self.gpuveto, '-r', skp_file]
@@ -93,45 +106,62 @@ class GpuVeto(object):
# run raster config
args = [self.bench_pictures, '-r', skp_file,
'--repeat', '20',
+ '--timers', timer,
'--config', '8888']
returncode, output = execute_program(args)
if (returncode != 0):
return
- matches = re.findall('[\d.]+', output)
- if len(matches) != 4:
+ matches = re.findall('[\d]+\.[\d]+', output)
+ if len(matches) != 1:
return
- rasterTime = float(matches[3])
+ rasterTime = float(matches[0])
# run gpu config
args2 = [self.bench_pictures, '-r', skp_file,
'--repeat', '20',
+ '--timers', timer,
'--config', 'gpu']
returncode, output = execute_program(args2)
if (returncode != 0):
return
- matches = re.findall('[\d.]+', output)
- if len(matches) != 4:
+ matches = re.findall('[\d]+\.[\d]+', output)
+ if len(matches) != 1:
+ return
+
+ gpuTime = float(matches[0])
+
+ # happens if page is too big it will not render
+ if 0 == gpuTime:
return
- gpuTime = float(matches[3])
+ tolerance = 0.05
+ tol_range = tolerance * gpuTime
- sys.stdout.write('%s: gpuveto: %d raster %.2f gpu: %.2f\n' % (
- skp_file, suitable, rasterTime, gpuTime))
- if suitable:
+ if rasterTime > gpuTime - tol_range and rasterTime < gpuTime + tol_range:
+ result = "NONE"
+ self.indeterminate += 1
+ elif suitable:
if gpuTime < rasterTime:
self.truePositives += 1
+ result = "TP"
else:
self.falsePositives += 1
+ result = "FP"
else:
if gpuTime < rasterTime:
self.falseNegatives += 1
+ result = "FN"
else:
self.trueNegatives += 1
+ result = "TN"
+
+ sys.stdout.write('%s: gpuveto: %d raster %.2f gpu: %.2f Result: %s\n' % (
+ skp_file, suitable, rasterTime, gpuTime, result))
def main(main_argv):
parser = argparse.ArgumentParser()
@@ -139,9 +169,13 @@ def main(main_argv):
help='Path to the SKP(s). Can either be a directory ' \
'containing SKPs or a single SKP.',
required=True)
+ parser.add_argument('--timer',
+ help='Timer to use in bench pictures. Can either be \'c\' ' \
+ 'for cpu timer or \'w\' for wall time. Default = c',
+ required=False, default='c')
args = parser.parse_args()
- GpuVeto().process_skps(list_files(args.skp_path))
+ GpuVeto().process_skps(list_files(args.skp_path), args.timer)
if __name__ == '__main__':
sys.exit(main(sys.argv[1]))
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698