Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,23 @@ grained reporting):
And there is even a handy flag to modify the environment:

$ mstat -o data/mem.tsv -freq 59 -env LD_PRELOAD=libawesome.so -- ./test

### Use `mstat` without Docker ###
Prerequisite:
* [golang](https://golang.org/)

After installing golang and cloning this repository, download all the go dependencies with the command

$ cd mstat
$ go get -d ./...

Then proceed with make and installation. If you want to be able to uninstall
`mstat` later, instead of using `make install`, use the command below

$ sudo checkinstall

You will be able to uninstall `mstat` by running

$ sudo dpkg -r mstat

later.
6 changes: 4 additions & 2 deletions poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/containerd/cgroups"
v1 "github.com/containerd/cgroups/stats/v1"
)

type Record struct {
Expand All @@ -20,7 +21,8 @@ type Record struct {

type Stats struct {
Rss []Record
Stats []*cgroups.MemoryStat
Stats []*v1.Metrics
// Stats []*cgroups.MemoryStat
}

type endReq struct {
Expand Down Expand Up @@ -60,7 +62,7 @@ func NewPoller(cgroup cgroups.Cgroup, freq int) (*Poller, error) {

func (p *Poller) poll(t time.Time, cgroup cgroups.Cgroup) error {

stats, err := cgroup.Stat()
stats, err := cgroup.Stat(cgroups.ErrorHandler(cgroups.IgnoreNotExist))
if err != nil || stats == nil {
return fmt.Errorf("cg.Stat: %s", err)
}
Expand Down