Skip to content

Commit 1c78a42

Browse files
committed
Log usage
1 parent 262fc17 commit 1c78a42

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

components/ws-daemon/pkg/cpulimit/cfs_v2.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"strings"
1414
"time"
1515

16+
"github.com/gitpod-io/gitpod/common-go/log"
1617
"golang.org/x/xerrors"
1718
)
1819

@@ -28,12 +29,14 @@ func (basePath CgroupV2CFSController) Usage() (CPUTime, error) {
2829
}
2930

3031
func (basePath CgroupV2CFSController) SetLimit(limit Bandwidth) (changed bool, err error) {
32+
log.Infof("Setting limit to %s, limit is %v", basePath, limit)
3133
quota, period, err := basePath.readCpuMax()
3234
if err != nil {
3335
return false, xerrors.Errorf("failed to read cpu max from %s: %w", basePath, err)
3436
}
3537

3638
target := limit.Quota(period)
39+
log.Infof("The target is %v, quota is %v", target.Microseconds(), quota.Microseconds())
3740
if quota == target {
3841
return false, nil
3942
}

components/ws-daemon/pkg/cpulimit/dispatch.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ func newCFSController(basePath, cgroupPath string) (CFSController, error) {
227227

228228
switch {
229229
case err == nil:
230+
log.Info("Using cgroup v2 cfs controller for cpu limiting")
230231
return CgroupV2CFSController(filepath.Join(basePath, cgroupPath)), nil
231232
case err == os.ErrNotExist:
233+
log.Info("Using cgroup v1 cfs controller for cpu limiting")
232234
return CgroupV1CFSController(filepath.Join(basePath, "cpu", cgroupPath)), nil
233235
default:
234236
return nil, err

0 commit comments

Comments
 (0)