The Sparta Modeling Framework
|
#include <iostream>
#include <functional>
#include <map>
#include <string>
#include "sparta/statistics/Histogram.hpp"
#include "sparta/statistics/CycleHistogram.hpp"
#include "sparta/utils/MetaStructs.hpp"
Go to the source code of this file.
Classes | |
class | sparta::FunctionManager |
Singleton Function Manager class. This class contains two maps and one constant string token. These maps contain a string as key and function pointers as value. The string key is the same as the name of the free functions as defined by the users and the keys are the function pointers to those methods. One map is dedicated for HistogramTreeNodes while the other is dedicated for CycleHistogramTreeNodes. This was necessary because these two classes do not share a common polymorphic base. More... | |
Namespaces | |
namespace | sparta |
Macros for handling exponential backoff. | |
Macros | |
#define | REGISTER_HISTOGRAM_STAT_CALC_FCN(histogram_type, fcn_name) |
Function Registration Macro for Histogram/CycleHistogram. This macro is called by the users in their code when they are trying to register a free function for stat collection. This macro takes two parameters, the name of the method they are trying to register and the type of argument this method takes whether it is a HistogramTreeNode or a CycleHistogramTreeNode. | |
Typedefs | |
template<typename T > | |
using | sparta::HistStatCalcFcn = double(*)(const T *) |
This file contains a Singleton Function Manager which stores function names and function pointers as key-value pair in maps. There are two separate maps for histogram and cyclehistogram nodes. This file also contains the macro that users will need in order to register statistic calculation functions.
the following is an example usage. Step 1 - The user writes their free function.
Step 2 - The user registers this method with the registration macro.
. Step 3 - User should know the exact fullpath of the histogram they are using in the device tree. Step 4 - If the fullpath of a certain histogram is top.core0.hist_node, then to get their free function as a statdef in reports, they should use the hist_def keyword and make it a prefix in the path string. For example, their yaml could look like this : content: top: hist_def.core0.hist_node.get_bin_count_greater_than_3_Stdev : my_stat top.core0: hist_def.hist_node.get_bin_count_less_than_mean : my_stat2 top.core0.hist_node: hist_def.get_bin_count_greater_than_mean : my_stat3 Using the hist_def keyword is essential as this tells the yaml parser to go and look in the Histogram Function Manager class for the string name.
Definition in file HistogramFunctionManager.hpp.
#define REGISTER_HISTOGRAM_STAT_CALC_FCN | ( | histogram_type, | |
fcn_name | |||
) |
Function Registration Macro for Histogram/CycleHistogram. This macro is called by the users in their code when they are trying to register a free function for stat collection. This macro takes two parameters, the name of the method they are trying to register and the type of argument this method takes whether it is a HistogramTreeNode or a CycleHistogramTreeNode.
Example : Calculate three times the standard deviation of all counts in regular and over/under flow bins. double stdev_x3(const sparta::CycleHistogramTreeNode* h) { return (h->getStandardDeviation()) * 3; }
REGISTER_HISTOGRAM_STAT_CALC_FCN(CycleHistogramTreeNode, stdev_x3);
Definition at line 254 of file HistogramFunctionManager.hpp.