diff options
author | baude <bbaude@redhat.com> | 2018-10-23 13:19:42 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2018-10-23 13:21:33 -0500 |
commit | 318e33ce2cf1a0bea6b32894b8c3ac768dfb1200 (patch) | |
tree | cffc3566b999b9a9daec9e24333266d0643f8f66 /libpod | |
parent | d043ac4de52d1bab07aca98487792e6b4d3d4689 (diff) | |
download | podman-318e33ce2cf1a0bea6b32894b8c3ac768dfb1200.tar.gz podman-318e33ce2cf1a0bea6b32894b8c3ac768dfb1200.tar.bz2 podman-318e33ce2cf1a0bea6b32894b8c3ac768dfb1200.zip |
read conmon output and convert to json in two steps
when reading the output from conmon using the JSON methods, it appears that
JSON marshalling is higher in pprof than it really is because the pipe is
"waiting" for a response. this gives us a clearer look at the real CPU/time
consumers.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/oci.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/oci.go b/libpod/oci.go index 2257cd42f..ca8f967c4 100644 --- a/libpod/oci.go +++ b/libpod/oci.go @@ -1,6 +1,7 @@ package libpod import ( + "bufio" "bytes" "encoding/json" "fmt" @@ -418,7 +419,12 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, res ch := make(chan syncStruct) go func() { var si *syncInfo - if err = json.NewDecoder(parentPipe).Decode(&si); err != nil { + rdr := bufio.NewReader(parentPipe) + b, err := rdr.ReadBytes('\n') + if err != nil { + ch <- syncStruct{err: err} + } + if err := json.Unmarshal(b, &si); err != nil { ch <- syncStruct{err: err} return } |