/
usr
/
share
/
systemtap
/
examples
/
memory
/
/usr/share/systemtap/examples/memory
mkdir
upload
Name
Size
Mode
Actions
cachestat.meta
545
0644
edit
dl
rm
cachestat.stp
1318
0755
edit
dl
rm
glibc-malloc.meta
381
0644
edit
dl
rm
glibc-malloc.stp
2486
0755
edit
dl
rm
hugepage_clear_delays.meta
946
0644
edit
dl
rm
hugepage_clear_delays.stp
483
0755
edit
dl
rm
hugepage_collapse.meta
718
0644
edit
dl
rm
hugepage_collapse.stp
159
0755
edit
dl
rm
hugepage_cow_delays.meta
1106
0644
edit
dl
rm
hugepage_cow_delays.stp
475
0755
edit
dl
rm
hugepage_split.meta
756
0644
edit
dl
rm
hugepage_split.stp
153
0755
edit
dl
rm
hw_watch_addr.meta
787
0644
edit
dl
rm
hw_watch_addr.stp
167
0755
edit
dl
rm
hw_watch_addr.tcl
97
0644
edit
dl
rm
hw_watch_sym.meta
715
0644
edit
dl
rm
hw_watch_sym.stp
167
0755
edit
dl
rm
hw_watch_sym.tcl
97
0644
edit
dl
rm
kmalloc-top
3888
0755
edit
dl
rm
kmalloc-top.meta
695
0644
edit
dl
rm
last_100_frees.meta
420
0644
edit
dl
rm
last_100_frees.stp
803
0755
edit
dl
rm
last_100_frees.tcl
79
0644
edit
dl
rm
last_100_frees.txt
774
0644
edit
dl
rm
mmanonpage.meta
1225
0644
edit
dl
rm
mmanonpage.stp
1816
0755
edit
dl
rm
mmfilepage.meta
1033
0644
edit
dl
rm
mmfilepage.stp
3537
0755
edit
dl
rm
mmreclaim.meta
606
0644
edit
dl
rm
mmreclaim.stp
5232
0755
edit
dl
rm
mmwriteback.meta
1114
0644
edit
dl
rm
mmwriteback.stp
1900
0755
edit
dl
rm
numa_faults.meta
702
0644
edit
dl
rm
numa_faults.stp
973
0755
edit
dl
rm
numa_faults.txt
1710
0644
edit
dl
rm
overcommit.meta
584
0644
edit
dl
rm
overcommit.stp
217
0755
edit
dl
rm
pfaults.meta
744
0644
edit
dl
rm
pfaults.stp
875
0755
edit
dl
rm
pfaults.txt
558
0644
edit
dl
rm
vm.tracepoints.meta
608
0644
edit
dl
rm
vm.tracepoints.stp
414
0755
edit
dl
rm
vm.tracepoints.txt
557
0644
edit
dl
rm
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() }
Save
cmd:
run