GEGELATI

Loading...
Searching...
No Matches
policyStats.h
1
37#ifndef POLICY_STATS_H
38#define POLICY_STATS_H
39
40#include <iostream>
41#include <map>
42#include <vector>
43
44#include "instructions/instruction.h"
45
46#include "program/program.h"
47
48#include "tpg/tpgAction.h"
49#include "tpg/tpgGraph.h"
50#include "tpg/tpgTeam.h"
51
52namespace TPG {
53
67 class PolicyStats
68 {
69 private:
71 const Environment* environment = nullptr;
72
74 std::vector<std::reference_wrapper<const Data::DataHandler>>
75 dataSourcesAndRegisters;
76
77 public:
84 std::map<const Program::Program*, size_t> nbUsePerProgram;
85
92 std::map<const Program::Program*, size_t> nbUsePerActionProgram;
93
100 std::map<const TPGTeam*, size_t> nbUsePerTPGTeam;
101
108 std::map<const TPGAction*, size_t> nbUsePerTPGAction;
109
111 std::vector<size_t> nbLinesPerProgram;
112
114 std::vector<size_t> nbLinesPerActionProgram;
115
117 std::vector<size_t> nbIntronPerProgram;
118
120 std::vector<size_t> nbIntronPerActionProgram;
121
127 std::map<size_t, size_t> nbUsagePerInstruction;
128
134 std::map<size_t, size_t> nbUsagePerInstructionActionProg;
135
143 std::map<std::pair<size_t, size_t>, size_t> nbUsagePerDataLocation;
144
152 std::map<std::pair<size_t, size_t>, size_t>
153 nbUsagePerDataLocationActionProg;
154
156 std::vector<size_t> nbOutgoingEdgesPerTeam;
157
162 std::map<size_t, size_t> nbUsagePerActionID;
163
165 size_t maxPolicyDepth = 0;
166
174 std::map<size_t, size_t> nbTPGVertexPerDepthLevel;
175
177 size_t nbDistinctTeams = 0;
178
180 PolicyStats() = default;
181
185 void clear();
186
195 void setEnvironment(const Environment& env);
196
208 void analyzeLine(const Program::Line* line, bool actionProgram = false);
209
227 void analyzeProgram(const Program::Program* prog);
228
240 void analyzeTPGTeam(const TPG::TPGTeam* team);
241
252 void analyzeTPGAction(const TPG::TPGAction* action);
253
265 void analyzePolicy(const TPG::TPGVertex* vertex);
266
267 friend std::ostream& operator<<(std::ostream& os,
268 const PolicyStats& policyStats);
269 };
270
272 std::ostream& operator<<(std::ostream& os, const PolicyStats& policyStats);
273} // namespace TPG
274
275#endif
Environment
The Environment class contains all information needed to execute a Program.
Definition environment.h:86
Program::Line
Definition line.h:49
Program::Program
The Program class contains a list of program lines that can be executed within a well defined Environ...
Definition program.h:57
TPG::PolicyStats
Definition policyStats.h:68
TPG::PolicyStats::nbLinesPerProgram
std::vector< size_t > nbLinesPerProgram
Number of lines of analyzed Program.
Definition policyStats.h:111
TPG::PolicyStats::nbUsagePerInstruction
std::map< size_t, size_t > nbUsagePerInstruction
Definition policyStats.h:127
TPG::PolicyStats::nbIntronPerProgram
std::vector< size_t > nbIntronPerProgram
Number of intron lines of analyzed Program.
Definition policyStats.h:117
TPG::PolicyStats::nbDistinctTeams
size_t nbDistinctTeams
Number of distinct TPGTeams per policy.
Definition policyStats.h:177
TPG::PolicyStats::nbUsagePerInstructionActionProg
std::map< size_t, size_t > nbUsagePerInstructionActionProg
Definition policyStats.h:134
TPG::PolicyStats::nbUsePerActionProgram
std::map< const Program::Program *, size_t > nbUsePerActionProgram
Number of time a Program was analyzed.
Definition policyStats.h:92
TPG::PolicyStats::maxPolicyDepth
size_t maxPolicyDepth
Depth of the analyzed policy.
Definition policyStats.h:165
TPG::PolicyStats::setEnvironment
void setEnvironment(const Environment &env)
Set Environement used during analyses.
Definition policyStats.cpp:161
TPG::PolicyStats::nbUsagePerDataLocation
std::map< std::pair< size_t, size_t >, size_t > nbUsagePerDataLocation
Definition policyStats.h:143
TPG::PolicyStats::nbOutgoingEdgesPerTeam
std::vector< size_t > nbOutgoingEdgesPerTeam
Number of outgoing TPGEdge of per TPGTeam of the TPGGraph.
Definition policyStats.h:156
TPG::PolicyStats::nbLinesPerActionProgram
std::vector< size_t > nbLinesPerActionProgram
Number of lines of analyzed Program.
Definition policyStats.h:114
TPG::PolicyStats::PolicyStats
PolicyStats()=default
Default constructor.
TPG::PolicyStats::analyzeTPGAction
void analyzeTPGAction(const TPG::TPGAction *action)
Definition policyStats.cpp:249
TPG::PolicyStats::analyzeProgram
void analyzeProgram(const Program::Program *prog)
Analyze the given Program.
Definition policyStats.cpp:205
TPG::PolicyStats::nbIntronPerActionProgram
std::vector< size_t > nbIntronPerActionProgram
Number of intron lines of analyzed Program.
Definition policyStats.h:120
TPG::PolicyStats::nbUsagePerDataLocationActionProg
std::map< std::pair< size_t, size_t >, size_t > nbUsagePerDataLocationActionProg
Definition policyStats.h:153
TPG::PolicyStats::nbUsePerTPGTeam
std::map< const TPGTeam *, size_t > nbUsePerTPGTeam
Number of time a TPGTeam was analyzed.
Definition policyStats.h:100
TPG::PolicyStats::operator<<
friend std::ostream & operator<<(std::ostream &os, const PolicyStats &policyStats)
Overload of the stream output operator for the PolicyStats class.
TPG::PolicyStats::nbTPGVertexPerDepthLevel
std::map< size_t, size_t > nbTPGVertexPerDepthLevel
Definition policyStats.h:174
TPG::PolicyStats::nbUsagePerActionID
std::map< size_t, size_t > nbUsagePerActionID
Definition policyStats.h:162
TPG::PolicyStats::analyzeLine
void analyzeLine(const Program::Line *line, bool actionProgram=false)
Analyze the given Line.
Definition policyStats.cpp:170
TPG::PolicyStats::clear
void clear()
Definition policyStats.cpp:140
TPG::PolicyStats::nbUsePerTPGAction
std::map< const TPGAction *, size_t > nbUsePerTPGAction
Number of time a TPGAction was analyzed.
Definition policyStats.h:108
TPG::PolicyStats::nbUsePerProgram
std::map< const Program::Program *, size_t > nbUsePerProgram
Number of time a Program was analyzed.
Definition policyStats.h:84
TPG::PolicyStats::analyzeTPGTeam
void analyzeTPGTeam(const TPG::TPGTeam *team)
Definition policyStats.cpp:240
TPG::PolicyStats::analyzePolicy
void analyzePolicy(const TPG::TPGVertex *vertex)
Definition policyStats.cpp:255
TPG::TPGAction
Class representing an Action of a TPGGraph.
Definition tpgAction.h:55
TPG::TPGTeam
Definition tpgTeam.h:49
TPG::TPGVertex
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
TPG
Definition executionStats.h:44
TPG::operator<<
std::ostream & operator<<(std::ostream &os, const PolicyStats &policyStats)
Overload of the stream output operator for the PolicyStats class.
Definition policyStats.cpp:290