Resource profiling ptree populator.
This class provides functions to populate boost ptree with resource profiling data.
Example
To populate ptree with resource profiling data.
#include <boost/property_tree/json_parser.hpp>
class ResourceProfilingPtreePopulatorExample :
public Application {
protected:
void onShutdown() override
{
stringstream ss;
boost::property_tree::json_parser::write_json(ss, resourceProfilingDataTree);
string str(ss.str());
string_view strView(str);
while (!strView.empty())
{
size_t backSlashPos = strView.find("\\/");
if (backSlashPos == string_view::npos)
{
cout << strView;
strView = string_view();
continue;
}
cout << strView.substr(0, backSlashPos);
strView = strView.substr(backSlashPos + 1);
}
cout << "\n";
}
};
static ptree kanzi::ResourceProfilingPtreePopulator::populatePropertyTree |
( |
const ResourceProfiler & |
profiler | ) |
|
|
static |
Populates property tree with attributes of all the profiling data stored in profiler.
This function creates a new ptree node for each resource profiling context factory and calls the populatePropertyTree() function to populate that node with profiling data stored in context factory. The name of that ptree node is set to the name of the loading thread to which the resource profiling context factory belongs. Each context factory ptree node is then added as a child to the node named "ThreadContexts" which is in turn added as a child to the root of the resulting ptree.
This function creates a new ptree node named "ResourceProfilingDataSamples". That node is populated with the populatePropertyTree() function called for the profiling data sample factory owned by profiler
. To access the profiling data sample factory use the ResourceProfiler::getResourceProfilingDataSampleFactory() function.
- Parameters
-
profiler | The resource profiler. |
- Returns
- The property tree populated with attributes of all the profiling data stored in profiler.