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

Side by Side Diff: perf/go/parser/parser.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 unified diff | Download patch
« no previous file with comments | « perf/go/parser/funcs.go ('k') | perf/go/parser/parser_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package parser 1 package parser
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 5
6 "skia.googlesource.com/buildbot.git/perf/go/types" 6 "skia.googlesource.com/buildbot.git/perf/go/types"
7 ) 7 )
8 8
9 type NodeType int 9 type NodeType int
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // NewContext create a new parsing context that includes the basic functions. 64 // NewContext create a new parsing context that includes the basic functions.
65 func NewContext(tile *types.Tile) *Context { 65 func NewContext(tile *types.Tile) *Context {
66 return &Context{ 66 return &Context{
67 Tile: tile, 67 Tile: tile,
68 Funcs: map[string]Func{ 68 Funcs: map[string]Func{
69 "filter": filterFunc, 69 "filter": filterFunc,
70 "norm": normFunc, 70 "norm": normFunc,
71 "fill": fillFunc, 71 "fill": fillFunc,
72 "ave": aveFunc, 72 "ave": aveFunc,
73 "ratio": ratioFunc,
73 }, 74 },
74 } 75 }
75 } 76 }
76 77
77 // Eval parses and evaluates the given string expression and returns the Traces, or 78 // Eval parses and evaluates the given string expression and returns the Traces, or
78 // an error. 79 // an error.
79 func (ctx *Context) Eval(exp string) ([]*types.PerfTrace, error) { 80 func (ctx *Context) Eval(exp string) ([]*types.PerfTrace, error) {
80 ctx.formula = exp 81 ctx.formula = exp
81 n, err := parse(exp) 82 n, err := parse(exp)
82 if err != nil { 83 if err != nil {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 l.nextItem() 154 l.nextItem()
154 continue 155 continue
155 case itemRParen: 156 case itemRParen:
156 break Loop 157 break Loop
157 default: 158 default:
158 return fmt.Errorf("Invalid token in args: %d", it.typ) 159 return fmt.Errorf("Invalid token in args: %d", it.typ)
159 } 160 }
160 } 161 }
161 return nil 162 return nil
162 } 163 }
OLDNEW
« no previous file with comments | « perf/go/parser/funcs.go ('k') | perf/go/parser/parser_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698