Bug 106172

Summary: Extract a class to represent a test result to simplify PerfTest.parse_output and PageLoadPerfTest._run_with_driver
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: Tools / TestsAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, dpranke, eric, morrita, tony, webkit.review.bot, zoltan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 97510    
Attachments:
Description Flags
Patch tony: review+

Description Ryosuke Niwa 2013-01-05 02:14:28 PST
Right now, PerfTest.parse_output is a God-function that parses text output of DriverOutput and creates the dictionary PerfTestRunner and the perf-o-matic expects.
PageLoadPerfTest._run_with_driver has a similar problem.

Extract a class that represents a test result in order to simplify these two functions.
Comment 1 Ryosuke Niwa 2013-01-05 02:34:40 PST
Created attachment 181432 [details]
Patch
Comment 2 Tony Chang 2013-01-07 09:57:17 PST
Comment on attachment 181432 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=181432&action=review

> Tools/Scripts/webkitpy/performance_tests/perftest.py:56
> +    allowed_metrics = ('Time', 'Malloc', 'JSHeap')

Nit: I think we normally use ALL_CAPS for constants. Also, this looks like it is only used in the class so you could _ prefix it.

> Tools/Scripts/webkitpy/performance_tests/perftest.py:59
> +    def __init__(self, metric, unit=None, iterations=None):
> +        self._metric = metric

Nit: Maybe assert here that metric is in allowed_metrics?

> Tools/Scripts/webkitpy/performance_tests/perftest.py:245
> +                current_metric = metric_match.group('metric').replace(' ', '')

It's a bit unfortunate that we use "JS Heap" in one place and "JSHeap" in another.  Maybe we can clean this up in a follow up.
Comment 3 Ryosuke Niwa 2013-01-07 10:29:17 PST
Committed r138955: <http://trac.webkit.org/changeset/138955>