Classes | |
class | GraphEntry |
Enumerations | |
enum | EntryType { node , edge } |
Functions | |
std::string | blend_colours (double ratio, int hot_colour[3], int cool_colour[3]) |
Simple additive blending of two colours. May be reduced with nicer colour blending in the future. More... | |
std::string | print_time (double time, double total_time, bool show_percentage_time) |
Returns a string with the runtime of a node. More... | |
std::string | make_box (std::string name, double time, double total_time, size_t call_count, size_t opcount, int hot[3], int cool[3], bool show_percentage_time) |
Create a graphviz box of a profiler node. More... | |
std::string | make_arrow (std::string name_from, std::string name_to, double time, double total_time, size_t call_count, int hot[3], int cool[3], bool show_percentage_time) |
Create a graphviz arrow of a profiler node. More... | |
void | combine_graph_entries (GraphEntry &entry1, GraphEntry &entry2) |
Combines two graph entries, summing their time, calls and opcount. More... | |
void | merge_vec (std::vector< GraphEntry > &graph_entries) |
Iterates through the list of GraphEntries and merges any two nodes with the same name. The implementation is a little complex, it removes elements from the vector as it goes and has to update the iterators to correct for entries being deleted. More... | |
void | apply_threshold (std::vector< GraphEntry > &graph_entries, double threshold, double total_time) |
This removes any enntry from graph_entries with a runtime/total_time less than threshold. More... | |
bool | has_parent (GraphEntry &child, std::vector< GraphEntry > &graph_entries) |
Determines if a node has a parent. More... | |
void | destroy_orphans (std::vector< GraphEntry > &graph_entries) |
Removes every element from graph_entries that does not have an edge pointing towards it (unless it's the root node). More... | |
std::string | get_graph_markup (std::vector< GraphEntry > &graph_entries, double total_time, int hot[3], int cool[3], bool show_percentage_time) |
This gets the graphviz markup for the main part of the graph (excepting global styles). More... | |
void | make_dotgraph_vec (std::shared_ptr< Node< Counter >> root, double total_time, std::vector< GraphEntry > &graph_entries) |
This populates a vector containing a GraphEntry for each profiler node. This is an intermediate data structure to make it easier to merge profiler nodes but retain their connectivity. More... | |
std::string | make_dotgraph (std::shared_ptr< Node< Counter >> root, double total_time, int hot[3], int cool[3], double threshold, bool show_percentage_time) |
This creates the complete graphviz markup for the whole performance graph, including global styles. The output from this function can be written to a .dot file. More... | |
void molpro::profiler::dotgraph::apply_threshold | ( | std::vector< GraphEntry > & | graph_entries, |
double | threshold, | ||
double | total_time | ||
) |
This removes any enntry from graph_entries with a runtime/total_time less than threshold.
graph_entries | a vector filled with GraphEntry objects. |
threshold | the threshold below which the entry will be deleted (as a ratio) |
total_time | total runntime of the profile. |
std::string molpro::profiler::dotgraph::blend_colours | ( | double | ratio, |
int | hot_colour[3], | ||
int | cool_colour[3] | ||
) |
Simple additive blending of two colours. May be reduced with nicer colour blending in the future.
ratio | ratio of the colours. A double between 0 and 1. 1 is hot, 0 is cool. |
hot_colour | an 8-bit colour, 0-255. |
cool_colour | an 8-bit colour, 0-255. |
void molpro::profiler::dotgraph::combine_graph_entries | ( | GraphEntry & | entry1, |
GraphEntry & | entry2 | ||
) |
Combines two graph entries, summing their time, calls and opcount.
entry1 | the graph entry that entry2 will be merged into. |
entry2 | the graph entry that will be merged into entry1. |
void molpro::profiler::dotgraph::destroy_orphans | ( | std::vector< GraphEntry > & | graph_entries | ) |
Removes every element from graph_entries that does not have an edge pointing towards it (unless it's the root node).
graph_entries | a vector filled with GraphEntry objects, normally found in make_dotgraph_vec |
std::string molpro::profiler::dotgraph::get_graph_markup | ( | std::vector< GraphEntry > & | graph_entries, |
double | total_time, | ||
int | hot[3], | ||
int | cool[3], | ||
bool | show_percentage_time | ||
) |
This gets the graphviz markup for the main part of the graph (excepting global styles).
graph_entries | a vector filled with GraphEntry objects. |
total_time | the total time taken by the program, in seconds. |
hot | an 8-bit colour, 0-255. The more time spent in this node, the hotter the colour will be. |
cool | an 8-bit colour, 0-255. |
show_percentage_time | whether to show the time as a percentage of the runtime (true) or in seconds (false). |
bool molpro::profiler::dotgraph::has_parent | ( | GraphEntry & | child, |
std::vector< GraphEntry > & | graph_entries | ||
) |
Determines if a node has a parent.
child | - a single graph_entry |
graph_entries | a vector filled with GraphEntry objects. |
std::string molpro::profiler::dotgraph::make_arrow | ( | std::string | name_from, |
std::string | name_to, | ||
double | time, | ||
double | total_time, | ||
size_t | call_count, | ||
int | hot[3], | ||
int | cool[3], | ||
bool | show_percentage_time | ||
) |
Create a graphviz arrow of a profiler node.
name_from | name the name of the box that the arrow is coming from. |
ratio | name the name of the box that the arrow is going to. |
time | time time taken for the node, in seconds. |
total_time | the total time taken by the program, in seconds. |
call_count | the number of times the node has been called. |
hot | an 8-bit colour, 0-255. The more time spent in this node, the hotter the colour will be. |
cool | an 8-bit colour, 0-255. |
show_percentage_time | whether to show the time as a percentage of the runtime (true) or in seconds (false). |
std::string molpro::profiler::dotgraph::make_box | ( | std::string | name, |
double | time, | ||
double | total_time, | ||
size_t | call_count, | ||
size_t | opcount, | ||
int | hot[3], | ||
int | cool[3], | ||
bool | show_percentage_time | ||
) |
Create a graphviz box of a profiler node.
ratio | name the name of the box. |
time | time time taken for the node, in seconds. |
total_time | the total time taken by the program, in seconds. |
call_count | the number of times the node has been called. |
opcount | the number of operations (used to calculate frequency) |
hot | an 8-bit colour, 0-255. The more time spent in this node, the hotter the colour will be. |
cool | an 8-bit colour, 0-255. |
show_percentage_time | whether to show the time as a percentage of the runtime (true) or in seconds (false). |
std::string molpro::profiler::dotgraph::make_dotgraph | ( | std::shared_ptr< Node< Counter >> | root, |
double | total_time, | ||
int | hot[3], | ||
int | cool[3], | ||
double | threshold, | ||
bool | show_percentage_time | ||
) |
This creates the complete graphviz markup for the whole performance graph, including global styles. The output from this function can be written to a .dot file.
root | the root of the tree of nodes as defined in node.h. |
total_time | the total time taken by the program, in seconds. |
hot | an 8-bit colour, 0-255. The more time spent in this node, the hotter the colour will be. |
cool | an 8-bit colour, 0-255. |
threshold | a value between 0 and 1, a ratio of the program's runtime. If the program spends less than this value in a given function, the box will not be drawn. |
show_percentage_time | whether to show the time as a percentage of the runtime (true) or in seconds (false). |
void molpro::profiler::dotgraph::make_dotgraph_vec | ( | std::shared_ptr< Node< Counter >> | root, |
double | total_time, | ||
std::vector< GraphEntry > & | graph_entries | ||
) |
This populates a vector containing a GraphEntry for each profiler node. This is an intermediate data structure to make it easier to merge profiler nodes but retain their connectivity.
root | the root of the tree of nodes as defined in node.h. |
total_time | the total time taken by the program, in seconds. |
threshold | a value between 0 and 1, a ratio of the program's runtime. If the program spends less than this value in a given function, the box will not be drawn. |
graph_entries | a vector (most likely empty) that will be filled with GraphEntry objects. |
void molpro::profiler::dotgraph::merge_vec | ( | std::vector< GraphEntry > & | graph_entries | ) |
Iterates through the list of GraphEntries and merges any two nodes with the same name. The implementation is a little complex, it removes elements from the vector as it goes and has to update the iterators to correct for entries being deleted.
graph_entries | a vector filled with GraphEntry objects, normally found in make_dotgraph_vec |
std::string molpro::profiler::dotgraph::print_time | ( | double | time, |
double | total_time, | ||
bool | show_percentage_time | ||
) |
Returns a string with the runtime of a node.
time | The runtime of the node |
total_time | the total runtime of the tree. |
show_percentage_time | if true, will show a percentage, otherwise will show the time in seconds. |