mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Report on system memory size
This commit is contained in:
parent
e3e9f89861
commit
d8f9c096f3
13
CONTRIBUTING.md
Normal file
13
CONTRIBUTING.md
Normal file
@ -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
CONTRIBUTORS
Normal file
0
CONTRIBUTORS
Normal file
19
LICENSE
Normal file
19
LICENSE
Normal file
@ -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
main.go
6
main.go
@ -89,6 +89,7 @@ type report struct {
|
|||||||
RepoMaxMiB int
|
RepoMaxMiB int
|
||||||
MemoryUsageMiB int
|
MemoryUsageMiB int
|
||||||
SHA256Perf float64
|
SHA256Perf float64
|
||||||
|
MemorySize int
|
||||||
}
|
}
|
||||||
|
|
||||||
var cache map[string]interface{}
|
var cache map[string]interface{}
|
||||||
@ -123,6 +124,7 @@ func reportHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
var maxMiB []int
|
var maxMiB []int
|
||||||
var memoryUsage []int
|
var memoryUsage []int
|
||||||
var sha256Perf []float64
|
var sha256Perf []float64
|
||||||
|
var memorySize []int
|
||||||
|
|
||||||
for _, fn := range files {
|
for _, fn := range files {
|
||||||
f, err := os.Open(fn)
|
f, err := os.Open(fn)
|
||||||
@ -148,6 +150,9 @@ func reportHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
maxMiB = append(maxMiB, rep.RepoMaxMiB)
|
maxMiB = append(maxMiB, rep.RepoMaxMiB)
|
||||||
memoryUsage = append(memoryUsage, rep.MemoryUsageMiB)
|
memoryUsage = append(memoryUsage, rep.MemoryUsageMiB)
|
||||||
sha256Perf = append(sha256Perf, rep.SHA256Perf)
|
sha256Perf = append(sha256Perf, rep.SHA256Perf)
|
||||||
|
if rep.MemorySize > 0 {
|
||||||
|
memorySize = append(memorySize, rep.MemorySize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cache = make(map[string]interface{})
|
cache = make(map[string]interface{})
|
||||||
@ -162,6 +167,7 @@ func reportHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
cache["maxMiB"] = statsForInts(maxMiB)
|
cache["maxMiB"] = statsForInts(maxMiB)
|
||||||
cache["memoryUsage"] = statsForInts(memoryUsage)
|
cache["memoryUsage"] = statsForInts(memoryUsage)
|
||||||
cache["sha256Perf"] = statsForFloats(sha256Perf)
|
cache["sha256Perf"] = statsForFloats(sha256Perf)
|
||||||
|
cache["memorySize"] = statsForInts(memorySize)
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
@ -20,6 +20,7 @@ reports.controller('ReportsCtrl', function ($scope, $http) {
|
|||||||
{key: 'numNodes', descr: 'Number of Nodes in Cluster', unit: ''},
|
{key: 'numNodes', descr: 'Number of Nodes in Cluster', unit: ''},
|
||||||
{key: 'numRepos', descr: 'Number of Repositories Configured', unit: ''},
|
{key: 'numRepos', descr: 'Number of Repositories Configured', unit: ''},
|
||||||
{key: 'memoryUsage', descr: 'Memory Usage', unit: 'MiB'},
|
{key: 'memoryUsage', descr: 'Memory Usage', unit: 'MiB'},
|
||||||
|
{key: 'memorySize', descr: 'System Memory', unit: 'MiB'},
|
||||||
{key: 'sha256Perf', descr: 'SHA-256 Hashing Performance', unit: 'MiB/s'},
|
{key: 'sha256Perf', descr: 'SHA-256 Hashing Performance', unit: 'MiB/s'},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user