Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator 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

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

Detailed Description

Performance profiler.

Copyright 2008-2019 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

enum KzsProfilingCommandType kzsProfilingCommandGetType ( const struct KzsProfilingCommand command)

Returns the type of a profiling command.

kzString kzsProfilingCommandGetName ( const struct KzsProfilingCommand command)

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

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.

kzsError kzsProfilingInitialize ( void  )

Initializes profiling.

kzsError kzsProfilingUninitialize ( void  )

Uninitializes profiling.

kzBool kzsProfilingIsInitialized ( void  )

Returns whether profiling is initialized.

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.

kzBool kzsProfilingIsEnabled ( void  )

Returns whether profiling is enabled.

void kzsProfilingReset ( void  )

Resets profiling statistics.

void kzsProfilingNextSample ( void  )

Increases the sample count.

This makes the profiler calculate averages over the measured samples.

kzsError kzsProfilingProcessCommandBuffer ( void  )

Processes the current profiling command buffer.

Should be called outside of all profiling blocks.

struct KzsProfilingTreeNode* kzsProfilingTreeGetRoot ( void  )

Returns the root node of the profiling tree.

kzUint kzsProfilingTreeGetSampleCount ( void  )

Returns the number of times the full cycle was sampled.

See Also
kzsProfilingNextSample.
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.

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.

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.

kzString kzsProfilingTreeNodeGetName ( const struct KzsProfilingTreeNode *  node)

Gets the name of the given profiling node.

kzUint kzsProfilingTreeNodeGetHitCount ( const struct KzsProfilingTreeNode *  node)

Gets the hit count of the given profiling node.

kzU64 kzsProfilingTreeNodeGetTotalTime ( const struct KzsProfilingTreeNode *  node)

Gets the total time of the given profiling node.

kzU64 kzsProfilingTreeNodeGetTotalSquaredTime ( const struct KzsProfilingTreeNode *  node)

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

kzU64 kzsProfilingTreeNodeGetMinimumTime ( const struct KzsProfilingTreeNode *  node)

Gets the minimum time spent in the given profiling node.

kzU64 kzsProfilingTreeNodeGetMaximumTime ( const struct KzsProfilingTreeNode *  node)

Gets the maximum time spent in the given profiling node.

void kzsProfilingBeginMeasure_private ( kzString  name)

Private implementation of kzsProfilingBegin.

void kzsProfilingContinueMeasure_private ( kzString  name)

Private implementation of kzsProfilingContinue.

void kzsProfilingEndMeasure_private ( kzString  name)

Private implementation of kzsProfilingEnd.