Class Raindrops
In: lib/raindrops.rb  (CVS)
lib/raindrops.rb  (CVS)
ext/raindrops/raindrops.c  (CVS)
Parent: Object

call-seq:

     rd.evaporate!        -> nil

Releases mmap()-ed memory allocated for the Raindrops object back to the OS. The Ruby garbage collector will also release memory automatically when it is not needed, but this forces release under high memory pressure.

Methods

[]   []=   capa   decr   evaporate!   incr   initialize_copy   new   size   size=   to_ary  

Classes and Modules

Module Raindrops::Aggregate
Module Raindrops::Linux
Class Raindrops::ListenStats
Class Raindrops::Middleware
Class Raindrops::Struct
Class Raindrops::Watcher

Constants

PAGE_SIZE = SIZET2NUM(rd_page_size)   The size of one page of memory for a mmap()-ed Raindrops region. Typically 4096 bytes under Linux.
SIZE = SIZET2NUM(raindrop_size)   The size (in bytes) of a slot in a Raindrops 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.

MAX = ULONG2NUM((unsigned long)-1)   The maximum value a raindrop counter can hold

Public Class methods

Initializes a Raindrops object to hold size counters. size is only a hint and the actual number of counters the object has is dependent on the CPU model, number of cores, and page size of the machine. The actual size of the object will always be equal or greater than the specified size.

Public Instance methods

Returns the value of the slot designated by index

Assigns value to the slot designated by index

Returns the number of slots allocated (but not necessarily used) by the Raindrops object.

Decrements the value referred to by the index by number. number defaults to +1+ if unspecified.

Releases mmap()-ed memory allocated for the Raindrops object back to the OS. The Ruby garbage collector will also release memory automatically when it is not needed, but this forces release under high memory pressure.

Increments the value referred to by the index by number. number defaults to +1+ if unspecified.

Duplicates and snapshots the current state of a Raindrops object.

Returns the number of counters a Raindrops object can hold. Due to page alignment, this is always equal or greater than the number of requested slots passed to Raindrops.new

Increases or decreases the current capacity of our Raindrop. Raises RangeError if new_size is too big or small for the current backing store

converts the Raindrops structure to an Array

[Validate]