Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

Commit 6163c4c

Browse files
Andreas Voellmerxtreme-stevehiehn
authored andcommitted
Make SystemProfiler platform specific;
Signed-off-by: Steve Hiehn <[email protected]>
1 parent 975d905 commit 6163c4c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

profiler/system-profiler.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package profiler
22

3-
import "github.com/shirou/gopsutil/mem"
3+
import (
4+
"github.com/shirou/gopsutil/mem"
5+
"runtime"
6+
)
47

58
type SystemProfiler struct {
69
}
@@ -11,7 +14,11 @@ func (s *SystemProfiler)GetAvailableMemory() (uint64, error){
1114
return 0, err
1215
}
1316

14-
return virtualMemory.Free/1000000, nil
17+
if runtime.GOOS == "windows" {
18+
return virtualMemory.Available / 1000000, nil
19+
}
20+
21+
return virtualMemory.Free / 1000000, nil
1522
}
1623

1724
func (s *SystemProfiler)GetTotalMemory()(uint64, error){

0 commit comments

Comments
 (0)