Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
/*
* aio requests queue up on the aio_async_workq or lio_sync_workq (for
* lio_listio LIO_WAIT). Requests then move to the per process aio_activeq
* (proc.aio_activeq) when one of our worker threads start the IO.
* And finally, requests move to the per process aio_doneq (proc.aio_doneq)
* when the IO request completes. The request remains on aio_doneq until
* user process calls aio_return or the process exits, either way that is our
* trigger to release aio resources.
*/
/* look for lio_listio LIO_NOP requests and ignore them. */
/* Not really an error, but we need to free our aio_workq_entry. */
if ( entryp->aiocb.aio_lio_opcode == LIO_NOP ) {
result = 0;
goto error_exit;
}
01:50:35 open /opt/local/ruby19/lib/ruby/1.9.1/i386-darwin9.7.0/aio.rb 0.000006 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/aio.bundle 0.000006 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/ext/aio/aio.bundle 0.000008 ruby
01:50:35 stat /Users/lourens/projects/rb_aio_native/ext/aio/aio.bundle 0.000009 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/ext/aio/aio.bundle 0.000007 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/test/test_control_block.rb 0.000009 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/test/test_control_block.rb 0.000006 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/test/scratch
1) Failure:
test_listio_read_non_blocking(TestAio) [test/test_aio.rb:27]:
<["one", "two", "three", "four"]> expected but was
<["\x03\x00\x00", "two", "three", "four"]>.
methodmissing:rb_aio_native lourens$ rake bench
(in /Users/lourens/projects/rb_aio_native)
/opt/local/bin/ruby bench/read.rb
* Bench reads ...
Rehearsal -------------------------------------------------------------
AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.000100)
IO.read 0.000000 0.000000 0.000000 ( 0.000257)
---------------------------------------------------- total: 0.000000sec
user system total real
1) Failure:
test_listio_read_non_blocking(TestAio) [test/test_aio.rb:28]:
<["one", "two", "three", "four"]> expected but was
<["\x03", "two\xC0o#\x14\xC0", "three,\x14\xC0", "fourO2\x14\xC0"]>.
methodmissing:rb_aio_native lourens$ rake bench
(in /Users/lourens/projects/rb_aio_native)
/opt/local/ruby19/bin/ruby bench/read.rb
Rehearsal -------------------------------------------------------------
AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.001029)
IO.read 0.000000 0.000000 0.000000 ( 0.000424)
---------------------------------------------------- total: 0.000000sec
user system total real
AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.000024)
methodmissing:rb_aio_native lourens$ rake bench
(in /Users/lourens/projects/rb_aio_native)
/opt/local/ruby19/bin/ruby bench/read.rb
dir /Users/lourens in PATH, mode 040753
Rehearsal -------------------------------------------------------------
AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.000154)
IO.read 0.000000 0.000000 0.000000 ( 0.000346)
---------------------------------------------------- total: 0.000000sec
user system total real
static void
rb_strhash_convert(VALUE *val)
{
int i;
VALUE values;
switch (TYPE(*val)) {
case T_HASH:
*val = rb_hash_strhash(*val);
break;
static struct st_hash_type objstrhash = {
rb_strhash_hash_cmp,
rb_strhash_hash,
};
static VALUE
strhash_alloc(VALUE klass)
{
VALUE hash = strhash_alloc0(&klass);