#include <LWPoolArea.h>
|
static LWPoolArea * | create (unsigned chunksize, char *mem, unsigned length_of_mem, unsigned nchunks=UINT_MAX) |
|
|
static unsigned | calcNChunks (unsigned chunksize, unsigned length_of_mem) |
|
Definition at line 25 of file LWPoolArea.h.
◆ LWPoolArea() [1/2]
◆ LWPoolArea() [2/2]
LWPoolArea::LWPoolArea |
( |
unsigned |
chunksize, |
|
|
unsigned |
nchunks |
|
) |
| |
|
private |
◆ ~LWPoolArea()
LWPoolArea::~LWPoolArea |
( |
| ) |
|
|
inlineprivate |
◆ acquire()
char* LWPoolArea::acquire |
( |
| ) |
|
◆ belongsInArea()
bool LWPoolArea::belongsInArea |
( |
char * |
c | ) |
const |
◆ calcNChunks()
unsigned LWPoolArea::calcNChunks |
( |
unsigned |
chunksize, |
|
|
unsigned |
length_of_mem |
|
) |
| |
|
staticprivate |
Definition at line 21 of file LWPoolArea.cxx.
23 assert(chunksize<UINT_MAX);
34 const unsigned ntotbytes = length_of_mem-
sizeof(
LWPoolArea);
37 nchunks = ntotbytes/chunksize;
43 nchunks -= (-balance)/chunksize;
55 if (wastage*1.0>0.05*ntotbytes||wastage>640) {
56 std::cout<<
"LWHist MemPool (chunksize: "<<chunksize<<
") WARNING: Wasting "
57 <<wastage<<
" bytes per area ("<<(wastage*100.0/ntotbytes)<<
" %)"<<std::endl;
59 std::cout<<
"chunksize "<<chunksize<<
": totsize:"<<length_of_mem<<std::endl;
60 std::cout<<
"chunksize "<<chunksize<<
": sizeof(LWPoolArea):"<<
sizeof(
LWPoolArea)<<std::endl;
62 unsigned bytes_useful(nchunks*chunksize);
63 unsigned bytes_overhead(length_of_mem-bytes_useful);
64 std::cout<<
"chunksize "<<chunksize<<
": nchunks:"<<nchunks<<
" => "<<bytes_useful<<
" bytes"<<std::endl;
65 std::cout<<
"chunksize "<<chunksize<<
": rounding wastage:"<<wastage<<std::endl;
66 std::cout<<
"chunksize "<<chunksize<<
": total overhead:"
67 <<bytes_overhead<<
" ("<<bytes_overhead*100.0/bytes_useful<<
"% ~ "
68 <<bytes_overhead*CHAR_BIT*1.0/nchunks<<
" bits/chunk)"<<std::endl;
◆ create()
static LWPoolArea* LWPoolArea::create |
( |
unsigned |
chunksize, |
|
|
char * |
mem, |
|
|
unsigned |
length_of_mem, |
|
|
unsigned |
nchunks = UINT_MAX |
|
) |
| |
|
static |
◆ getMemDishedOut()
long long LWPoolArea::getMemDishedOut |
( |
| ) |
const |
◆ getMemUnusedButAllocated()
long long LWPoolArea::getMemUnusedButAllocated |
( |
| ) |
const |
◆ isUnused()
bool LWPoolArea::isUnused |
( |
| ) |
const |
◆ operator=()
◆ release()
void LWPoolArea::release |
( |
char * |
c | ) |
|
◆ totalNumberOfChunks()
unsigned LWPoolArea::totalNumberOfChunks |
( |
| ) |
const |
|
inline |
◆ m_area
◆ m_bookkeep
◆ m_chunksize
const unsigned LWPoolArea::m_chunksize |
|
private |
◆ m_nchunks
const unsigned LWPoolArea::m_nchunks |
|
private |
The documentation for this class was generated from the following files: