Skip to content

Instantly share code, notes, and snippets.

@jones-drew
Last active October 31, 2022 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jones-drew/1e860692cf6fc0fb2a82a04c9ce720fe to your computer and use it in GitHub Desktop.
Save jones-drew/1e860692cf6fc0fb2a82a04c9ce720fe to your computer and use it in GitHub Desktop.
kprobe:__memset
{
@total = count();
if (reg("si") != 0) {
return;
}
@zero = count();
if (reg("dx") < 64) {
@too_small = count();
return;
}
$i = 0x800000000000000;
while ($i > 0) {
if (!(reg("di") & ($i - 1))) {
@alignment = hist($i);
if ($i >= 64) {
@aligned64 = count();
}
break;
}
$i >>= 1;
}
}
interval:s:3
{
print(@total);
print(@zero);
print(@too_small);
print(@aligned64);
print(@alignment);
}
kprobe:__memset
{
@total = count();
if (reg("si") != 0) {
return;
}
@zero = count();
if (!(reg("di") & 63) && reg("dx") >= 64) {
@aligned = count();
} else if (reg("dx") >= 127) {
@unaligned = count();
} else {
@too_small = count();
}
}
interval:s:3
{
print(@total);
print(@zero);
print(@aligned);
print(@unaligned);
print(@too_small);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment