Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memparse: show process shared memory size #103

Merged
merged 2 commits into from
Sep 1, 2023
Merged
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
1 change: 1 addition & 0 deletions checkpointctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ func memparse(cmd *cobra.Command, args []string) error {
requiredFiles = append(
requiredFiles,
filepath.Join(metadata.CheckpointDirectory, "pagemap-"),
filepath.Join(metadata.CheckpointDirectory, "mm-"),
)
} else {
requiredFiles = append(
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/checkpoint-restore/checkpointctl
go 1.18

require (
github.com/checkpoint-restore/go-criu/v6 v6.3.1-0.20230807192453-2210c022f3aa
github.com/checkpoint-restore/go-criu/v6 v6.3.1-0.20230822084504-f3c069bb94de
github.com/containers/storage v1.48.0
github.com/olekukonko/tablewriter v0.0.5
github.com/opencontainers/runtime-spec v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/checkpoint-restore/go-criu/v6 v6.3.1-0.20230807192453-2210c022f3aa h1:1tLroyhJa0TAcT/+M37a4Uzh3tC90ForvkA1MymOi1c=
github.com/checkpoint-restore/go-criu/v6 v6.3.1-0.20230807192453-2210c022f3aa/go.mod h1:2tn0Jd4/R94ab1JR/OYdh0QXnM1RNN+OCkDYGQKCbFg=
github.com/checkpoint-restore/go-criu/v6 v6.3.1-0.20230822084504-f3c069bb94de h1:EWaQXnhXTEaaZeJObDoHPAxvhp9zvD55V8qldfxvEiw=
github.com/checkpoint-restore/go-criu/v6 v6.3.1-0.20230822084504-f3c069bb94de/go.mod h1:2tn0Jd4/R94ab1JR/OYdh0QXnM1RNN+OCkDYGQKCbFg=
github.com/containers/storage v1.48.0 h1:wiPs8J2xiFoOEAhxHDRtP6A90Jzj57VqzLRXOqeizns=
github.com/containers/storage v1.48.0/go.mod h1:pRp3lkRo2qodb/ltpnudoXggrviRmaCmU5a5GhTBae0=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down
7 changes: 7 additions & 0 deletions memparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func showProcessMemorySizeTables(tasks []task) error {
"PID",
"Process name",
"Memory size",
"Shared memory size",
}
table.SetHeader(header)
table.SetAutoMergeCells(false)
Expand All @@ -52,10 +53,16 @@ func showProcessMemorySizeTables(tasks []task) error {
memSize += int64(*entry.NrPages) * int64(pageSize)
}

shmemSize, err := memReader.GetShmemSize()
if err != nil {
return err
}

table.Append([]string{
fmt.Sprintf("%d", root.PID),
root.Comm,
metadata.ByteToString(memSize),
metadata.ByteToString(shmemSize),
})

for _, child := range root.Children {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# github.com/checkpoint-restore/go-criu/v6 v6.3.1-0.20230807192453-2210c022f3aa
# github.com/checkpoint-restore/go-criu/v6 v6.3.1-0.20230822084504-f3c069bb94de
## explicit; go 1.18
github.com/checkpoint-restore/go-criu/v6/crit
github.com/checkpoint-restore/go-criu/v6/crit/images/bpfmap-data
Expand Down
Loading