Class: Pitchfork::MemoryPage

Inherits:
Object
  • Object
show all
Defined in:
ext/pitchfork_http/memory_page.c

Constant Summary collapse

PAGE_SIZE =

The size of one page of memory for a mmap()-ed MemoryPage region. Typically 4096 bytes under Linux.

SIZET2NUM(page_size)
SLOT_SIZE =

The size (in bytes) of a slot in a MemoryPage object. This is the size of a word on single CPU systems and the size of the L1 cache line size if detectable.

Defaults to 128 bytes if undetectable.

SIZET2NUM(slot_size)
SLOTS =
SIZET2NUM(page_size / slot_size)
SLOT_MAX =

The maximum value a slot counter can hold

ULONG2NUM((unsigned long)-1)

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ Object



140
141
142
143
# File 'ext/pitchfork_http/memory_page.c', line 140

static VALUE memory_page_aref(VALUE self, VALUE index)
{
    return ULONG2NUM(*memory_page_address(self, index));
}

#[]=(index, value) ⇒ Object



145
146
147
148
149
150
# File 'ext/pitchfork_http/memory_page.c', line 145

static VALUE memory_page_aset(VALUE self, VALUE index, VALUE value)
{
    unsigned long *addr = memory_page_address(self, index);
    *addr = NUM2ULONG(value);
    return value;
}