ObjectCountHeapAnalyzer Class Reference

#include <coherence/lang/ObjectCountHeapAnalyzer.hpp>

Inherits Object, and HeapAnalyzer.

List of all members.


Detailed Description

ObjectCountHeapAnalyzer provides simple heap analysis based soley on the count of the number of live objects in the system.

This heap analyzer has next to no CPU or memory costs, there is a single 64 bit counter which is updated using the non-blocking compare-and-set operations. It is well suited for performance sensitive production envrionments.

See also:
ClassBasedHeapAnalyzer for more detailed heap analysis
Author:
mf 2008.04.27

Public Types

typedef spec::Handle Handle
 ObjectCountHeapAnalyzer Handle definition.
typedef spec::View View
 ObjectCountHeapAnalyzer View definition.
typedef spec::Holder Holder
 ObjectCountHeapAnalyzer Holder definition.

Public Member Functions

virtual
HeapAnalyzer::Snapshot::View 
capture () const
 Capture a Snapshot of the current state of the heap.

Returns:
a Snapshot of the current state of the heap.

virtual
HeapAnalyzer::Snapshot::View 
delta (HeapAnalyzer::Snapshot::View vSnap) const
 Compute the delta between the supplied Snapshot and the current heap state.

Parameters:
vThat the snapshot to compare against.
Returns:
a snapshot containing the delta

virtual int64_t getObjectCount () const
 Return the number of registered objects.

Returns:
the number of registered objects

virtual void toStream (std::ostream &out) const
 Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a manged String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);

Parameters:
out the stream used to output the description


Protected Member Functions

 ObjectCountHeapAnalyzer ()
 Create a new ObjectCountHeapAnalyzer.
virtual void registerObject (const Object &o)
 Register a newly created Object with the system.

This method is called automatically by coherence::lang::Object once the Object has finished construction.

Parameters:
o the newly created Object.

virtual void unregisterObject (const Object &o)
 Unregister an Object with the system.

This method is called automatically by coherence::lang::Object just prior to the deletion of the Object. No new handles or views may be created to the object.

Parameters:
o the Object to unregister


Protected Attributes

coherence::native::NativeAtomic64 m_cObjects
 The object count.

Classes

class  Snapshot
 Snapshot containging the object count. More...

Constructor & Destructor Documentation

ObjectCountHeapAnalyzer (  )  [protected]

Create a new ObjectCountHeapAnalyzer.

Returns:
the analyzer


The documentation for this class was generated from the following file: Copyright (c) 2000-2008 Oracle. All rights reserved.