Bug 83294

Summary: perf-o-matic should include unit in runs JSON responses
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: New BugsAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, haraken, morrita
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 82852    
Bug Blocks: 77037    
Attachments:
Description Flags
Patch tony: review+

Description Ryosuke Niwa 2012-04-05 10:38:54 PDT
perf-o-matic should include unit in runs JSON responses
Comment 1 Ryosuke Niwa 2012-04-05 10:44:21 PDT
Created attachment 135856 [details]
Patch
Comment 2 Ryosuke Niwa 2012-04-05 10:45:29 PDT
Once we land this & push it to the production, we can show units on perf-o-matic :)
Comment 3 Ryosuke Niwa 2012-04-05 10:47:00 PDT
Note that I've already made the frontend change upstream, and rhelmer has pulled my changes:
https://github.com/mozilla/graphs/commit/ba7b2b21f5b001f8513aca8e613f6e0920d8fff3
https://github.com/mozilla/graphs/commit/c1fc48d40134b25876a7664eadab342f36a33b3a
Comment 4 Tony Chang 2012-04-05 10:48:04 PDT
Comment on attachment 135856 [details]
Patch

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

> Websites/webkit-perf.appspot.com/models.py:452
> +        return '{"test_runs": [%s], "averages": {%s}, "min": %s, "max": %s, "unit": %s, "date_range": null, "stat": "ok"}' % (self.json_runs,
> +            self.json_averages, str(self.json_min) if self.json_min else 'null', str(self.json_max) if self.json_max else 'null',

Nit: You might want to start naming the strings. E.g., %(test_runs)s .. %(averages)s .. etc.  That might make it a bit easier to match up the string substitutions.
Comment 5 Ryosuke Niwa 2012-04-05 10:55:08 PDT
Comment on attachment 135856 [details]
Patch

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

>> Websites/webkit-perf.appspot.com/models.py:452
>> +            self.json_averages, str(self.json_min) if self.json_min else 'null', str(self.json_max) if self.json_max else 'null',
> 
> Nit: You might want to start naming the strings. E.g., %(test_runs)s .. %(averages)s .. etc.  That might make it a bit easier to match up the string substitutions.

Yeah I guess. But then I'll have to repeat that in the string and in the dictionary and will make the code much more verbose.
I could make '"min": %s, "max": %s, "unit": %s, "date_range": null, "stat": "ok"' a dictionary and just call json.dumps instead.
(Can't call dumps on test_runs and json_averages since they aren't real json.
On the other hand, that ends up requiring some string manipulating of { and }. Not sure if that's desirable :\
Comment 6 Ryosuke Niwa 2012-04-05 12:32:31 PDT
Committed r113356: <http://trac.webkit.org/changeset/113356>