Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
VALUE
rb_hash_aref(hash, key)
VALUE hash, key;
{
VALUE val;
if (!st_lookup(RHASH(hash)->tbl, key, &val)) {
return rb_funcall(hash, id_default, 1, key);
}
return val;
void
rb_include_module(klass, module)
VALUE klass, module;
{
VALUE p, c;
int changed = 0;
rb_frozen_class_p(klass);
if (!OBJ_TAINTED(klass)) {
rb_secure(4);
Sampling process 3522 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling ruby (pid 3522) every 1 millisecond
Call graph:
2185 Thread_2507
2185 start
2185 main
2185 ruby_run_node
2185 ruby_exec_node
2185 rb_iseq_eval_main
require 'rubygems'
require 'ffi'
module Aio
extend FFI::Library
READ_CALLBACK = Proc.new do |sigval|
req = sigval.sival_ptr
if aio_error( req ) == 0
ret = aio_return( req );
pid$target::st_lookup:entry {
self->arg2 = arg2;
printf("\nKey %d, value %d\n", arg1, *(uint32_t *)copyin(self->arg2, 4));
}
typedef unsigned long rb_value_t;
typedef unsigned long rb_id_t;
typedef unsigned long st_data_t;
struct st_table_entry {
unsigned int hash;
st_data_t key;
st_data_t record;
caddr_t next;
};
#!/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;
struct st_table {
struct st_hash_type *type;
int num_bins = 11;
int num_entries = 1;
struct st_table_entry **bins;
};
struct st_table {
struct st_hash_type *type;
int num_bins = 283;
int num_entries = 814;
strhash( setegid )
strhash( allocate )
numhash( 9697 )
strhash( setreuid )
strhash( setreuid )
numhash( 9705 )
strhash( initialize )
strhash( initialize_copy )
numhash( 9705 )
strhash( __attached__ )
#ifdef HASH_LOG
static int collision = 0;
static int init_st = 0;
static void
stat_col()
{
FILE *f = fopen("/tmp/col", "w");
fprintf(f, "collision: %d\n", collision);
fclose(f);