Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/common-go/cgroups/v2/io.go
2500 views
1
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package cgroups_v2
6
7
import (
8
"path/filepath"
9
10
"github.com/gitpod-io/gitpod/common-go/cgroups"
11
)
12
13
type IO struct {
14
path string
15
}
16
17
func NewIOControllerWithMount(mountPoint, path string) *IO {
18
fullPath := filepath.Join(mountPoint, path)
19
return &IO{
20
path: fullPath,
21
}
22
}
23
24
func NewIOController(path string) *IO {
25
return &IO{
26
path: path,
27
}
28
}
29
30
func (io *IO) PSI() (cgroups.PSI, error) {
31
path := filepath.Join(io.path, "io.pressure")
32
return cgroups.ReadPSIValue(path)
33
}
34
35
func (io *IO) Max() ([]cgroups.DeviceIOMax, error) {
36
path := filepath.Join(io.path, "io.max")
37
return cgroups.ReadIOMax(path)
38
}
39
40