(cgroupPath string)
| 657 | } |
| 658 | |
| 659 | func readMemoryStats(cgroupPath string) (*stats.MemoryStat, error) { |
| 660 | memoryStat := make(map[string]uint64, 40) |
| 661 | if err := readKVStatsFile(cgroupPath, "memory.stat", memoryStat); err != nil { |
| 662 | if os.IsNotExist(err) { |
| 663 | return &stats.MemoryStat{}, nil |
| 664 | } |
| 665 | return nil, err |
| 666 | } |
| 667 | return &stats.MemoryStat{ |
| 668 | Anon: memoryStat["anon"], |
| 669 | File: memoryStat["file"], |
| 670 | KernelStack: memoryStat["kernel_stack"], |
| 671 | Slab: memoryStat["slab"], |
| 672 | Sock: memoryStat["sock"], |
| 673 | Shmem: memoryStat["shmem"], |
| 674 | FileMapped: memoryStat["file_mapped"], |
| 675 | FileDirty: memoryStat["file_dirty"], |
| 676 | FileWriteback: memoryStat["file_writeback"], |
| 677 | AnonThp: memoryStat["anon_thp"], |
| 678 | InactiveAnon: memoryStat["inactive_anon"], |
| 679 | ActiveAnon: memoryStat["active_anon"], |
| 680 | InactiveFile: memoryStat["inactive_file"], |
| 681 | ActiveFile: memoryStat["active_file"], |
| 682 | Unevictable: memoryStat["unevictable"], |
| 683 | SlabReclaimable: memoryStat["slab_reclaimable"], |
| 684 | SlabUnreclaimable: memoryStat["slab_unreclaimable"], |
| 685 | Pgfault: memoryStat["pgfault"], |
| 686 | Pgmajfault: memoryStat["pgmajfault"], |
| 687 | WorkingsetRefault: memoryStat["workingset_refault"], |
| 688 | WorkingsetActivate: memoryStat["workingset_activate"], |
| 689 | WorkingsetNodereclaim: memoryStat["workingset_nodereclaim"], |
| 690 | Pgrefill: memoryStat["pgrefill"], |
| 691 | Pgscan: memoryStat["pgscan"], |
| 692 | Pgsteal: memoryStat["pgsteal"], |
| 693 | Pgactivate: memoryStat["pgactivate"], |
| 694 | Pgdeactivate: memoryStat["pgdeactivate"], |
| 695 | Pglazyfree: memoryStat["pglazyfree"], |
| 696 | Pglazyfreed: memoryStat["pglazyfreed"], |
| 697 | ThpFaultAlloc: memoryStat["thp_fault_alloc"], |
| 698 | ThpCollapseAlloc: memoryStat["thp_collapse_alloc"], |
| 699 | Usage: getStatFileContentUint64(filepath.Join(cgroupPath, "memory.current")), |
| 700 | UsageLimit: getStatFileContentUint64(filepath.Join(cgroupPath, "memory.max")), |
| 701 | MaxUsage: getStatFileContentUint64(filepath.Join(cgroupPath, "memory.peak")), |
| 702 | SwapUsage: getStatFileContentUint64(filepath.Join(cgroupPath, "memory.swap.current")), |
| 703 | SwapLimit: getStatFileContentUint64(filepath.Join(cgroupPath, "memory.swap.max")), |
| 704 | SwapMaxUsage: getStatFileContentUint64(filepath.Join(cgroupPath, "memory.swap.peak")), |
| 705 | PSI: getStatPSIFromFile(filepath.Join(cgroupPath, "memory.pressure")), |
| 706 | }, nil |
| 707 | } |
| 708 | |
| 709 | func readMemoryEvents(cgroupPath string) (*stats.MemoryEvents, error) { |
| 710 | memoryEvents := make(map[string]uint64) |
no test coverage detected
searching dependent graphs…