Code-profiler. Please check the example in the Duckcpp examples folder about how to use it.
More...
#include <duckcpp/core/engine/IProfiler.hpp>
|
| IProfiler () |
| Constructor. You could use this to create a new profiler, but usually getProfiler() is used to access the global instance.
|
|
void | add (dcpp::int32_kt id, const dcpp::nub::wstring &name, const dcpp::nub::wstring &groupName) |
| Add an id with given name and group which can be used for profiling with start/stop.
|
|
dcpp::int32_kt | add (const dcpp::nub::wstring &name, const dcpp::nub::wstring &groupName) |
| Add an automatically generated for the given name and group which can be used for profiling with start/stop.
|
|
dcpp::uint32_kt | getProfileDataCount () const |
| Return the number of profile data blocks. There is one for each id.
|
|
bool | findDataIndex (dcpp::uint32_kt &result, const dcpp::nub::wstring &name) const |
| Search for the index of the profile data by name.
|
|
const SProfileData & | getProfileDataByIndex (dcpp::uint32_kt index) const |
| Get the profile data.
|
|
const SProfileData * | getProfileDataById (dcpp::uint32_kt id) |
| Get the profile data.
|
|
dcpp::uint32_kt | getGroupCount () const |
| Get the number of profile groups. Will be at least 1.
|
|
const SProfileData & | getGroupData (dcpp::uint32_kt index) const |
| Get profile data for a group.
|
|
bool | findGroupIndex (dcpp::uint32_kt &result, const dcpp::nub::wstring &name) const |
| Find the group index by the group-name.
|
|
void | start (dcpp::int32_kt id) |
| Start profile-timing for the given id.
|
|
void | stop (dcpp::int32_kt id) |
| Stop profile-timing for the given id.
|
|
void | resetDataById (dcpp::int32_kt id) |
| Reset profile data for the given id.
|
|
void | resetDataByIndex (dcpp::uint32_kt index) |
| Reset profile data for the given index.
|
|
void | resetGroup (dcpp::uint32_kt index) |
| Reset profile data for a whole group.
|
|
void | resetAll () |
| Reset all profile data.
|
|
virtual void | printAll (dcpp::nub::wstring &result, bool includeOverview=false, bool suppressUncalled=true) const =0 |
| Write all profile-data into a string.
|
|
virtual void | printGroup (dcpp::nub::wstring &result, dcpp::uint32_kt groupIndex, bool suppressUncalled) const =0 |
| Write the profile data of one group into a string.
|
|
Code-profiler. Please check the example in the Duckcpp examples folder about how to use it.
◆ add() [1/2]
Add an automatically generated for the given name and group which can be used for profiling with start/stop.
After calling this once you can start/stop profiling with the returned id.
- Parameters
-
name | Name for displaying profile data. |
groupName | Each id belongs into a group - this helps on displaying profile data. |
- Returns
- Automatic id's start at INT_MAX and count down for each new id. If the name already has an id then that id will be returned.
◆ add() [2/2]
Add an id with given name and group which can be used for profiling with start/stop.
After calling this once you can start/stop profiling for the given id.
- Parameters
-
id | Should be >= 0 as negative id's are reserved for Duckcpp. Also very large numbers (near INT_MAX) might have been added automatically by the other add function. |
name | Name for displaying profile data. |
groupName | Each id belongs into a group - this helps on displaying profile data. |
◆ findDataIndex()
Search for the index of the profile data by name.
- Parameters
-
result | Receives the resulting data index when one was found. |
name | String with name to search for |
- Returns
- true when found, false when not found
◆ findGroupIndex()
Find the group index by the group-name.
- Parameters
-
result | Receives the resulting group index when one was found. |
name | String with name to search for |
- Returns
- true when found, false when not found
◆ getGroupCount()
Get the number of profile groups. Will be at least 1.
NOTE: The first groups is always L"overview" which is an overview for all existing groups
◆ getGroupData()
Get profile data for a group.
NOTE: The first groups is always L"overview" which is an overview for all existing groups
◆ getProfileDataById()
Get the profile data.
- Parameters
-
id | Same value as used in add |
- Returns
- Profile data for the given id or 0 when it does not exist.
◆ getProfileDataByIndex()
Get the profile data.
- Parameters
-
◆ printAll()
virtual void dcpp::IProfiler::printAll |
( |
dcpp::nub::wstring & |
result, |
|
|
bool |
includeOverview = false , |
|
|
bool |
suppressUncalled = true |
|
) |
| const |
|
pure virtual |
Write all profile-data into a string.
- Parameters
-
result | Receives the result string. |
includeOverview | When true a group-overview is attached first |
suppressUncalled | When true elements which got never called are not printed |
◆ printGroup()
Write the profile data of one group into a string.
- Parameters
-
result | Receives the result string. |
groupIndex_ |
|
◆ resetAll()
void dcpp::IProfiler::resetAll |
( |
| ) |
|
|
inline |
Reset all profile data.
NOTE: This is not deleting id's or groups, just resetting all timers to 0.
◆ start()
Start profile-timing for the given id.
This increases an internal run-counter for the given id. It will profile as long as that counter is > 0. NOTE: you have to add the id first with one of the add functions
◆ stop()
Stop profile-timing for the given id.
This increases an internal run-counter for the given id. If it reaches 0 the time since start is recorded. You should have the same amount of start and stop calls. If stop is called more often than start then the additional stop calls will be ignored (counter never goes below 0)
The documentation for this class was generated from the following file: