diff options
author | Zhaozhong Ni <nzz@google.com> | 2018-06-19 11:04:05 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-06-19 11:04:54 -0700 |
commit | 5581256f879f4249de5ebffddaf0626fcb39eebd (patch) | |
tree | 96044e1214fa1f667920d4c2fadf8c2e026f3161 /pkg/state/encode.go | |
parent | 4fd1d40e1d874ef4eb2f6cb13de66f1b756aa92c (diff) |
state: include I/O and protobuf time in kernel S/R timing stats.
PiperOrigin-RevId: 201205733
Change-Id: I300307b0668989ba7776ab9e3faee71efdd33f46
Diffstat (limited to 'pkg/state/encode.go')
-rw-r--r-- | pkg/state/encode.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/state/encode.go b/pkg/state/encode.go index 1cec14f24..59914bef4 100644 --- a/pkg/state/encode.go +++ b/pkg/state/encode.go @@ -241,6 +241,7 @@ func (es *encodeState) encodeInterface(obj reflect.Value) *pb.Interface { // If mapAsValue is true, then a map will be encoded directly. func (es *encodeState) encodeObject(obj reflect.Value, mapAsValue bool, format string, param interface{}) (object *pb.Object) { es.push(false, format, param) + es.stats.Add(obj) es.stats.Start(obj) switch obj.Kind() { @@ -354,10 +355,13 @@ func (es *encodeState) Serialize(obj reflect.Value) { // Pop off the list until we're done. for es.pending.Len() > 0 { e := es.pending.Front() - es.pending.Remove(e) // Extract the queued object. qo := e.Value.(queuedObject) + es.stats.Start(qo.obj) + + es.pending.Remove(e) + es.from = &qo.path o := es.encodeObject(qo.obj, true, "", nil) @@ -368,6 +372,7 @@ func (es *encodeState) Serialize(obj reflect.Value) { // Mark as done. es.done.PushBack(e) + es.stats.Done() } // Write a zero-length terminal at the end; this is a sanity check |