Browse Source

Report on system memory size

Jakob Borg 11 years ago
parent
commit
d8f9c096f3
5 changed files with 39 additions and 0 deletions
  1. 13 0
      CONTRIBUTING.md
  2. 0 0
      CONTRIBUTORS
  3. 19 0
      LICENSE
  4. 6 0
      main.go
  5. 1 0
      static/app.js

+ 13 - 0
CONTRIBUTING.md

@@ -0,0 +1,13 @@
+## Licensing
+
+All contributions are made under the same MIT License as the rest of the
+project, except documentation which is licensed under the Creative
+Commons Attribution 4.0 International License. You retain the copyright
+to code you have written.
+
+When accepting your first contribution, the maintainer of the project
+will ensure that you are added to the CONTRIBUTORS file.
+
+## Style
+
+`go fmt` for Go code.

+ 0 - 0
CONTRIBUTORS


+ 19 - 0
LICENSE

@@ -0,0 +1,19 @@
+Copyright (C) 2014 Jakob Borg and other contributors (see the CONTRIBUTORS file).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+- The above copyright notice and this permission notice shall be included in
+  all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 6 - 0
main.go

@@ -89,6 +89,7 @@ type report struct {
 	RepoMaxMiB     int
 	MemoryUsageMiB int
 	SHA256Perf     float64
+	MemorySize     int
 }
 
 var cache map[string]interface{}
@@ -123,6 +124,7 @@ func reportHandler(w http.ResponseWriter, r *http.Request) {
 		var maxMiB []int
 		var memoryUsage []int
 		var sha256Perf []float64
+		var memorySize []int
 
 		for _, fn := range files {
 			f, err := os.Open(fn)
@@ -148,6 +150,9 @@ func reportHandler(w http.ResponseWriter, r *http.Request) {
 			maxMiB = append(maxMiB, rep.RepoMaxMiB)
 			memoryUsage = append(memoryUsage, rep.MemoryUsageMiB)
 			sha256Perf = append(sha256Perf, rep.SHA256Perf)
+			if rep.MemorySize > 0 {
+				memorySize = append(memorySize, rep.MemorySize)
+			}
 		}
 
 		cache = make(map[string]interface{})
@@ -162,6 +167,7 @@ func reportHandler(w http.ResponseWriter, r *http.Request) {
 		cache["maxMiB"] = statsForInts(maxMiB)
 		cache["memoryUsage"] = statsForInts(memoryUsage)
 		cache["sha256Perf"] = statsForFloats(sha256Perf)
+		cache["memorySize"] = statsForInts(memorySize)
 	}
 
 	w.Header().Set("Content-Type", "application/json")

+ 1 - 0
static/app.js

@@ -20,6 +20,7 @@ reports.controller('ReportsCtrl', function ($scope, $http) {
 	{key: 'numNodes', descr: 'Number of Nodes in Cluster', unit: ''},
 	{key: 'numRepos', descr: 'Number of Repositories Configured', unit: ''},
 	{key: 'memoryUsage', descr: 'Memory Usage', unit: 'MiB'},
+	{key: 'memorySize', descr: 'System Memory', unit: 'MiB'},
 	{key: 'sha256Perf', descr: 'SHA-256 Hashing Performance', unit: 'MiB/s'},
 	];