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

Unified Diff: perf/go/parser/parser_test.go

Issue 610793003: Add ratio calculation to take the ratio of two calculations. (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: remove debug code Created 6 years, 2 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 | « perf/go/parser/parser.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: perf/go/parser/parser_test.go
diff --git a/perf/go/parser/parser_test.go b/perf/go/parser/parser_test.go
index 71fbebf5790e8fea8292a02584a59d684212c3ad..2bc39bbe33da244ce528cd2393ad3dda3d60f94e 100644
--- a/perf/go/parser/parser_test.go
+++ b/perf/go/parser/parser_test.go
@@ -131,6 +131,27 @@ func TestAve(t *testing.T) {
}
}
+func TestRatio(t *testing.T) {
+ ctx := newTestContext()
+ ctx.Tile.Traces["t1"].(*types.PerfTrace).Values = []float64{10, 4, 100, 50, 9999, 0}
+ ctx.Tile.Traces["t2"].(*types.PerfTrace).Values = []float64{5, 2, 4, 5, 0, 1000}
+
+ traces, err := ctx.Eval(`ratio(
+ ave(fill(filter("config=gpu"))),
+ ave(fill(filter("config=8888"))))`)
+ if err != nil {
+ t.Fatalf("Failed to eval ratio() test: %s", err)
+ }
+ if got, want := len(traces), 1; got != want {
+ t.Errorf("ratio() returned wrong length: Got %v Want %v", got, want)
+ }
+ for i, want := range []float64{0.5, 0.5, 0.04, 0.1, 0, 1e+100} {
+ if got := traces[0].Values[i]; got != want {
+ t.Errorf("Ratio mismatch: Got %v Want %v", got, want)
+ }
+ }
+}
+
func TestFill(t *testing.T) {
ctx := newTestContext()
ctx.Tile.Traces["t1"].(*types.PerfTrace).Values = []float64{1e100, 1e100, 2, 3, 1e100, 5}
« no previous file with comments | « perf/go/parser/parser.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698