mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +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
|
||||
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")
|
||||
|
@ -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'},
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user