Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created June 16, 2009 22:28
Show Gist options
  • Select an option

  • Save methodmissing/130948 to your computer and use it in GitHub Desktop.

Select an option

Save methodmissing/130948 to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -s
#pragma D option quiet
typedef struct st_table {
struct st_hash_type *type;
int num_bins;
int num_entries;
struct st_table_entry **bins;
} st_table_t;
translator st_table_t < struct st_table *ST > {
type = (struct st_hash_type *)ST->type;
num_bins = *(int *)copyin((uintptr_t)&ST->num_bins, sizeof (int));
num_entries = *(int *)copyin((uintptr_t)&ST->num_entries, sizeof (int));
bins = (struct st_table_entry **)ST->bins;
};
pid$target::st_lookup:entry {
self->bins = (xlate < st_table_t * > (((st_table_t *)arg0)))->num_bins;
self->entries = (xlate < st_table_t * > (((st_table_t *)arg0)))->num_entries;
printf("\nKey %d, value %d, bins %d, entries %d\n", arg1, *(uint32_t *)copyin(arg2, 4), self->bins, self->entries);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment