Skip to content

Commit

Permalink
add vm volume usage to the total usage and skip the metric
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Aug 29, 2018
1 parent 50f7517 commit 4b929ce
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions util/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,20 @@ func parseDfLines(out string) []*DfStat {
continue
}

if runtime.GOOS == "darwin" && strings.HasPrefix(dfstat.Mounted, "/Volumes/") {
continue
if runtime.GOOS == "darwin" {
if strings.HasPrefix(dfstat.Mounted, "/Volumes/") {
continue
}
// Skip APFS vm partition, add its usage to the root filesystem.
if dfstat.Mounted == "/private/var/vm" {
for _, fs := range filesystems {
if fs.Mounted == "/" {
fs.Used += dfstat.Used
break
}
}
continue
}
}

filesystems = append(filesystems, dfstat)
Expand Down

0 comments on commit 4b929ce

Please sign in to comment.