瀏覽代碼

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 <kolyshkin@gmail.com>
Kir Kolyshkin 7 年之前
父節點
當前提交
654a7625fc
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      daemon/top_unix.go

+ 1 - 0
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 {