#!/usr/bin/env bpftrace
# ievicttrace - trace from where / how inodes are evicted by Linux kernel

#include <linux/fs.h>

/*
kprobe:evict {
	@ievict[kstack] = count();
}

interval:s:3 {
	print(@ievict);
	clear(@ievict);
}
*/

kprobe:fuse_evict_inode {
	$inode = (inode *)arg0;
	$t = elapsed / 1000;
	printf("%d.%d EVICT i%d: %s\n", $t/1000000, $t%1000000, $inode->i_ino, kstack);
}