All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzs_profiling.h File Reference

Performance profiler. More...

Macros

#define KZS_PROFILING_ENABLED
 Enable profiling globally. More...
 
#define kzsProfilingBegin(name_param)
 Starts profiling a specified block or function. More...
 
#define kzsProfilingContinue(name_param)
 Continues profiling a block or function that was ended for some reason, such as flattening a recursion in the tree. More...
 
#define kzsProfilingEnd(name_param)
 Ends profiling of the current block or function. More...
 

Enumerations

enum  KzsProfilingCommandType { KZS_PROFILING_COMMAND_BEGIN, KZS_PROFILING_COMMAND_END, KZS_PROFILING_COMMAND_CONTINUE, KZS_PROFILING_COMMAND_NEXT_SAMPLE }
 Profiling command types. More...
 

Functions

KANZI_API enum
KzsProfilingCommandType 
kzsProfilingCommandGetType (const struct KzsProfilingCommand *command)
 Returns the type of a profiling command. More...
 
KANZI_API kzString kzsProfilingCommandGetName (const struct KzsProfilingCommand *command)
 If the command is a begin or a continue command, returns the name of the block. More...
 
KANZI_API kzU64 kzsProfilingCommandGetTimeDifference (const struct KzsProfilingCommand *begin, const struct KzsProfilingCommand *end)
 Returns the time difference between two profiling commands. More...
 
KANZI_API kzsError kzsProfilingInitialize (void)
 Initializes profiling. More...
 
KANZI_API kzsError kzsProfilingUninitialize (void)
 Uninitializes profiling. More...
 
KANZI_API kzBool kzsProfilingIsInitialized (void)
 Returns whether profiling is initialized. More...
 
KANZI_API void kzsProfilingSetEnabled (kzBool enabled)
 Enables or disables profiling. More...
 
KANZI_API kzBool kzsProfilingIsEnabled (void)
 Returns whether profiling is enabled. More...
 
KANZI_API void kzsProfilingReset (void)
 Resets profiling statistics. More...
 
KANZI_API void kzsProfilingNextSample (void)
 Increases the sample count. More...
 
KANZI_API kzsError kzsProfilingProcessCommandBuffer (void)
 Processes the current profiling command buffer. More...
 
KANZI_API const struct
KzsProfilingTreeNode * 
kzsProfilingTreeGetRoot (void)
 Returns the root node of the profiling tree. More...
 
KANZI_API kzUint kzsProfilingTreeGetSampleCount (void)
 Returns the number of times the full cycle was sampled. More...
 
KANZI_API const struct
KzsProfilingTreeNode * 
kzsProfilingTreeNodeGetParent (const struct KzsProfilingTreeNode *node)
 Returns the parent node of the given profiling node, or KZ_NULL if the node is the root node. More...
 
KANZI_API const struct
KzsProfilingTreeNode * 
kzsProfilingTreeNodeGetFirstChild (const struct KzsProfilingTreeNode *node)
 Returns the first child node of the given profiling node, or KZ_NULL if the node has no children. More...
 
KANZI_API const struct
KzsProfilingTreeNode * 
kzsProfilingTreeNodeGetNextSibling (const struct KzsProfilingTreeNode *node)
 Returns the next sibling node of the given profiling node, or KZ_NULL if the node is the last child. More...
 
KANZI_API kzString kzsProfilingTreeNodeGetName (const struct KzsProfilingTreeNode *node)
 Gets the name of the given profiling node. More...
 
KANZI_API kzUint kzsProfilingTreeNodeGetHitCount (const struct KzsProfilingTreeNode *node)
 Gets the hit count of the given profiling node. More...
 
KANZI_API kzU64 kzsProfilingTreeNodeGetTotalTime (const struct KzsProfilingTreeNode *node)
 Gets the total time of the given profiling node. More...
 
KANZI_API kzU64 kzsProfilingTreeNodeGetTotalSquaredTime (const struct KzsProfilingTreeNode *node)
 Gets the sum of squared times of the given profiling node. More...
 
KANZI_API kzU64 kzsProfilingTreeNodeGetMinimumTime (const struct KzsProfilingTreeNode *node)
 Gets the minimum time spent in the given profiling node. More...
 
KANZI_API kzU64 kzsProfilingTreeNodeGetMaximumTime (const struct KzsProfilingTreeNode *node)
 Gets the maximum time spent in the given profiling node. More...
 
KANZI_API void kzsProfilingBeginMeasure_private (kzString name)
 Private implementation of kzsProfilingBegin. More...
 
KANZI_API void kzsProfilingContinueMeasure_private (kzString name)
 Private implementation of kzsProfilingContinue. More...
 
KANZI_API void kzsProfilingEndMeasure_private (kzString name)
 Private implementation of kzsProfilingEnd. More...
 

Detailed Description

Performance profiler.

Copyright 2008-2020 by Rightware. All rights reserved.

Macro Definition Documentation

#define KZS_PROFILING_ENABLED

