Skip to content

Commit

Permalink
fix sysmem bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wu siyuan committed Nov 21, 2023
1 parent 83bbd02 commit e2167a9
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 e2167a9

Please sign in to comment.