libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::ppd::control_flow_graph< OST > Class Template Reference

A class to generate a Control Flow Graph (CFG), if the support has been coded into the joinable, nonjoinable, etc modifiers. More...

#include <thread_statistics.hpp>

Classes

class  add_cfg_details
 

Public Types

typedef OST os_traits
 
typedef os_traits::lock_traits lock_traits
 
typedef lock_traits::recursive_critical_section_type atomic_t
 
typedef std::string node_property_t
 
typedef char edge_annotation_t
 
typedef boost::adjacency_list< boost::listS, boost::vecS, boost::bidirectionalS, boost::property< boost::vertex_name_t, node_property_t >, boost::property< boost::edge_name_t, node_property_t > > container_type
 
typedef boost::graph_traits< container_type >::vertex_descriptor vertex_t
 
typedef boost::graph_traits< container_type >::edge_descriptor edge_t
 

Public Member Functions

void write_graphviz (std::ostream &os) const noexcept(false) FORCE_INLINE
 Output the graph in DOTTY format. More...
 
 control_flow_graph () noexcept(false) FORCE_INLINE
 
 control_flow_graph (control_flow_graph const &)=delete
 

Static Public Attributes

constexpr static edge_annotation_t hrz_edge_annotation ='h'
 
constexpr static edge_annotation_t vertical_edge_annotation ='v'
 
constexpr static edge_annotation_t sequential_edge_annotation ='s'
 

Friends

template<class Node >
class add_cfg_details
 

Detailed Description

template<class OST>
class jmmcg::ppd::control_flow_graph< OST >

A class to generate a Control Flow Graph (CFG), if the support has been coded into the joinable, nonjoinable, etc modifiers.

Note that this class is coded for simplicity, not speed, so uses a "big lock" (the atomic_t type) to control multi-threaded access. This has at least these ramifications:

  1. All guarantees regarding number of locks & schedule generated by the library are invalidated (basic_statistics does not invalidate these guarantees).
  2. The number of horizontal operations when generating a CFG may be different from that reported by basic_statistics::total_hrz_work() alone. In this case both results are right, but the number reported by basic_statistics::total_hrz_work() is an accurate measure; whereas the horizontal edges in this graph may have been affected by the internal locking within this class. To verify the CFG, compare the output of basic_statistics with both no_control_flow_graph and control_flow_graph in use, if they are the same you can be assured of accuracy. If different then you need to interpret the CFG output with greater care.
See also
no_control_flow_graph

Definition at line 223 of file thread_statistics.hpp.

Member Typedef Documentation

◆ atomic_t

template<class OST >
typedef lock_traits::recursive_critical_section_type jmmcg::ppd::control_flow_graph< OST >::atomic_t

Definition at line 227 of file thread_statistics.hpp.

◆ container_type

template<class OST >
typedef boost::adjacency_list< boost::listS, boost::vecS, boost::bidirectionalS, boost::property<boost::vertex_name_t, node_property_t>, boost::property<boost::edge_name_t, node_property_t> > jmmcg::ppd::control_flow_graph< OST >::container_type

Definition at line 250 of file thread_statistics.hpp.

◆ edge_annotation_t

template<class OST >
typedef char jmmcg::ppd::control_flow_graph< OST >::edge_annotation_t

Definition at line 243 of file thread_statistics.hpp.

◆ edge_t

template<class OST >
typedef boost::graph_traits<container_type>::edge_descriptor jmmcg::ppd::control_flow_graph< OST >::edge_t

Definition at line 252 of file thread_statistics.hpp.

◆ lock_traits

template<class OST >
typedef os_traits::lock_traits jmmcg::ppd::control_flow_graph< OST >::lock_traits

Definition at line 226 of file thread_statistics.hpp.

◆ node_property_t

template<class OST >
typedef std::string jmmcg::ppd::control_flow_graph< OST >::node_property_t

Definition at line 242 of file thread_statistics.hpp.

◆ os_traits

template<class OST >
typedef OST jmmcg::ppd::control_flow_graph< OST >::os_traits

Definition at line 225 of file thread_statistics.hpp.

◆ vertex_t

template<class OST >
typedef boost::graph_traits<container_type>::vertex_descriptor jmmcg::ppd::control_flow_graph< OST >::vertex_t

Definition at line 251 of file thread_statistics.hpp.

Constructor & Destructor Documentation

◆ control_flow_graph() [1/2]

template<class OST >
jmmcg::ppd::control_flow_graph< OST >::control_flow_graph ( )
inlinenoexcept

Definition at line 260 of file thread_statistics.hpp.

◆ control_flow_graph() [2/2]

template<class OST >
jmmcg::ppd::control_flow_graph< OST >::control_flow_graph ( control_flow_graph< OST > const &  )
delete

Member Function Documentation

◆ write_graphviz()

template<class OST >
void jmmcg::ppd::control_flow_graph< OST >::write_graphviz ( std::ostream &  os) const
inlinenoexcept

Output the graph in DOTTY format.

This may be converted to a pleasant PNG-format image using this command: "nice dot -Tpng test.dot >test.png" Assuming the os is created using an std::ofstream named "test.dot". Note that the PNG file can become large! thread_pool::merge() with 12 cores creates a file that is ~500kB in size and thread_pool::sort() is ~1Mb with 12 cores.

Definition at line 235 of file thread_statistics.hpp.

Friends And Related Function Documentation

◆ add_cfg_details

template<class OST >
template<class Node >
friend class add_cfg_details
friend

Definition at line 268 of file thread_statistics.hpp.

Member Data Documentation

◆ hrz_edge_annotation

template<class OST >
constexpr static edge_annotation_t jmmcg::ppd::control_flow_graph< OST >::hrz_edge_annotation ='h'
staticconstexpr

Definition at line 256 of file thread_statistics.hpp.

◆ sequential_edge_annotation

template<class OST >
constexpr static edge_annotation_t jmmcg::ppd::control_flow_graph< OST >::sequential_edge_annotation ='s'
staticconstexpr

Definition at line 258 of file thread_statistics.hpp.

◆ vertical_edge_annotation

template<class OST >
constexpr static edge_annotation_t jmmcg::ppd::control_flow_graph< OST >::vertical_edge_annotation ='v'
staticconstexpr

Definition at line 257 of file thread_statistics.hpp.


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