This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ELAPSED TIME DISTRIBUTION, | |
| calloc | |
| value ------------- Distribution ------------- count | |
| 2048 | 0 | |
| 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 35 | |
| 8192 |@@@@@ 5 | |
| 16384 | 0 | |
| 32768 |@ 1 | |
| 65536 | 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static VALUE | |
| vafuncall(recv, mid, n, ar) | |
| VALUE recv; | |
| ID mid; | |
| int n; | |
| va_list *ar; | |
| { | |
| VALUE *argv; | |
| if (n > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static inline VALUE | |
| call_cfunc(func, recv, len, argc, argv) | |
| VALUE (*func)(); | |
| VALUE recv; | |
| int len, argc; | |
| VALUE *argv; | |
| { | |
| if (len >= 0 && argc != len) { | |
| rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", | |
| argc, len); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static VALUE | |
| rb_f_throw(argc, argv) | |
| int argc; | |
| VALUE *argv; | |
| { | |
| VALUE tag, value; | |
| struct tag *tt = prot_tag; | |
| rb_scan_args(argc, argv, "11", &tag, &value); | |
| tag = ID2SYM(rb_to_id(tag)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void | |
| return_jump(retval) | |
| VALUE retval; | |
| { | |
| struct tag *tt = prot_tag; | |
| int yield = Qfalse; | |
| if (retval == Qundef) retval = Qnil; | |
| while (tt) { | |
| if (tt->tag == PROT_YIELD) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| VALUE rb_str_buf_new _((long)); | |
| VALUE rb_str_buf_new2 _((const char*)); | |
| VALUE rb_str_buf_append _((VALUE, VALUE)); | |
| VALUE rb_str_buf_cat _((VALUE, const char*, long)); | |
| VALUE rb_str_buf_cat2 _((VALUE, const char*)); |