Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Commit a849446

Browse files
committed
Fix Interpreter benchmarks
1 parent e62187f commit a849446

File tree

1 file changed

+47
-6
lines changed

1 file changed

+47
-6
lines changed

interpreter_test.go

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ func TestInterpret(t *testing.T) {
103103
expected1 := InterpretedField{Name: "", FieldID: 12, EnterpriseID: 15397, RawValue: []byte{0, 0, 0, 0}}
104104

105105
fl := i.Interpret(msg.DataRecords[0])
106-
for _, f := range fl {
107-
t.Logf("%#v", f)
108-
}
106+
// for _, f := range fl {
107+
// t.Logf("%#v", f)
108+
// }
109109
if !reflect.DeepEqual(fl[0], expected0) {
110110
t.Error(fl[0], "!=\n", expected0)
111111
}
@@ -114,9 +114,9 @@ func TestInterpret(t *testing.T) {
114114
}
115115

116116
fl = i.InterpretInto(msg.DataRecords[0], make([]InterpretedField, len(fl)))
117-
for _, f := range fl {
118-
t.Logf("%#v", f)
119-
}
117+
// for _, f := range fl {
118+
// t.Logf("%#v", f)
119+
// }
120120
if !reflect.DeepEqual(fl[0], expected0) {
121121
t.Error(fl[0], "!=\n", expected0)
122122
}
@@ -137,6 +137,7 @@ func BenchmarkInterpret(b *testing.B) {
137137
if err != nil {
138138
b.Fatal("ParseReader failed", err)
139139
}
140+
addCustomFields(i)
140141

141142
pb.Write(p1)
142143
msg, err := p.ParseReader(pb)
@@ -168,6 +169,7 @@ func BenchmarkInterpretInto(b *testing.B) {
168169
if err != nil {
169170
b.Fatal("ParseReader failed", err)
170171
}
172+
addCustomFields(i)
171173

172174
pb.Write(p1)
173175
msg, err := p.ParseReader(pb)
@@ -187,3 +189,42 @@ func BenchmarkInterpretInto(b *testing.B) {
187189
}
188190
}
189191
}
192+
193+
func addCustomFields(i *Interpreter) {
194+
i.AddDictionaryEntry(DictionaryEntry{
195+
Name: "proceraService",
196+
Type: String,
197+
EnterpriseID: 15397,
198+
FieldID: 1,
199+
})
200+
i.AddDictionaryEntry(DictionaryEntry{
201+
Name: "proceraIncomingOctets",
202+
Type: Uint64,
203+
EnterpriseID: 15397,
204+
FieldID: 3,
205+
})
206+
i.AddDictionaryEntry(DictionaryEntry{
207+
Name: "proceraOutgoingOctets",
208+
Type: Uint64,
209+
EnterpriseID: 15397,
210+
FieldID: 4,
211+
})
212+
i.AddDictionaryEntry(DictionaryEntry{
213+
Name: "proceraExternalRtt",
214+
Type: Uint32,
215+
EnterpriseID: 15397,
216+
FieldID: 12,
217+
})
218+
i.AddDictionaryEntry(DictionaryEntry{
219+
Name: "proceraServerHostname",
220+
Type: String,
221+
EnterpriseID: 15397,
222+
FieldID: 18,
223+
})
224+
i.AddDictionaryEntry(DictionaryEntry{
225+
Name: "proceraSubscriberId",
226+
Type: String,
227+
EnterpriseID: 15397,
228+
FieldID: 28,
229+
})
230+
}

0 commit comments

Comments
 (0)