Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
VALUE
#ifdef HAVE_STDARG_PROTOTYPES
rb_funcall(VALUE recv, ID mid, int n, ...)
#else
rb_funcall(recv, mid, n, va_alist)
VALUE recv;
ID mid;
int n;
va_dcl
#endif
static VALUE
vafuncall(recv, mid, n, ar)
VALUE recv;
ID mid;
int n;
va_list *ar;
{
VALUE *argv;
if (n > 0) {
static VALUE
internal_read_func(void *ptr)
{
struct io_internal_struct *iis = (struct io_internal_struct*)ptr;
return read(iis->fd, iis->buf, iis->capa);
}
static VALUE
internal_write_func(void *ptr)
{
typedef struct rb_io_t {
int fd; /* file descriptor */
FILE *stdio_file; /* stdio ptr for read/write if available */
int mode; /* mode flags: FMODE_XXXs */
rb_pid_t pid; /* child's pid (for pipes) */
int lineno; /* number of lines read */
VALUE pathv; /* pathname for file */
void (*finalize)(struct rb_io_t*,int); /* finalize proc */
char *wbuf; /* wbuf_off + wbuf_len <= wbuf_capa */
ELAPSED TIME DISTRIBUTION,
calloc
value ------------- Distribution ------------- count
2048 | 0
4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 35
8192 |@@@@@ 5
16384 | 0
32768 |@ 1
65536 | 0
#!/usr/sbin/dtrace -Zs
/*
Memory allocation / deallocation instrumentation with the PID provider
(c) 2009 Lourens Naudé (methodmissing) */
#pragma D option quiet
#pragma D option switchrate=10
#pragma D option dynvarsize=128m
#pragma D option bufsize=128m
methodmissing:projects lourens$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.5.1]
methodmissing:extlib lourens$ sudo dtrace -s memory.d -c 'rake'
(in /Users/lourens/projects/extlib)
rm -r coverage
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
methodmissing:extlib lourens$ ruby -v
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9.7.0]
methodmissing:extlib lourens$ sudo dtrace -s memory.d -c 'rake'
(in /Users/lourens/projects/extlib)
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
methodmissing:extlib lourens$ jruby -v
jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_13) [x86_64-java]
methodmissing:extlib lourens$ sudo dtrace -s memory.d -c 'jruby -S rake'
(in /Users/lourens/projects/extlib)
..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
#!/usr/sbin/dtrace -Zs
/*
sudo dtrace -Zs walk.d -c 'ruby test.rb'
*/
#pragma D option quiet
#pragma D option switchrate=10
#pragma D option dynvarsize=128m
#pragma D option bufsize=128m