49template <
typename Type>
61 template <
typename Up = Type>
65 template <
typename Up = Type>
73template <
typename Type>
81 auto node_rank = dmp::rank();
82 auto node_results = _data->dmp_get();
85 if(node_rank != 0 || node_results.empty())
89 for(
auto&& itr : node_results)
91 for(
auto&& nitr : itr)
93 results.emplace_back(std::move(nitr));
100 using Archive = cereal::MinimalJSONOutputArchive;
106 if(outfname.length() > 0)
112 printf(
"[%s]|%i> Outputting '%s'...\n", _label.c_str(), node_rank,
118 oa->setNextName(
"traceEvents");
123 using offset_map_t = std::map<int64_t, value_type>;
124 using useoff_map_t = std::map<int64_t, bool>;
125 auto conv = units::usec;
126 offset_map_t total_offset;
127 offset_map_t last_offset;
128 offset_map_t last_value;
129 useoff_map_t use_last;
132 for(
auto& itr : results)
135 use_last[itr.depth()] =
false;
138 for(
auto& itr : results)
141 auto value = itr.data().get() * conv;
143 auto litr = last_offset.find(itr.depth());
144 if(litr != last_offset.end())
149 total_offset[itr.depth()] += litr->second;
151 for(int64_t i = itr.depth() + 1; i <
max_depth; ++i)
154 total_offset[i] = total_offset[itr.depth()];
155 last_value[i] = litr->second;
156 auto ditr = last_offset.find(i);
157 if(ditr != last_offset.end())
158 last_offset.erase(ditr);
160 last_offset.erase(litr);
163 value_type offset = total_offset[itr.depth()];
164 if(use_last[itr.depth()])
165 offset += last_value[itr.depth()] - value;
178 if(
_prefix.find(
">>>") != std::string::npos)
180 if(
_prefix.find(
"|_") != std::string::npos)
183 (*oa)(cereal::make_nvp(
"dur", value));
184 (*oa)(cereal::make_nvp(
"name",
_prefix));
185 (*oa)(cereal::make_nvp(
"ph", _ph));
186 (*oa)(cereal::make_nvp(
"pid", itr.pid()));
187 (*oa)(cereal::make_nvp(
"tid", itr.tid()));
188 (*oa)(cereal::make_nvp(
"ts", offset));
192 last_offset[itr.depth()] = value;
193 last_value[itr.depth()] = value;
225template <
typename Type>
226template <
typename Up>
static pointer_t instance()
Get a shared pointer to the instance for the current thread.
The declaration for the types for manager without definitions.
bool open(std::ofstream &_ofs, std::string _fpath, Args &&... _args)
char const std::string & _prefix
typename std::decay< T >::type decay_t
Alias template for decay.
typename std::enable_if< B, T >::type enable_if_t
Alias template for enable_if.
tim::mpl::apply< std::string > string
auto get(const auto_bundle< Tag, Types... > &_obj)
The declaration for the types for operations without definitions.
Include the macros for operations.
Declare the operations types.
typename storage_type::graph_node graph_node
typename storage_type::result_node result_node
flamegraph(storage_type *, std::string, enable_if_t< trait::supports_flamegraph< Up >::value, int >=0)
typename storage_type::graph_t graph_type
typename storage_type::dmp_result_t distrib_type
typename storage_type::uintvector_t hierarchy_type
impl::storage< Type, has_data > storage_type
typename storage_type::result_array_t result_type
Provides a static get() function which return a shared pointer to an instance of the given archive fo...
static string_t compose_output_filename(string_t _tag, string_t _ext, bool _use_suffix=use_output_suffix(), int32_t _suffix=default_process_suffix(), bool _make_dir=false, std::string _explicit={})
trait that designates a type supports flamegraph output