diff --git a/README.md b/README.md index 17ab3f1..abc3e88 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/poller.go b/poller.go index ee4b1b0..721d767 100644 --- a/poller.go +++ b/poller.go @@ -10,6 +10,7 @@ import ( "time" "github.com/containerd/cgroups" + v1 "github.com/containerd/cgroups/stats/v1" ) type Record struct { @@ -20,7 +21,8 @@ type Record struct { type Stats struct { Rss []Record - Stats []*cgroups.MemoryStat + Stats []*v1.Metrics + // Stats []*cgroups.MemoryStat } type endReq struct { @@ -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) }