From 318e33ce2cf1a0bea6b32894b8c3ac768dfb1200 Mon Sep 17 00:00:00 2001 From: baude Date: Tue, 23 Oct 2018 13:19:42 -0500 Subject: 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 --- libpod/oci.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libpod/oci.go') 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 } -- cgit v1.2.3-54-g00ecf