Add TotalRAM detection

Colin originally wrote this for the highmem pool:

https://android-review.googlesource.com/c/platform/build/soong/+/1168271

But while that's a larger change, this is useful to just be in the logs,
and for use in multiproduct_kati to better limit the number of
concurrent jobs.

Test: check soong.log on linux and mac
Change-Id: I0518d303a220d775f8d78dba9f660b2954e68e3e
diff --git a/ui/build/config.go b/ui/build/config.go
index 565f033..fae569f 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -50,6 +50,9 @@
 	targetDevice    string
 	targetDeviceDir string
 
+	// Autodetected
+	totalRAM uint64
+
 	pdkBuild bool
 
 	brokenDupRules    bool
@@ -96,6 +99,8 @@
 	ret.parallel = runtime.NumCPU() + 2
 	ret.keepGoing = 1
 
+	ret.totalRAM = detectTotalRAM(ctx)
+
 	ret.parseArgs(ctx, args)
 
 	// Make sure OUT_DIR is set appropriately
@@ -716,6 +721,10 @@
 	return c.parallel
 }
 
+func (c *configImpl) TotalRAM() uint64 {
+	return c.totalRAM
+}
+
 func (c *configImpl) UseGoma() bool {
 	if v, ok := c.environ.Get("USE_GOMA"); ok {
 		v = strings.TrimSpace(v)