|
Squid Web Cache master
|
#include <PagePool.h>
Public Types | |
| typedef Ipc::Mem::Owner< PageStack > | Owner |
Public Member Functions | |
| PagePool (const char *const id) | |
| unsigned int | capacity () const |
| size_t | pageSize () const |
| unsigned int | size () const |
| lower bound for the number of free pages | |
| size_t | level () const |
| approximate number of shared memory pages used now | |
| size_t | level (const int purpose) const |
| approximate number of shared memory pages used now for given purpose | |
| bool | get (const PageId::Purpose purpose, PageId &page) |
| sets page ID and returns true unless no free pages are found | |
| void | put (PageId &page) |
| makes identified page available as a free page to future get() callers | |
| char * | pagePointer (const PageId &page) |
| converts page handler into a temporary writeable shared memory pointer | |
Static Public Member Functions | |
| static Owner * | Init (const char *const shmId, const Ipc::Mem::PoolId stackId, const unsigned int capacity, const size_t pageSize) |
Private Types | |
| using | Levels_t = PageStack::Levels_t |
Private Attributes | |
| Ipc::Mem::Pointer< PageStack > | pageIndex |
| free pages index | |
| Levels_t *const | theLevels |
| number of shared memory pages used now for each purpose | |
| char *const | theBuf |
| pages storage | |
Atomic container of shared memory pages. Implemented using a collection of Segments, each with a PageStack index of free pages. All pools must be created by a single process.
Definition at line 25 of file PagePool.h.
|
private |
Definition at line 52 of file PagePool.h.
Definition at line 28 of file PagePool.h.
| Ipc::Mem::PagePool::PagePool | ( | const char *const | id | ) |
Definition at line 29 of file PagePool.cc.
|
inline |
| bool Ipc::Mem::PagePool::get | ( | const PageId::Purpose | purpose, |
| PageId & | page | ||
| ) |
Definition at line 46 of file PagePool.cc.
References Ipc::Mem::PageId::maxPurpose, Must, and Ipc::Mem::PageId::purpose.
Referenced by Ipc::Mem::GetPage().
|
static |
Definition at line 19 of file PagePool.cc.
References capacity(), Ipc::Mem::PageStack::Config::capacity, Ipc::Mem::PageStack::Config::createFull, pageSize(), Ipc::Mem::PageStack::Config::pageSize, Ipc::Mem::PageStack::Config::poolId, and shm_new.
Referenced by SharedMemPagesRr::create().
|
inline |
Definition at line 39 of file PagePool.h.
References capacity(), and size().
Referenced by Ipc::Mem::PageLevel(), and Ipc::Mem::PageLevel().
Definition at line 39 of file PagePool.cc.
References Ipc::Mem::PageId::maxPurpose, and Must.
| char * Ipc::Mem::PagePool::pagePointer | ( | const PageId & | page | ) |
Definition at line 70 of file PagePool.cc.
References Must, and Ipc::Mem::PageId::number.
Referenced by Ipc::Mem::PagePointer().
|
inline |
| void Ipc::Mem::PagePool::put | ( | PageId & | page | ) |
Definition at line 58 of file PagePool.cc.
References Ipc::Mem::PageId::maxPurpose, Must, and Ipc::Mem::PageId::purpose.
Referenced by Ipc::Mem::PutPage().
|
inline |
|
private |
Definition at line 51 of file PagePool.h.
Referenced by capacity(), pageSize(), and size().
|
private |
Definition at line 56 of file PagePool.h.
|
private |
Definition at line 55 of file PagePool.h.