Skip to content

Instantly share code, notes, and snippets.

@dalehamel
Created November 20, 2019 15:44
Show Gist options
  • Save dalehamel/e98936a8655be5125a01668cf4e74347 to your computer and use it in GitHub Desktop.
Save dalehamel/e98936a8655be5125a01668cf4e74347 to your computer and use it in GitHub Desktop.
BEGIN
{
printf("%-20s %10s %10s %10s\n", "MEMCACHED KEY", "CALLS", "OBJSIZE", "REQ/s");
@start = nsecs;
}
// NOTE - this presently omits incr, decr, and delete because they have a
// different signature
usdt::memcached:command__get,
usdt::memcached:command__set,
usdt::memcached:command__add,
usdt::memcached:command__append,
usdt::memcached:command__prepend,
usdt::memcached:command__touch,
usdt::memcached:command__cas,
usdt::memcached:command__replace
{
@calls[str(arg1, arg2)]++;
$objsize = arg3;
$interval = (nsecs - @start) / 1000000000;
$cps = @calls[str(arg1)] / $interval;
printf("%-20s %10d %10d %10d\n", str(arg1, arg2), @calls[str(arg1, arg2)],
$objsize, $cps)
}
END
{
clear(@start);
clear(@calls);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment