GEGELATI

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
TPG::PolicyStats Class Reference

`#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.

## Detailed Description

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.

## Member Function Documentation

## ◆ analyzeLine()

void TPG::PolicyStats::analyzeLine | ( | const Program::Line * | line,
|  | bool | actionProgram = false )

Analyze the given Line.

The method updates the following stats:

- Total number of usage of each Instruction.
- Total number of access for each location.

Parameters

  [in] | line | line analized
  [in] | actionProgram | boolean to indicate if the program is an action program or a context program

## ◆ analyzePolicy()

void TPG::PolicyStats::analyzePolicy | ( | const TPG::TPGVertex * | vertex | ) |

Analyze the policy starting from the given TPGVertex.

This method explores the TPGGraph starting from the given TPGVertex, and analyzes all TPGTeam, TPGAction and Program encountered along the way.

The method updates the following stats:

- Depth of the policy.
- Number of TPGTeam per depth level.

## ◆ analyzeProgram()

void TPG::PolicyStats::analyzeProgram | ( | const Program::Program * | prog | ) |

Analyze the given Program.

The method updates the following stats:

- Number of use per Program.
- Number of lines per Program.
- Number of intron lines per Program.

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.

Parameters

  [in] | prog | the analyzed Program.

Exceptions

  std::runtime_error | if the given Program has incorrect lines accessing for example non existing instructions.

## ◆ analyzeTPGAction()

void TPG::PolicyStats::analyzeTPGAction | ( | const TPG::TPGAction * | action | ) |

Analyze the given TPGAction.

The method updates the following stats:

- Number of use per TPGAction.
- Total number of usage per action.

If a TPGAction was already analyzed, it will not be analyzed again and only the number of use per TPGAction will be updated.

## ◆ analyzeTPGTeam()

void TPG::PolicyStats::analyzeTPGTeam | ( | const TPG::TPGTeam * | team | ) |

Analyze the given TPGTeam.

The method updates the following stats:

- Number of use per TPGTeam.
- Number of outgoing TPGEdge per TPGTeam.
- Total number of distinct TPGTeam in the policy.

If a TPGTeam was already analyzed, it will not be analyzed again and only the number of use per TPGTeam will be updated.

## ◆ clear()

void TPG::PolicyStats::clear | ( |  | ) |

Clear all stats stored in the class attributes.

## ◆ setEnvironment()

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.

## Member Data Documentation

## ◆ nbTPGVertexPerDepthLevel

std::map<size_t, size_t> TPG::PolicyStats::nbTPGVertexPerDepthLevel

Each entry of this map represents a level deepth of the policy tree and the number of TPGTeam that "first" appeared within this level.

A TPGTeam may appear several time in a single policy, but only its "lowest" level is counted here.

## ◆ nbUsagePerActionID

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.

## ◆ nbUsagePerDataLocation

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.

## ◆ nbUsagePerDataLocationActionProg

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.

## ◆ nbUsagePerInstruction

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.

## ◆ nbUsagePerInstructionActionProg

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.

## ◆ nbUsePerActionProgram

std::map<const Program::Program*, size_t> TPG::PolicyStats::nbUsePerActionProgram

Number of time a Program was analyzed.

When analyzing a policy, this number corresponds to the number of TPGEdge referencing a Program.

## ◆ nbUsePerProgram

std::map<const Program::Program*, size_t> TPG::PolicyStats::nbUsePerProgram

Number of time a Program was analyzed.

When analyzing a policy, this number corresponds to the number of TPGEdge referencing a Program.

## ◆ nbUsePerTPGAction

std::map<const TPGAction*, size_t> TPG::PolicyStats::nbUsePerTPGAction

Number of time a TPGAction was analyzed.

When analyzing a policy, this number corresponds to the number of times this TPGAction is the destination of a TPGEdge.

## ◆ nbUsePerTPGTeam

std::map<const TPGTeam*, size_t> TPG::PolicyStats::nbUsePerTPGTeam

Number of time a TPGTeam was analyzed.

When analyzing a policy, this number corresponds to the number of times this TPGTeam is the destination of a TPGEdge.

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

- D:/a/gegelati/gegelati/gegelatilib/include/tpg/policyStats.h
- D:/a/gegelati/gegelati/gegelatilib/src/tpg/policyStats.cpp