Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

OW32::CPerfObject Class Reference

Represents a performance object. More...

#include <PerfData.h>

List of all members.

Public Member Functions

 CPerfObject (CPerfData *perfData, CPerfData::ObjectId objectId, LPCWSTR name, LPCWSTR help, DWORD detailLevel, CPerfData::CounterId defaultCounterId, DWORD maxInstances, DWORD maxInstanceName)
 Constructs a new performance object.
DWORD addCounter (CPerfCounter *counter)
 Add a new counter to this object; should only be called during construction.
void setNext (CPerfObject *next)
 Set the next object in the chain; should only be called during construction.
void setTitleInfo (DWORD titleIndex, DWORD helpTitleIndex)
 Set the title/help indexes for this object.
void setPerfInstanceInfo (BYTE *firstInstance, DWORD instanceSize)
 Set the offset of the object's instances in the shared memory section.
void setPerfType (PERF_OBJECT_TYPE *type)
 Set the initial structure for this object.
bool getFreeInstance (PERF_INSTANCE_DEFINITION **instance, CPerfData::InstanceId *instanceId)
 Find a free instance for this object.
DWORD getPerfInstanceIndex (CPerfData::InstanceId instanceId)
 Get the index of the given instance in the output data.
BYTE * getCounter (CPerfData::InstanceId instanceId, CPerfData::CounterId counterId)
 Get the address of a counter value.
void removeInstance (CPerfData::InstanceId instanceId)
 Remove the instance with the given id (clears the in-use flag).
CPerfCountergetCounterById (CPerfData::CounterId counterId)
 Get a counter by ID.
CPerfObjectgetNext () const
 Return the next performance object in the chain.
CPerfCountergetFirstCounter () const
 Return the first counter for this object.
CPerfData::ObjectId getId () const
 Return the id of this object.
LPCWSTR getName () const
 Return the name of this object.
LPCWSTR getHelp () const
 Return the help string for this object.
DWORD getDetailLevel () const
 Return the detail level (as used by perfmon) for this object.
CPerfData::CounterId getDefaultCounterId () const
 Return the default counter for this object.
DWORD getMaxInstances () const
 Get the maximum number of instances for this object.
bool singleInstance () const
 See if the object supports instances.
DWORD getMaxInstanceName () const
 Get the maximum number of characters in an instance name, including the terminating NULL.
DWORD getTitleIndex () const
 Return the title index for this object.
DWORD getHelpTitleIndex () const
 Return the help title index for this object.
DWORD collect (CPerfData *perfData, LPVOID *pBuffer, LPDWORD pBytes)
 Collect performance data for this object.
void setCollect (bool fCollect)
 Set the collect flag.
bool getCollect () const
 Get the collect flag.
void checkChildDependencies (CPerfData *perfData)
 See if the object has any instances that refer to parents: if so, set the collect flag on these objects also.
DWORD getCountersWithData () const
 Get the number of counters with data for this object This is used to compute how much space to allocate for the counter data.


Detailed Description

Represents a performance object.


Constructor & Destructor Documentation

OW32::CPerfObject::CPerfObject CPerfData perfData,
CPerfData::ObjectId  objectId,
LPCWSTR  name,
LPCWSTR  help,
DWORD  detailLevel,
CPerfData::CounterId  defaultCounterId,
DWORD  maxInstances,
DWORD  maxInstanceName
 

Constructs a new performance object.

Parameters:
perfData The perf data class that owns this object
objectId The object's id
name The object's name
help The object's help string
detailLevel The detail level to show the object at (e.g. PERF_DETAIL_NOVICE)
defaultCounterId The id of the default counter to show in perfmon's picker dialogue
maxInstances The maximum number of instances for this object
maxInstanceName The maximum length of instance name, including the NULL, for this object


Member Function Documentation

void OW32::CPerfObject::checkChildDependencies CPerfData perfData  ) 
 

See if the object has any instances that refer to parents: if so, set the collect flag on these objects also.

Parameters:
perfData The owner CPerfData class

DWORD OW32::CPerfObject::collect CPerfData perfData,
LPVOID *  pBuffer,
LPDWORD  pBytes
 

Collect performance data for this object.

Parameters:
perfData The owner CPerfData class
pBuffer The output buffer. Points just past the end of the output data if successful.
pBytes The number of bytes output.
Returns:
ERROR_SUCCESS or ERROR_MORE_DATA

BYTE* OW32::CPerfObject::getCounter CPerfData::InstanceId  instanceId,
CPerfData::CounterId  counterId
 

Get the address of a counter value.

Parameters:
instanceId The instance to use, should be NULL if the object does not support instances
counterId The counter id to return storage for
Returns:
Pointer to the counter storage data. Throws CPerfDataException on validation errors.

bool OW32::CPerfObject::getFreeInstance PERF_INSTANCE_DEFINITION **  instance,
CPerfData::InstanceId instanceId
 

Find a free instance for this object.

Parameters:
instance The output pointer to the instance data
instanceId The output instance id
Returns:
true on success, false if no free instances

DWORD OW32::CPerfObject::getMaxInstances  )  const [inline]
 

Get the maximum number of instances for this object.

If the object does not support instances, then the return is PERF_NO_INSTANCES

void OW32::CPerfObject::setPerfInstanceInfo BYTE *  firstInstance,
DWORD  instanceSize
 

Set the offset of the object's instances in the shared memory section.

Parameters:
firstInstance The byte offset of the first instance
instanceSize The size of an instance

void OW32::CPerfObject::setPerfType PERF_OBJECT_TYPE *  type  ) 
 

Set the initial structure for this object.

Parameters:
type The PERF_OBJECT_TYPE structure describing this object.


The documentation for this class was generated from the following file:
Generated on Sun Jun 5 01:29:26 2005 for OW32 by  doxygen 1.3.9.1