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

Side by Side Diff: perf/go/types/types.go

Issue 880483003: Add types.MatchesWithIngores(). (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 5 years, 10 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 | « no previous file | perf/go/types/types_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 types 1 package types
2 2
3 import ( 3 import (
4 "encoding/gob" 4 "encoding/gob"
5 "encoding/json" 5 "encoding/json"
6 "fmt" 6 "fmt"
7 "io" 7 "io"
8 "net/url" 8 "net/url"
9 "strings" 9 "strings"
10 "time" 10 "time"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Matches returns true if the given Trace matches the given query. 54 // Matches returns true if the given Trace matches the given query.
55 func Matches(tr Trace, query url.Values) bool { 55 func Matches(tr Trace, query url.Values) bool {
56 for k, values := range query { 56 for k, values := range query {
57 if _, ok := tr.Params()[k]; !ok || !util.In(tr.Params()[k], valu es) { 57 if _, ok := tr.Params()[k]; !ok || !util.In(tr.Params()[k], valu es) {
58 return false 58 return false
59 } 59 }
60 } 60 }
61 return true 61 return true
62 } 62 }
63 63
64 // MatchesWithIgnores returns true if the given Trace matches the given query
65 // and none of the ignore queries.
66 func MatchesWithIgnores(tr Trace, query url.Values, ignores ...url.Values) bool {
67 if !Matches(tr, query) {
68 return false
69 }
70 for _, i := range ignores {
71 if Matches(tr, i) {
72 return false
73 }
74 }
75 return true
76 }
77
64 // PerfTrace represents all the values of a single floating point measurement. 78 // PerfTrace represents all the values of a single floating point measurement.
65 // *PerfTrace implements Trace. 79 // *PerfTrace implements Trace.
66 type PerfTrace struct { 80 type PerfTrace struct {
67 Values []float64 `json:"values"` 81 Values []float64 `json:"values"`
68 Params_ map[string]string `json:"params"` 82 Params_ map[string]string `json:"params"`
69 } 83 }
70 84
71 func (t *PerfTrace) Params() map[string]string { 85 func (t *PerfTrace) Params() map[string]string {
72 return t.Params_ 86 return t.Params_
73 } 87 }
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 TS int64 708 TS int64
695 UserID string 709 UserID string
696 Action string 710 Action string
697 URL string 711 URL string
698 } 712 }
699 713
700 // Date returns an RFC3339 string for the Activity's TS. 714 // Date returns an RFC3339 string for the Activity's TS.
701 func (a *Activity) Date() string { 715 func (a *Activity) Date() string {
702 return time.Unix(a.TS, 0).Format(time.RFC3339) 716 return time.Unix(a.TS, 0).Format(time.RFC3339)
703 } 717 }
OLDNEW
« no previous file with comments | « no previous file | perf/go/types/types_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698