fix memory val not geeting updated
This commit is contained in:
@@ -220,13 +220,17 @@ func (p *ProtoPackage) build(ctx context.Context) (time.Duration, error) {
|
|||||||
log.Errorf("error getting PGID: %v", err)
|
log.Errorf("error getting PGID: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var peakMem int64
|
var peakMem *int64
|
||||||
done := make(chan bool)
|
done := make(chan bool)
|
||||||
go pollMemoryUsage(pgid, 1*time.Second, done, &peakMem)
|
go pollMemoryUsage(pgid, 1*time.Second, done, peakMem)
|
||||||
|
|
||||||
err = cmd.Wait()
|
err = cmd.Wait()
|
||||||
close(done)
|
close(done)
|
||||||
|
|
||||||
|
if peakMem == nil {
|
||||||
|
log.Warningf("memory reading failed")
|
||||||
|
}
|
||||||
|
|
||||||
Rusage, ok := cmd.ProcessState.SysUsage().(*syscall.Rusage)
|
Rusage, ok := cmd.ProcessState.SysUsage().(*syscall.Rusage)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Panicf("rusage is not of type *syscall.Rusage, are we running on unix-like?")
|
log.Panicf("rusage is not of type *syscall.Rusage, are we running on unix-like?")
|
||||||
@@ -325,7 +329,7 @@ func (p *ProtoPackage) build(ctx context.Context) (time.Duration, error) {
|
|||||||
SetBuildTimeStart(start).
|
SetBuildTimeStart(start).
|
||||||
SetLastVersionBuild(p.Version).
|
SetLastVersionBuild(p.Version).
|
||||||
SetTagRev(p.State.TagRev).
|
SetTagRev(p.State.TagRev).
|
||||||
SetMaxRss(int64(peakMem)).
|
SetMaxRss(*peakMem).
|
||||||
SetIoOut(Rusage.Oublock).
|
SetIoOut(Rusage.Oublock).
|
||||||
SetIoIn(Rusage.Inblock).
|
SetIoIn(Rusage.Inblock).
|
||||||
SetUTime(Rusage.Utime.Sec).
|
SetUTime(Rusage.Utime.Sec).
|
||||||
|
3
utils.go
3
utils.go
@@ -855,8 +855,7 @@ func pollMemoryUsage(pid int, interval time.Duration, done chan bool, peakMem *i
|
|||||||
case <-done:
|
case <-done:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
totalRSS := int64(0)
|
var totalRSS, totalSwap int64
|
||||||
totalSwap := int64(0)
|
|
||||||
|
|
||||||
rootStats, err := getMemoryStats(pid)
|
rootStats, err := getMemoryStats(pid)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Reference in New Issue
Block a user