Skip to content

Commit

Permalink
fixes part 2 of platform snafu
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hausenblas <[email protected]>
  • Loading branch information
mhausenblas committed Feb 15, 2020
1 parent 380c3ac commit 0bace02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func assessidle() {
icmd.Run()
f := Findings{}
if icmd.ProcessState != nil {
f.MemoryMaxRSS = icmd.ProcessState.SysUsage().(*syscall.Rusage).Maxrss
f.MemoryMaxRSS = int64(icmd.ProcessState.SysUsage().(*syscall.Rusage).Maxrss)
f.CPUuser = int64(icmd.ProcessState.SysUsage().(*syscall.Rusage).Utime.Usec)
f.CPUsys = int64(icmd.ProcessState.SysUsage().(*syscall.Rusage).Stime.Usec)
}
Expand All @@ -107,13 +107,14 @@ func assesspeak(apiport, apipath string, peakhammerpause time.Duration) {
pcmd.Run()
f := Findings{}
if pcmd.ProcessState != nil {
f.MemoryMaxRSS = pcmd.ProcessState.SysUsage().(*syscall.Rusage).Maxrss
f.MemoryMaxRSS = int64(pcmd.ProcessState.SysUsage().(*syscall.Rusage).Maxrss)
f.CPUuser = int64(pcmd.ProcessState.SysUsage().(*syscall.Rusage).Utime.Usec)
f.CPUsys = int64(pcmd.ProcessState.SysUsage().(*syscall.Rusage).Stime.Usec)
}
peakf <- f
}

// stress performs an HTTP GET stress test against the port/path provided
func stress(apiport, apipath string, peakhammerpause time.Duration) {
time.Sleep(1 * time.Second)
ep := fmt.Sprintf("http://127.0.0.1:%v%v", apiport, apipath)
Expand All @@ -127,6 +128,7 @@ func stress(apiport, apipath string, peakhammerpause time.Duration) {
}
}

// export writes the findings to a file or stdout, if exportfile is empty
func export(ifs, pfs Findings, exportfile string) {
fs := map[string]Findings{
"idle": ifs,
Expand Down

0 comments on commit 0bace02

Please sign in to comment.