cmd/compilebench: report rss measurement

Change-Id: I4a0f6e75dea97413ab22f589ae2b4f36bec4b081
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223750
Reviewed-by: Austin Clements <austin@google.com>
diff --git a/cmd/compilebench/main.go b/cmd/compilebench/main.go
index df74357..094a56c 100644
--- a/cmd/compilebench/main.go
+++ b/cmd/compilebench/main.go
@@ -440,8 +440,8 @@
 	}
 	end := time.Now()
 
-	haveAllocs := false
-	var allocs, allocbytes int64
+	haveAllocs, haveRSS := false, false
+	var allocs, allocbytes, rssbytes int64
 	if *flagAlloc || *flagMemprofile != "" {
 		out, err := ioutil.ReadFile(dir + "/_compilebench_.memprof")
 		if err != nil {
@@ -462,6 +462,9 @@
 				allocbytes = val
 			case "Mallocs":
 				allocs = val
+			case "MaxRSS":
+				haveRSS = true
+				rssbytes = val
 			}
 		}
 		if !haveAllocs {
@@ -502,6 +505,9 @@
 	if haveAllocs {
 		fmt.Printf(" %d B/op %d allocs/op", allocbytes, allocs)
 	}
+	if haveRSS {
+		fmt.Printf(" %d maxRSS/op", rssbytes)
+	}
 
 	return nil
 }