Phosphor
phosphor::CategoryRegistry Class Reference

#include <category_registry.h>

Public Member Functions

 CategoryRegistry ()
 
const AtomicCategoryStatus & getStatus (const char *category_group)
 
void updateEnabled (const std::vector< std::string > &enabled, const std::vector< std::string > &disabled)
 
void disableAll ()
 
void getStats (StatsCallback &addStats) const
 

Static Public Member Functions

static CategoryStatus calculateEnabled (const std::string &category_group, const std::vector< std::string > &enabled, const std::vector< std::string > &disabled)
 

Static Public Attributes

static constexpr int registry_size = 250
 

Protected Member Functions

CategoryStatus calculateEnabled (size_t index)
 

Protected Attributes

std::mutex mutex
 
std::array< std::string, registry_sizegroups
 
std::array< AtomicCategoryStatus, registry_sizegroup_statuses
 
std::atomic< size_t > group_count
 
std::vector< std::string > enabled_categories
 
std::vector< std::string > disabled_categories
 

Static Protected Attributes

static constexpr int index_category_limit = 1
 
static constexpr int index_metadata = 2
 
static constexpr int index_non_default_categories = 3
 

Detailed Description

CategoryRegistry encapsulates the logic for enabling/disabling of various tracing categories

Constructor & Destructor Documentation

phosphor::CategoryRegistry::CategoryRegistry ( )

Default constructor

Member Function Documentation

CategoryStatus phosphor::CategoryRegistry::calculateEnabled ( const std::string &  category_group,
const std::vector< std::string > &  enabled,
const std::vector< std::string > &  disabled 
)
static

Calculates whether or not a given category group string be enabled based on the supplied categories.

Parameters
category_groupThe category_group to get the status of
enabledThe enabled groups
disabledThe disabled groups
Returns
The calculated status of the group based on the currently enabled/disabled categories.
CategoryStatus phosphor::CategoryRegistry::calculateEnabled ( size_t  index)
protected

Calculates whether or not a given group index should be enabled based on the currently enabled categories.

Parameters
indexThe index of the group to calculate
Returns
The calculated status of the group based on the currently enabled/disabled categories.
void phosphor::CategoryRegistry::disableAll ( )

Disables all category groups

Equivalent to:

CategoryRegistry::updateEnabled({{}}, {{}});

Except a bit more efficient as it doesn't bother with calculations

void phosphor::CategoryRegistry::getStats ( StatsCallback addStats) const

Invokes methods on the callback to supply various stats about the category registry.

const AtomicCategoryStatus & phosphor::CategoryRegistry::getStatus ( const char *  category_group)

Used to get a reference to a reusable CategoryStatus. This should generally be held in a block-scope static at a given trace point to verify if the category for that trace point is presently enabled.

Parameters
category_groupThe category group to check
Returns
const reference to the CategoryStatus atomic that holds that status for the given category group
void phosphor::CategoryRegistry::updateEnabled ( const std::vector< std::string > &  enabled,
const std::vector< std::string > &  disabled 
)

Enable a list of categories for tracing (and disable all others)

Parameters
enabledVector of categories to mark as enabled
disabledVector of categories to mark as disabled

Member Data Documentation

constexpr int phosphor::CategoryRegistry::registry_size = 250
static

Number of unique category permutations that a registry supports


The documentation for this class was generated from the following files: