[PATCH 2/3] powerpc: Instrument Hypervisor Calls: add wrappers
Arnd Bergmann
arnd at arndb.de
Thu Jun 15 21:09:39 EST 2006
On Thursday 15 June 2006 01:52, Mike Kravetz wrote:
> I'm really wondering what would be the best way to make these stats
> available to userspace. As mentioned, putting them into sysfs would
> violate the one value/one file rule. The use of /proc is discouraged.
> debugfs was mentioned, but I have never used it. Noticed that debugfs
> was enabled in the default config (at least for pseries). Looks like
> that would be the best alternative. Agree?
Debugfs sounds good. If you use one file per hcall, it's probably as
easy as
static u64 hcall_stats_get(void *data)
{
unsigned long index = (unsigned long)data;
return read_hcall_count(index);
}
DEFINE_SIMPLE_ATTRIBUTE(hcall_fops, hcall_stats_get, NULL, "%llu\n");
void hcall_stats_create(void)
{
unsigned long i;
struct dentry *dir;
dir = debugfs_create_dir("hcall_stats", NULL);
for (i=0; i <= MAX_HCALL_OPCODES; i++) {
char name[16];
sprintf(name, "%d", i << 2);
debugfs_create_file(name, 0444, dir, (void *)i, &hcall_fops);
}
}
Arnd <><
More information about the Linuxppc-dev
mailing list