/usr/share/systemtap/examples/memory
NameSizeModeActions
cachestat.meta5450644editdlrm
cachestat.stp13180755editdlrm
glibc-malloc.meta3810644editdlrm
glibc-malloc.stp24860755editdlrm
hugepage_clear_delays.meta9460644editdlrm
hugepage_clear_delays.stp4830755editdlrm
hugepage_collapse.meta7180644editdlrm
hugepage_collapse.stp1590755editdlrm
hugepage_cow_delays.meta11060644editdlrm
hugepage_cow_delays.stp4750755editdlrm
hugepage_split.meta7560644editdlrm
hugepage_split.stp1530755editdlrm
hw_watch_addr.meta7870644editdlrm
hw_watch_addr.stp1670755editdlrm
hw_watch_addr.tcl970644editdlrm
hw_watch_sym.meta7150644editdlrm
hw_watch_sym.stp1670755editdlrm
hw_watch_sym.tcl970644editdlrm
kmalloc-top38880755editdlrm
kmalloc-top.meta6950644editdlrm
last_100_frees.meta4200644editdlrm
last_100_frees.stp8030755editdlrm
last_100_frees.tcl790644editdlrm
last_100_frees.txt7740644editdlrm
mmanonpage.meta12250644editdlrm
mmanonpage.stp18160755editdlrm
mmfilepage.meta10330644editdlrm
mmfilepage.stp35370755editdlrm
mmreclaim.meta6060644editdlrm
mmreclaim.stp52320755editdlrm
mmwriteback.meta11140644editdlrm
mmwriteback.stp19000755editdlrm
numa_faults.meta7020644editdlrm
numa_faults.stp9730755editdlrm
numa_faults.txt17100644editdlrm
overcommit.meta5840644editdlrm
overcommit.stp2170755editdlrm
pfaults.meta7440644editdlrm
pfaults.stp8750755editdlrm
pfaults.txt5580644editdlrm
vm.tracepoints.meta6080644editdlrm
vm.tracepoints.stp4140755editdlrm
vm.tracepoints.txt5570644editdlrm
Edit: /usr/share/systemtap/examples/memory/mmfilepage.stp (3537B)
#!/usr/bin/stap # # Note that there are 2 sets of filemap kernel tracepoints: # # - older kernels RHEL5 (2.6.18) - RHEL6 (2.6.32): mm_filemap_fault, # mm_filemap_cow, mm_filemap_unmap mm_filemap_userunmap # - newer kernels: mm_filemap_add_to_page_cache, # mm_filemap_delete_from_page_cache # # This script attempts to handle them both. global traced_pid, command global allocation, free global old_set_hits global file_fault, file_cow, file_uunmap, file_kunmap global file_page_cache_add, file_page_cache_delete function log_event:long () { return (!traced_pid || traced_pid == pid()) } probe kernel.{trace("mm_page_alloc")!, trace("mm_page_allocation")} { if (!log_event()) next allocation[pid()] <<< 1 command[pid()] = execname() } probe kernel.{trace("mm_page_free")!, trace("mm_page_free_direct")} { if (!log_event()) next free[pid()] <<< 1 } probe kernel.trace("mm_filemap_fault")? { if (!log_event()) next old_set_hits <<< 1 file_fault[pid()] <<< 1 } probe kernel.trace("mm_filemap_cow")? { if (!log_event()) next old_set_hits <<< 1 file_cow[pid()] <<< 1 } probe kernel.trace("mm_filemap_unmap")? { if (!log_event()) next old_set_hits <<< 1 file_kunmap[pid()] <<< 1 } probe kernel.trace("mm_filemap_userunmap")? { if (!log_event()) next old_set_hits <<< 1 file_uunmap[pid()] <<< 1 } probe kernel.trace("mm_filemap_add_to_page_cache")? { if (!log_event()) next file_page_cache_add[pid()] <<< 1 } probe kernel.trace("mm_filemap_delete_from_page_cache")? { if (!log_event()) next file_page_cache_delete[pid()] <<< 1 } probe never { # Do a few initializations to let stap know what the global # variable types are. Note that since we're in a "never" # probe, these initializations will never actually happen. traced_pid = 0 old_set_hits <<< 1 file_fault[0] <<< 1 file_cow[0] <<< 1 file_uunmap[0] <<< 1 file_kunmap[0] <<< 1 file_page_cache_add[0] <<< 1 file_page_cache_delete[0] <<< 1 } probe begin { printf("Starting data collection\n") if (target()) printf("mode Specific Pid, traced pid: %d\n\n", target()) else printf("mode - All Pids\n\n") } function print_old_format:long () { printf("Command Pid Alloc Free F_fault F_cow F_kunmap F_uunmap\n") printf("------- --- ----- ---- ------- ----- -------- --------\n") foreach (pid+ in allocation) { printf("%-16s %10d %9d %9d %8d %8d %8d %8d\n", command[pid], pid, @count(allocation[pid]), @count(free[pid]), @count(file_fault[pid]), @count(file_cow[pid]), @count(file_kunmap[pid]), @count(file_uunmap[pid])) } } function print_new_format:long () { printf("Command Pid Alloc Free CacheAdd CacheDel\n") printf("------- --- ----- ---- -------- --------\n") foreach (pid+ in allocation) { printf("%-16s %10d %9d %9d %8d %8d\n", command[pid], pid, @count(allocation[pid]), @count(free[pid]), @count(file_page_cache_add[pid]), @count(file_page_cache_delete[pid])) } } probe end { printf("Terminating data collection\n") # We'll either have hits from the old set of filemap tracepoints # (mm_filemap_fault, mm_filemap_cow, mm_filemap_unmap, # mm_filemap_userunmap) or the new set of filemap tracepoints # (mm_filemap_add_to_page_cache, # mm_filemap_delete_from_page_cache). Print out the set that got # hits. if (@count(old_set_hits)) print_old_format() else print_new_format() }