Skip to content

Commit

Permalink
Added RDMA controller
Browse files Browse the repository at this point in the history
Signed-off-by: bpopovschi <zyqsempai@mail.ru>
  • Loading branch information
Zyqsempai committed Nov 15, 2019
1 parent d26e1b3 commit 1637d63
Show file tree
Hide file tree
Showing 6 changed files with 773 additions and 53 deletions.
6 changes: 6 additions & 0 deletions v2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type Resources struct {
Memory *Memory
Pids *Pids
IO *IO
RDMA *RDMA
}

// Values returns the raw filenames and values that
Expand All @@ -56,6 +57,7 @@ func (r *Resources) Values() (o []Value) {
r.Memory,
r.Pids,
r.IO,
r.RDMA,
}
for _, v := range values {
if v == nil {
Expand Down Expand Up @@ -326,6 +328,10 @@ func (c *Manager) Stat() (*stats.Metrics, error) {
ThpFaultAlloc: out["thp_fault_alloc"].(uint64),
ThpCollapseAlloc: out["thp_collapse_alloc"].(uint64),
}

metrics.Rdma.Current = rdmaStats(filepath.Join(c.path, "rdma.current"))
metrics.Rdma.Limit = rdmaStats(filepath.Join(c.path, "rdma.max"))

return &metrics, nil
}

Expand Down
46 changes: 46 additions & 0 deletions v2/rdma.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v2

import (
"fmt"
)

type RDMA struct {
Limit []RDMAEntry
}

type RDMAEntry struct {
Device string
HcaHandles uint32
HcaObjects uint32
}

func (r RDMAEntry) String() string {
return fmt.Sprintf("%s hca_handle=%d hca_object=%d", r.Device, r.HcaHandles, r.HcaObjects)
}

func (r *RDMA) Values() (o []Value) {
for _, e := range r.Limit {
o = append(o, Value{
filename: "rdma.max",
value: e.String(),
})
}

return o
}
Loading

0 comments on commit 1637d63

Please sign in to comment.