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
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>
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
The Environment class contains all information needed to execute a Program.
Definition environment.h:86
Definition line.h:49
The Program class contains a list of program lines that can be executed within a well defined Environ...
Definition program.h:57
Definition policyStats.h:68
std::vector< size_t > nbLinesPerProgram
Number of lines of analyzed Program.
Definition policyStats.h:111
std::map< size_t, size_t > nbUsagePerInstruction
Definition policyStats.h:127
std::vector< size_t > nbIntronPerProgram
Number of intron lines of analyzed Program.
Definition policyStats.h:117
size_t nbDistinctTeams
Number of distinct TPGTeams per policy.
Definition policyStats.h:177
std::map< size_t, size_t > nbUsagePerInstructionActionProg
Definition policyStats.h:134
std::map< const Program::Program *, size_t > nbUsePerActionProgram
Number of time a Program was analyzed.
Definition policyStats.h:92
size_t maxPolicyDepth
Depth of the analyzed policy.
Definition policyStats.h:165
void setEnvironment(const Environment &env)
Set Environement used during analyses.
Definition policyStats.cpp:161
std::map< std::pair< size_t, size_t >, size_t > nbUsagePerDataLocation
Definition policyStats.h:143
std::vector< size_t > nbOutgoingEdgesPerTeam
Number of outgoing TPGEdge of per TPGTeam of the TPGGraph.
Definition policyStats.h:156
std::vector< size_t > nbLinesPerActionProgram
Number of lines of analyzed Program.
Definition policyStats.h:114
PolicyStats()=default
Default constructor.
void analyzeTPGAction(const TPG::TPGAction *action)
Definition policyStats.cpp:249
void analyzeProgram(const Program::Program *prog)
Analyze the given Program.
Definition policyStats.cpp:205
std::vector< size_t > nbIntronPerActionProgram
Number of intron lines of analyzed Program.
Definition policyStats.h:120
std::map< std::pair< size_t, size_t >, size_t > nbUsagePerDataLocationActionProg
Definition policyStats.h:153
std::map< const TPGTeam *, size_t > nbUsePerTPGTeam
Number of time a TPGTeam was analyzed.
Definition policyStats.h:100
friend std::ostream & operator<<(std::ostream &os, const PolicyStats &policyStats)
Overload of the stream output operator for the PolicyStats class.
std::map< size_t, size_t > nbTPGVertexPerDepthLevel
Definition policyStats.h:174
std::map< size_t, size_t > nbUsagePerActionID
Definition policyStats.h:162
void analyzeLine(const Program::Line *line, bool actionProgram=false)
Analyze the given Line.
Definition policyStats.cpp:170
void clear()
Definition policyStats.cpp:140
std::map< const TPGAction *, size_t > nbUsePerTPGAction
Number of time a TPGAction was analyzed.
Definition policyStats.h:108
std::map< const Program::Program *, size_t > nbUsePerProgram
Number of time a Program was analyzed.
Definition policyStats.h:84
void analyzeTPGTeam(const TPG::TPGTeam *team)
Definition policyStats.cpp:240
void analyzePolicy(const TPG::TPGVertex *vertex)
Definition policyStats.cpp:255
Class representing an Action of a TPGGraph.
Definition tpgAction.h:55
Definition tpgTeam.h:49
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition executionStats.h:44
std::ostream & operator<<(std::ostream &os, const PolicyStats &policyStats)
Overload of the stream output operator for the PolicyStats class.
Definition policyStats.cpp:290