Fennel: SegPageIter Class Reference (original) (raw)

When visiting a chain of pages via Segment.getPageSuccessor, SegPageIter can be used to automatically initiate prefetches. More...

#include <[SegPageIter.h](SegPageIter%5F8h-source.html)>

Inheritance diagram for SegPageIter:

List of all members.

Public Member Functions
SegPageIter ()
Constructor: iterator starts out singular.
void mapRange (SegmentAccessor const &segmentAccessor, PageId beginPageId, PageId endPageId=NULL_PAGE_ID)
Begins a new iteration.
PageId operator * () const
**Returns:**the current PageId in the iteration
void operator++ ()
Moves to the next prefetched PageId.
void forcePrefetchReject ()
Forces the next pre-fetch request to be rejected.
void makeSingular ()
Aborts any iteration in progress and release all resources.
bool isSingular () const
**Returns:**true iff no iteration is in progress
Protected Member Functions
void initPrefetchQueue ()
Reads the pre-fetch parameters, sizes the pre-fetch queue, and initializes various state variables related to the queue.
void prefetchPage (PageId pageId)
Pre-fetches a specified page.
Protected Attributes
SegmentAccessor segmentAccessor
Accessor for the Segment containing the pages to be visited.
PageId endPageId
PageId at which to stop iteration.
std::vector< PageId > prefetchQueue
Fixed-size circular queue of prefetched PageIds, indexed by iFetch.
uint iFetch
Position in prefetchQueue.
bool atEnd
Whether end of iteration has been reached by prefetch (but not necessarily by fetch).
uint queueSize
Current size of the pre-fetch queue.
int nFreePageSlots
Number of slots available in the prefetchQueue.
Private Attributes
uint prefetchPagesMax
Maximum number of outstanding pre-fetch requests.
uint prefetchThrottleRate
Number of successful pre-fetches before pre-fetch can be throttled back up.
uint currPageSlot
Current slot in the prefetchQueue that needs to be populated.
bool noPrefetch
True if pre-fetches have been turned off.
uint throttleCount
The remaining number of successful pre-fetches that need to occur before the pre-fetch rate can be throttled back up.
bool forceReject
If true, force the next pre-fetch request to be rejected.

Detailed Description

When visiting a chain of pages via Segment.getPageSuccessor, SegPageIter can be used to automatically initiate prefetches.

The caller supplies the starting point, and the SegPageIter class takes care of reading ahead in the chain via getPageSuccessor and issuing prefetch calls.

NOTE: this is not an STL-style iterator.

Definition at line 44 of file SegPageIter.h.


Constructor & Destructor Documentation

| SegPageIter::SegPageIter | ( | | ) | [explicit] | | ------------------------ | - | | - | ------------ |

Constructor: iterator starts out singular.

Definition at line 40 of file SegPageIter.cpp.


Member Function Documentation

| void SegPageIter::initPrefetchQueue | ( | | ) | [protected] | | ----------------------------------- | - | | - | ------------- |

Reads the pre-fetch parameters, sizes the pre-fetch queue, and initializes various state variables related to the queue.

Definition at line 66 of file SegPageIter.cpp.

References atEnd, currPageSlot, forceReject, iFetch, nFreePageSlots, noPrefetch, SegmentAccessor::pCacheAccessor, prefetchPagesMax, prefetchQueue, prefetchThrottleRate, queueSize, segmentAccessor, and throttleCount.

Referenced by mapRange(), and SegPageEntryIter< EntryT >::mapRange().

void SegPageIter::prefetchPage ( PageId pageId ) [protected]

Pre-fetches a specified page.

Parameters:

pageId the id of the page to be pre-fetched

Definition at line 110 of file SegPageIter.cpp.

References atEnd, currPageSlot, endPageId, forceReject, iFetch, nFreePageSlots, noPrefetch, NULL_BLOCK_ID, SegmentAccessor::pCacheAccessor, prefetchPagesMax, prefetchQueue, prefetchThrottleRate, SegmentAccessor::pSegment, queueSize, segmentAccessor, and throttleCount.

Referenced by mapRange(), operator++(), and SegPageEntryIter< EntryT >::prefetchPages().

Begins a new iteration.

Parameters:

segmentAccessor accessor for the segment containing the pages to visit
beginPageId the ID of the first page to visit
endPageId the ID at which to end iteration; by default, this is NULL_PAGE_ID (representing the sentinel end of a chain) but the iteration (and prefetch) can be stopped earlier with some other known PageId; note that endPageId itself will not be prefetched

Reimplemented in SegPageEntryIter< EntryT >, SegPageEntryIter< BTreePrefetchSearchKey >, and SegPageEntryIter< LcsRid >.

Definition at line 44 of file SegPageIter.cpp.

References atEnd, endPageId, initPrefetchQueue(), SegmentAccessor::pCacheAccessor, prefetchPage(), prefetchQueue, SegmentAccessor::pSegment, queueSize, and segmentAccessor.

Referenced by SegInputStream::startPrefetch(), and SegPageIterTest::testIter().

| PageId SegPageIter::operator * | ( | | ) | const [inline] | | ------------------------------- | - | | - | ---------------- |

Returns:

the current PageId in the iteration

Definition at line 156 of file SegPageIter.h.

| void SegPageIter::operator++ | ( | | ) | | ---------------------------- | - | | - |

Moves to the next prefetched PageId.

An assertion violation results if called when positioned on endPageId.

Reimplemented in SegPageEntryIter< EntryT >, SegPageEntryIter< BTreePrefetchSearchKey >, and SegPageEntryIter< LcsRid >.

Definition at line 87 of file SegPageIter.cpp.

References atEnd, currPageSlot, endPageId, iFetch, isSingular(), nFreePageSlots, prefetchPage(), prefetchQueue, SegmentAccessor::pSegment, queueSize, and segmentAccessor.

| void SegPageIter::forcePrefetchReject | ( | | ) | | ------------------------------------- | - | | - |

| void SegPageIter::makeSingular | ( | | ) | [inline] | | ------------------------------ | - | | - | ---------- |

| bool SegPageIter::isSingular | ( | | ) | const [inline] | | ---------------------------- | - | | - | ---------------- |


Member Data Documentation


The documentation for this class was generated from the following files:


Generated on Mon Jun 22 04:00:46 2009 for Fennel by doxygen 1.5.1