79 switch(relationship_type)
86 "Host profiilng required but algorithm has not been selected");
103 return relationships;
117 const int debug_level = parameters->get_class_debug_level(
"HostProfiling");
121 for(
const auto f : AppM->get_functions_with_body())
128 "-->Function: " + FB->CGetBehavioralHelper()->get_function_name());
131 const std::list<LoopConstRef>& loops = FB->CGetLoops()->GetList();
132 std::list<LoopConstRef>::const_iterator loop, loop_end = loops.end();
133 for(loop = loops.begin(); loop != loop_end; ++loop)
135 unsigned int loop_id = (*loop)->GetId();
141 long double avg_number = 0.0L;
142 long double abs_execution = 0.0L;
144 if(path_profiling.find(loop_id) == path_profiling.end())
149 const auto& elements = path_profiling.find(loop_id)->second;
150 for(
const auto& element : elements)
152 abs_execution += element.second;
154 if(abs_execution != 0.0
L)
156 if(loop_instances.find(f) == loop_instances.end())
159 "Function " + FB->CGetBehavioralHelper()->get_function_name() +
" exited abnormally");
161 THROW_ASSERT(loop_instances.at(f).find(loop_id) != loop_instances.at(f).end(),
162 "Loop " + std::to_string(f) +
" is no executed");
164 "Loop " + std::to_string(loop_id) +
" of function " + std::to_string(f) +
165 " is executed but does not exist an external path with its header");
166 avg_number = abs_execution / loop_instances.at(f).at(loop_id);
169 "-->Avg. Number Executions: " + std::to_string(avg_number));
170 FB->profiling_information->avg_iterations[(*loop)->GetId()] = avg_number;
171 FB->profiling_information->abs_iterations[(*loop)->GetId()] =
172 static_cast<unsigned long long int>(llroundl(abs_execution));
174 for(
auto&
k : path_profiling.at(loop_id))
178 k.second /= abs_execution;
185 if(parameters->getOption<
bool>(OPT_print_dot))
187 FB->CGetLoops()->WriteDot(
"LF.dot", FB->CGetProfilingInformation());
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
File containing functions and utilities to support the printing of debug messagges.
#define DEBUG_LEVEL_PEDANTIC
very verbose debugging print is performed.
#define GET_CLASS(obj)
Macro returning the actual type of an object.
Definition of the class representing a generic C application.
RelationshipType
The relationship type.
Source must be executed to satisfy target.
Class specification of the graph structures.
HostProfiling(const application_managerRef AppM, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters)
Constructor.
redefinition of map to manage ordered/unordered structures
Auxiliary methods for manipulating string.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
absl::flat_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMap
HostProfiling_Method
Different profiling method.
static const uint32_t k[]
Abstract class for passes performing a dynamic profiling of loops, paths or both by means of predepen...
Target must be reexecuted.
HostProfiling_Method operator &(const HostProfiling_Method first, const HostProfiling_Method second)
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > ComputeFrontendRelationships(const DesignFlowStep::RelationshipType relationship_type) const override
Return the set of analyses in relationship with this design step.
const ParameterConstRef parameters
Set of input parameters.
DesignFlowStep_Status
The status of a step.
#define DEBUG_LEVEL_NONE
no debugging print is performed.
None profiling method selected.
static void normalize(const application_managerRef AppM, const CustomUnorderedMap< unsigned int, CustomUnorderedMapStable< unsigned int, long long unsigned int >> &loop_instances, const ParameterConstRef parameters)
Normalize path frequency according to execution times of whole function_id.
~HostProfiling() override
Destructor.
const application_managerRef AppM
The application manager.
Class specification of the basic_block structure.
This file collects some hash functors.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
#define THROW_ERROR_CODE(code, str_expr)
helper function used to throw an error with a code error
interface of loops finding algorithm
this class is used to manage the command-line or XML options.
absl::node_hash_map< T, U, Hash, Eq, Alloc > CustomUnorderedMapStable
int debug_level
The debug level.
DesignFlowStep_Status Exec() override
Do nothing.
A brief description of the C++ Header File.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...