From 82cf8fe9e40457849d52b296233f15dd4d4de940 Mon Sep 17 00:00:00 2001 From: qiongsi Date: Tue, 10 Sep 2019 09:27:32 -0400 Subject: [PATCH 1/3] Fixing an issue where mstat is trying to read from non-existent cgroup --- poller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poller.go b/poller.go index ee4b1b0..3f586f8 100644 --- a/poller.go +++ b/poller.go @@ -60,7 +60,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) } From 064069707d1d882b5a1429e78744007c3828a4ba Mon Sep 17 00:00:00 2001 From: qiongsi Date: Tue, 10 Sep 2019 09:36:14 -0400 Subject: [PATCH 2/3] Adding instructions on how to run mstat standalone --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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. From 3dd51d8c7695f1bcc144b43e17aa0e025ed67b71 Mon Sep 17 00:00:00 2001 From: Qiongsi Wu Date: Mon, 9 Dec 2019 17:24:51 +0000 Subject: [PATCH 3/3] included stats from v1 --- poller.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/poller.go b/poller.go index 3f586f8..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 {