Enable profiling globally.

This define controls whether profiling features are 'compiled in' into the code. To actually use profiling, it must still be enabled run-time.

#define kzsProfilingBegin (   name_param)

Starts profiling a specified block or function.

#define kzsProfilingContinue (   name_param)

Continues profiling a block or function that was ended for some reason, such as flattening a recursion in the tree.

Continue differs from begin by not increasing hit count.

#define kzsProfilingEnd (   name_param)

Ends profiling of the current block or function.

Enumeration Type Documentation

Profiling command types.

Enumerator
KZS_PROFILING_COMMAND_BEGIN 

Begin of a block.

KZS_PROFILING_COMMAND_END 

End of a block.

KZS_PROFILING_COMMAND_CONTINUE 

Continuing a block.

KZS_PROFILING_COMMAND_NEXT_SAMPLE 

Next sample starts.

Function Documentation

KANZI_API enum KzsProfilingCommandType kzsProfilingCommandGetType ( const struct KzsProfilingCommand command)

Returns the type of a profiling command.

KANZI_API kzString kzsProfilingCommandGetName ( const struct KzsProfilingCommand command)

If the command is a begin or a continue command, returns the name of the block.

KANZI_API kzU64 kzsProfilingCommandGetTimeDifference ( const struct KzsProfilingCommand begin,
const struct KzsProfilingCommand end 
)

Returns the time difference between two profiling commands.

The returned value is end->time - begin->time. The first parameter must be a begin or a continue command. The second parameter must be an end command.

KANZI_API kzsError kzsProfilingInitialize ( void  )

Initializes profiling.

KANZI_API kzsError kzsProfilingUninitialize ( void  )

Uninitializes profiling.

KANZI_API kzBool kzsProfilingIsInitialized ( void  )

Returns whether profiling is initialized.

KANZI_API void kzsProfilingSetEnabled ( kzBool  enabled)

Enables or disables profiling.

To disable profiling, this function should be called with FALSE parameter value as many times as it was called with TRUE parameter value.

KANZI_API kzBool kzsProfilingIsEnabled ( void  )

Returns whether profiling is enabled.

KANZI_API void kzsProfilingReset ( void  )

Resets profiling statistics.

KANZI_API void kzsProfilingNextSample ( void  )

Increases the sample count.

This makes the profiler calculate averages over the measured samples.

KANZI_API kzsError kzsProfilingProcessCommandBuffer ( void  )

Processes the current profiling command buffer.

Should be called outside of all profiling blocks.

KANZI_API const struct KzsProfilingTreeNode* kzsProfilingTreeGetRoot ( void  )

Returns the root node of the profiling tree.

KANZI_API kzUint kzsProfilingTreeGetSampleCount ( void  )

Returns the number of times the full cycle was sampled.

See also
kzsProfilingNextSample.
KANZI_API const struct KzsProfilingTreeNode* kzsProfilingTreeNodeGetParent ( const struct KzsProfilingTreeNode *  node)

Returns the parent node of the given profiling node, or KZ_NULL if the node is the root node.

KANZI_API const struct KzsProfilingTreeNode* kzsProfilingTreeNodeGetFirstChild ( const struct KzsProfilingTreeNode *  node)

Returns the first child node of the given profiling node, or KZ_NULL if the node has no children.

KANZI_API const struct KzsProfilingTreeNode* kzsProfilingTreeNodeGetNextSibling ( const struct KzsProfilingTreeNode *  node)

Returns the next sibling node of the given profiling node, or KZ_NULL if the node is the last child.

KANZI_API kzString kzsProfilingTreeNodeGetName ( const struct KzsProfilingTreeNode *  node)

Gets the name of the given profiling node.

KANZI_API kzUint kzsProfilingTreeNodeGetHitCount ( const struct KzsProfilingTreeNode *  node)

Gets the hit count of the given profiling node.

KANZI_API kzU64 kzsProfilingTreeNodeGetTotalTime ( const struct KzsProfilingTreeNode *  node)

Gets the total time of the given profiling node.

KANZI_API kzU64 kzsProfilingTreeNodeGetTotalSquaredTime ( const struct KzsProfilingTreeNode *  node)

Gets the sum of squared times of the given profiling node.

KANZI_API kzU64 kzsProfilingTreeNodeGetMinimumTime ( const struct KzsProfilingTreeNode *  node)

Gets the minimum time spent in the given profiling node.

KANZI_API kzU64 kzsProfilingTreeNodeGetMaximumTime ( const struct KzsProfilingTreeNode *  node)

Gets the maximum time spent in the given profiling node.

KANZI_API void kzsProfilingBeginMeasure_private ( kzString  name)

Private implementation of kzsProfilingBegin.

KANZI_API void kzsProfilingContinueMeasure_private ( kzString  name)

Private implementation of kzsProfilingContinue.

KANZI_API void kzsProfilingEndMeasure_private ( kzString  name)

Private implementation of kzsProfilingEnd.