CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

BlockWipedPool Class Reference

#include <BlockWipedAllocator.h>

List of all members.

Public Types

typedef BlockWipedAllocator Allocator
typedef __gnu_cxx::hash_map
< std::size_t, Allocator
Pool

Public Member Functions

Allocatorallocator (std::size_t typeSize)
 BlockWipedPool (std::size_t blockSize, std::size_t maxRecycle)
void clear ()
template<typename Visitor >
void visit (Visitor &visitor) const
void wipe (bool force=true)
 ~BlockWipedPool ()

Private Attributes

std::size_t m_blockSize
Allocatorm_last
std::size_t m_lastSize
std::size_t m_maxRecycle
Pool m_pool

Detailed Description

Definition at line 111 of file BlockWipedAllocator.h.


Member Typedef Documentation

Definition at line 113 of file BlockWipedAllocator.h.

typedef __gnu_cxx::hash_map<std::size_t, Allocator> BlockWipedPool::Pool

Definition at line 115 of file BlockWipedAllocator.h.


Constructor & Destructor Documentation

BlockWipedPool::BlockWipedPool ( std::size_t  blockSize,
std::size_t  maxRecycle 
)

Definition at line 95 of file BlockWipedAllocator.cc.

                                                                         : 
  m_blockSize(blockSize),  m_maxRecycle(maxRecycle), m_last(0), m_lastSize(0){}
BlockWipedPool::~BlockWipedPool ( )

Definition at line 98 of file BlockWipedAllocator.cc.

References clear().

{clear();}

Member Function Documentation

BlockWipedPool::Allocator & BlockWipedPool::allocator ( std::size_t  typeSize)

Definition at line 102 of file BlockWipedAllocator.cc.

References likely, m_blockSize, m_last, m_lastSize, m_maxRecycle, m_pool, AlCaHLTBitMon_ParallelJobs::p, and edm::second().

Referenced by BlockWipedAllocated< _bqueue_item< T > >::allocator(), BlockWipedPoolAllocated::allocator(), and blockWipedAllocator().

                                                                       {
  if likely(m_lastSize==typeSize) return *m_last;
  Pool::iterator p=m_pool.find(typeSize);
  m_lastSize=typeSize;
  if likely (p!=m_pool.end())  return *(m_last = &(*p).second);
  return *(m_last=&(*m_pool.insert(std::make_pair(typeSize,Allocator(typeSize, m_blockSize, m_maxRecycle))).first).second);
}
void BlockWipedPool::clear ( void  )

Definition at line 116 of file BlockWipedAllocator.cc.

References BlockWipedAllocator::clear(), m_pool, and edm::second().

Referenced by BlockWipedAllocatorService::wiper(), and ~BlockWipedPool().

                           {
  std::for_each(m_pool.begin(),m_pool.end(),boost::bind(&Allocator::clear,
                                                        boost::bind(&Pool::value_type::second,_1)
                                                        ));
}
template<typename Visitor >
void BlockWipedPool::visit ( Visitor &  visitor) const [inline]

Definition at line 127 of file BlockWipedAllocator.h.

References m_pool, edm::second(), and cmsPerfHarvest::visit().

Referenced by BlockWipedAllocatorService::dump().

                                     {
    std::for_each(m_pool.begin(),m_pool.end(),boost::bind(&Visitor::visit,visitor,
                                                          boost::bind(&Pool::value_type::second,_1)
                                                          ));
  }
void BlockWipedPool::wipe ( bool  force = true)

Definition at line 110 of file BlockWipedAllocator.cc.

References m_pool, edm::second(), and BlockWipedAllocator::wipe().

Referenced by BlockWipedAllocatorService::preModule(), and BlockWipedAllocatorService::wiper().

                                    {
  std::for_each(m_pool.begin(),m_pool.end(),boost::bind(&Allocator::wipe,
                                                        boost::bind(&Pool::value_type::second,_1),force
                                                        ));
}

Member Data Documentation

std::size_t BlockWipedPool::m_blockSize [private]

Definition at line 135 of file BlockWipedAllocator.h.

Referenced by allocator().

Definition at line 138 of file BlockWipedAllocator.h.

Referenced by allocator().

std::size_t BlockWipedPool::m_lastSize [private]

Definition at line 139 of file BlockWipedAllocator.h.

Referenced by allocator().

std::size_t BlockWipedPool::m_maxRecycle [private]

Definition at line 136 of file BlockWipedAllocator.h.

Referenced by allocator().

Definition at line 137 of file BlockWipedAllocator.h.

Referenced by allocator(), clear(), visit(), and wipe().