explain logging and weight fixing

This commit is contained in:
Barak Michener 2014-08-16 05:19:16 -04:00
parent e1e95b9686
commit e453385d5e
10 changed files with 95 additions and 14 deletions

View file

@ -183,6 +183,9 @@ type IteratorStats struct {
ContainsCost int64
NextCost int64
Size int64
Next int64
Contains int64
ContainsNext int64
}
// Type enumerates the set of Iterator types.
@ -250,6 +253,24 @@ func (t Type) String() string {
return types[t]
}
type StatsContainer struct {
IteratorStats
Kind string
Uid uint64
SubIts []StatsContainer
}
func DumpStats(it Iterator) StatsContainer {
var out StatsContainer
out.IteratorStats = it.Stats()
out.Kind = it.Type().String()
out.Uid = it.UID()
for _, sub := range it.SubIterators() {
out.SubIts = append(out.SubIts, DumpStats(sub))
}
return out
}
// Utility logging functions for when an iterator gets called Next upon, or Contains upon, as
// well as what they return. Highly useful for tracing the execution path of a query.
func ContainsLogIn(it Iterator, val Value) {