|
GEGELATI
|
#include <policyStats.h>
Public Member Functions | |
| PolicyStats ()=default | |
| Default constructor. | |
| void | clear () |
| void | setEnvironment (const Environment &env) |
| Set Environement used during analyses. | |
| void | analyzeLine (const Program::Line *line, bool actionProgram=false) |
| Analyze the given Line. | |
| void | analyzeProgram (const Program::Program *prog) |
| Analyze the given Program. | |
| void | analyzeTPGTeam (const TPG::TPGTeam *team) |
| void | analyzeTPGAction (const TPG::TPGAction *action) |
| void | analyzePolicy (const TPG::TPGVertex *vertex) |
Public Attributes | |
| std::map< const Program::Program *, size_t > | nbUsePerProgram |
| Number of time a Program was analyzed. | |
| std::map< const Program::Program *, size_t > | nbUsePerActionProgram |
| Number of time a Program was analyzed. | |
| std::map< const TPGTeam *, size_t > | nbUsePerTPGTeam |
| Number of time a TPGTeam was analyzed. | |
| std::map< const TPGAction *, size_t > | nbUsePerTPGAction |
| Number of time a TPGAction was analyzed. | |
| std::vector< size_t > | nbLinesPerProgram |
| Number of lines of analyzed Program. | |
| std::vector< size_t > | nbLinesPerActionProgram |
| Number of lines of analyzed Program. | |
| std::vector< size_t > | nbIntronPerProgram |
| Number of intron lines of analyzed Program. | |
| std::vector< size_t > | nbIntronPerActionProgram |
| Number of intron lines of analyzed Program. | |
| std::map< size_t, size_t > | nbUsagePerInstruction |
| std::map< size_t, size_t > | nbUsagePerInstructionActionProg |
| std::map< std::pair< size_t, size_t >, size_t > | nbUsagePerDataLocation |
| std::map< std::pair< size_t, size_t >, size_t > | nbUsagePerDataLocationActionProg |
| std::vector< size_t > | nbOutgoingEdgesPerTeam |
| Number of outgoing TPGEdge of per TPGTeam of the TPGGraph. | |
| std::map< size_t, size_t > | nbUsagePerActionID |
| size_t | maxPolicyDepth = 0 |
| Depth of the analyzed policy. | |
| std::map< size_t, size_t > | nbTPGVertexPerDepthLevel |
| size_t | nbDistinctTeams = 0 |
| Number of distinct TPGTeams per policy. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const PolicyStats &policyStats) |
| Overload of the stream output operator for the PolicyStats class. | |
Utility class for extracting statistics from a policy within a TPGGraph.
The entry point for using this class is the analyzePolicy() method which updates all attribute for a "tree" starting from a given root TPGVertex.
To analyze different policies with a single PolicyStats instance, the clear() method should be called between calls to analyzePolicy().
For access simplicity, all attributes filled during the analysis are public. Tampering with them will just make the result of the analysis useless.
| void TPG::PolicyStats::analyzeLine | ( | const Program::Line * | line, |
| bool | actionProgram = false ) |
Analyze the given Line.
The method updates the following stats:
| [in] | line | line analized |
| [in] | actionProgram | boolean to indicate if the program is an action program or a context program |
| void TPG::PolicyStats::analyzePolicy | ( | const TPG::TPGVertex * | vertex | ) |
| void TPG::PolicyStats::analyzeProgram | ( | const Program::Program * | prog | ) |
Analyze the given Program.
The method updates the following stats:
For each non-intron line, the analyzeLine() method will be called.
If a Program was already analyzed, it will not be analyzed again and only the number of use per program will be updated.
| [in] | prog | the analyzed Program. |
| std::runtime_error | if the given Program has incorrect lines accessing for example non existing instructions. |
| void TPG::PolicyStats::analyzeTPGAction | ( | const TPG::TPGAction * | action | ) |
| void TPG::PolicyStats::analyzeTPGTeam | ( | const TPG::TPGTeam * | team | ) |
Analyze the given TPGTeam.
The method updates the following stats:
If a TPGTeam was already analyzed, it will not be analyzed again and only the number of use per TPGTeam will be updated.
| void TPG::PolicyStats::clear | ( | ) |
Clear all stats stored in the class attributes.
| void TPG::PolicyStats::setEnvironment | ( | const Environment & | env | ) |
Set Environement used during analyses.
From the given Environment, this method sets class attributes used during the analyses of the Program and Line of the policy. If the given Environment does not correspond to the one known to the Program exceptions may be thrown during analyses.
| std::map<size_t, size_t> TPG::PolicyStats::nbTPGVertexPerDepthLevel |
| std::map<size_t, size_t> TPG::PolicyStats::nbUsagePerActionID |
Each entry of this map associates an action ID to the number of time it was present in the analyzed policy.
| std::map<std::pair<size_t, size_t>, size_t> TPG::PolicyStats::nbUsagePerDataLocation |
Each entry of this map associates a data location with the total number of times it was accessed by non-intron lines of analyzed Programs. Each data location is itself represented with a pair consisting of the data source index, and the location within this data source.
| std::map<std::pair<size_t, size_t>, size_t> TPG::PolicyStats::nbUsagePerDataLocationActionProg |
Each entry of this map associates a data location with the total number of times it was accessed by non-intron lines of analyzed Programs. Each data location is itself represented with a pair consisting of the data source index, and the location within this data source.
| std::map<size_t, size_t> TPG::PolicyStats::nbUsagePerInstruction |
Each entry of this map associates an Instruction identifier from an instruction set with the total number of times it was used in analyzed Programs.
| std::map<size_t, size_t> TPG::PolicyStats::nbUsagePerInstructionActionProg |
Each entry of this map associates an Instruction identifier from an instruction set with the total number of times it was used in analyzed Programs.
| std::map<const Program::Program*, size_t> TPG::PolicyStats::nbUsePerActionProgram |
| std::map<const Program::Program*, size_t> TPG::PolicyStats::nbUsePerProgram |
| std::map<const TPGAction*, size_t> TPG::PolicyStats::nbUsePerTPGAction |
| std::map<const TPGTeam*, size_t> TPG::PolicyStats::nbUsePerTPGTeam |