From 654a7625fc9f0b7b04da0e0e4d151af04a65cc7f Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 22 May 2018 16:23:07 -0700 Subject: [PATCH] daemon/parsePsOutput: minor optimisation It does not make sense to keep looking for PID once we found it, so let's give it a break. The side effect of this patch is, if there's more than one column titled "PID", the last (rightmost) column was used before, and now the first (leftmost) column is used. Should make no practical difference whatsoever. Signed-off-by: Kir Kolyshkin --- daemon/top_unix.go | 1 + 1 file changed, 1 insertion(+) diff --git a/daemon/top_unix.go b/daemon/top_unix.go index a54fa37ffa..28cfb370d8 100644 --- a/daemon/top_unix.go +++ b/daemon/top_unix.go @@ -70,6 +70,7 @@ func parsePSOutput(output []byte, procs []uint32) (*container.ContainerTopOKBody for i, name := range procList.Titles { if name == "PID" { pidIndex = i + break } } if pidIndex == -1 {