Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.4.0)

E90870-01

ObjectCountHeapAnalyzer Class Reference

#include <coherence/lang/ObjectCountHeapAnalyzer.hpp>

Inherits Object, and HeapAnalyzer.

List of all members.


Detailed Description

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

This heap analyzer has low CPU and memory costs. It is well suited for performance sensitive production environments.

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.

Note, when performing captures in a loop, and assigning the captured snapshot to a handle referencing a snapshot, it is advisable to NULL out the handle first, so as to avoid the new snapshot including the "cost" of snapshot it is about to replace.

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 int64_t getImmortalCount () const
 Return the number of objects which have been marked as uncollectable.

Return the number of objects which have been marked as uncollectable.

virtual TypedHandle
< const String
toString () const
 Output a human-readable description of this Object to the given stream.

Note that when overriding this method the return type must be TypedHandle<const String> rather then String::View. These two types are assignment compatible but not equivalent and declaring the override with String::View will not be a compatible override.

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

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

 String::View vs = COH_TO_STRING(vKey << " = " << vValue);

The COH_TO_STRING macro is also the most common way to implement the toString method. For example:

 virtual TypedHandle<const String> Person::toString() const
     {
     return COH_TO_STRING("Name: " << f_sName << " SSN: " << f_nSSN);
     }

Returns:
a string representation of this object


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

virtual void registerImmortal (const Object &o)
 Invoked when an object is deemed to immortal and can never be collected.

Note the specified object will have already been registered via registerObject.


Protected Attributes

NativeAtomic64 m_acObjects [s_cCount]
 Array of object counts.
NativeAtomic64 m_cImmortals
 The immortal object count.

Static Protected Attributes

static const size_t s_cCount
 The size of the array of counters.

Classes

class  Snapshot
 Snapshot containing 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 © 2000, 2019, Oracle and/or its affiliates. All rights reserved.