Skip to content

Commit

Permalink
Merge pull request #5 from wslyyy/main
Browse files Browse the repository at this point in the history
fix: sysmem bug
  • Loading branch information
ZhouYixun authored Dec 19, 2023
2 parents 22cda49 + e2167a9 commit 236ffc1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions perfd.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (c *perfdSysmontap) parseSystemData(dataArray []interface{}) {
var dataTime uint64 = 0
for _, value := range dataArray {
t, ok := value.(map[string]interface{})
if ok && t["SystemCPUUsage"] != nil && t["EndMachAbsTime"]!=nil && t["EndMachAbsTime"].(uint64) > dataTime {
if ok && t["SystemCPUUsage"] != nil && t["EndMachAbsTime"] != nil && t["EndMachAbsTime"].(uint64) > dataTime {
systemInfo = t
dataTime = t["EndMachAbsTime"].(uint64)
}
Expand Down Expand Up @@ -404,9 +404,10 @@ func (c *perfdSysmontap) parseSystemData(dataArray []interface{}) {
}

if c.options.SysMem {
kernelPageSize := int64(1) // why 16384 ?
kernelPageSize := int64(16384) // core_profile_session_tap get kernel_page_size
// kernelPageSize := int64(1) // why 16384 ?
appMemory := (systemAttributesMap["vmIntPageCount"] - systemAttributesMap["vmPurgeableCount"]) * kernelPageSize
cachedFiles := (systemAttributesMap["vmExtPageCount"] - systemAttributesMap["vmPurgeableCount"]) * kernelPageSize
cachedFiles := (systemAttributesMap["vmExtPageCount"] + systemAttributesMap["vmPurgeableCount"]) * kernelPageSize
compressed := systemAttributesMap["vmCompressorPageCount"] * kernelPageSize
usedMemory := (systemAttributesMap["vmUsedCount"] - systemAttributesMap["vmExtPageCount"]) * kernelPageSize
wiredMemory := systemAttributesMap["vmWireCount"] * kernelPageSize
Expand Down

0 comments on commit 236ffc1

Please sign in to comment.