adding slabwatch

This commit is contained in:
tengel 2024-03-20 11:28:46 -05:00
parent b0c41b4d6f
commit e47e1103e9

31
stp/slabwatch.stp Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env stap
#
# SPDX-License-Identifier: MIT
global slabs
global freed
probe vm.kmem_cache_alloc {
slabs [execname(), bytes_alloc, ptr, gfp_flag_name]<<<1
}
probe vm.kmem_cache_free {
freed [execname(), ptr, name]<<<1
}
probe begin {
print("\"TYPE\",\"PROCESS\",\"POINTER\",\"BYTES\",\"FLAGS/NAME\"\n");
}
probe timer.ms(10000) {
foreach ([name, bytes, ptr, flags] in slabs) {
printf("\"ALLOC\",\"%s\",\"%p\",\"%d\",\"%s\"\n",
name, ptr, bytes, flags);
}
foreach ([execname, ptr, name] in freed) {
printf("\"FREE\",\"%s\",\"%p\",\"\",\"%s\"\n",
execname, ptr, name);
}
delete slabs
delete freed
}