timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
node.hpp
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2020, The Regents of the University of California,
4// through Lawrence Berkeley National Laboratory (subject to receipt of any
5// required approvals from the U.S. Dept. of Energy). All rights reserved.
6//
7// Permission is hereby granted, free of charge, to any person obtaining a copy
8// of this software and associated documentation files (the "Software"), to deal
9// in the Software without restriction, including without limitation the rights
10// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in all
15// copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23// SOFTWARE.
24
25#pragma once
26
27#include "timemory/backends/process.hpp"
28#include "timemory/backends/threading.hpp"
30#include "timemory/hash.hpp"
35#include "timemory/tpls/cereal/archives.hpp"
36
37#include <cstdint>
38#include <set>
39#include <string>
40#include <tuple>
41#include <vector>
42
43//--------------------------------------------------------------------------------------//
44//
45namespace tim
46{
47//
48namespace operation
49{
50template <typename Tp>
51struct dummy;
52}
53//
54namespace node
55{
56//
57//--------------------------------------------------------------------------------------//
58/// \struct tim::node::entry
59/// \tparam Tp Component type
60/// \tparam StatT Statistics type
61///
62/// \brief This data type is used in \ref tim::node::tree for inclusive and exclusive
63/// values.
64template <typename Tp, typename StatT>
65struct entry : std::tuple<Tp, StatT>
66{
67 using base_type = std::tuple<Tp, StatT>;
69
70 TIMEMORY_DEFAULT_OBJECT(entry)
71
72 template <typename... Args>
73 explicit entry(Args&&... args)
74 : base_type(std::forward<Args>(args)...)
75 {}
76 explicit entry(const base_type& _obj)
77 : base_type(_obj)
78 {}
79 explicit entry(base_type&& _obj) noexcept
80 : base_type(std::forward<base_type>(_obj))
81 {}
82
83 /// component object with either inclusive or exclusive values
84 Tp& data() { return std::get<0>(*this); }
85
86 /// statistics data with either inclusive or exclusive values
87 StatT& stats() { return std::get<1>(*this); }
88
89 /// component object with either inclusive or exclusive values
90 const Tp& data() const { return std::get<0>(*this); }
91
92 /// statistics data with either inclusive or exclusive values
93 const StatT& stats() const { return std::get<1>(*this); }
94
96 {
97 data() += rhs.data();
98 stats() += rhs.stats();
99 return *this;
100 }
101
103 {
104 data() -= rhs.data();
105 stats() -= rhs.stats();
106 return *this;
107 }
108};
109//
110//--------------------------------------------------------------------------------------//
111//
112template <typename Tp>
113struct data
114{
116 using strvector_t = std::vector<string_t>;
117 using uintvector_t = std::vector<uint64_t>;
118
122 using node_type =
123 std::tuple<bool, uint32_t, uint32_t, uint64_t, int64_t, Tp, stats_type>;
124 using result_type = std::tuple<uint32_t, uint32_t, int64_t, uint64_t, uint64_t,
126 using idset_type = std::set<int64_t>;
128 using tree_type = std::tuple<bool, uint64_t, int64_t, idset_type, idset_type,
130};
131//
132//--------------------------------------------------------------------------------------//
133/// \struct tim::node::graph
134/// \tparam Tp Component type
135///
136/// \brief This is the compact representation of a measurement in the call-graph.
137template <typename Tp>
138struct graph : private data<Tp>::node_type
139{
142 using data_value_type = typename Tp::value_type;
143 using data_base_type = typename Tp::base_type;
146
147public:
148 // ctor, dtor
149 graph();
150 graph(uint64_t _id, const Tp& _obj, int64_t _depth, uint32_t _tid,
151 uint32_t _pid = process::get_id(), bool _is_dummy = false);
152
153 ~graph() = default;
154 graph(const graph&) = default;
155 graph(graph&&) noexcept = default;
156
157 graph& operator=(const graph&) = default;
158 graph& operator=(graph&&) noexcept = default;
159
160public:
161 static Tp get_dummy();
162 bool operator==(const graph& rhs) const;
163 bool operator!=(const graph& rhs) const;
164 this_type& operator+=(const this_type& rhs)
165 {
166 obj() += rhs.obj();
167 stats() += rhs.stats();
168 return *this;
169 }
170
172 {
173 obj() -= rhs.obj();
174 stats() -= rhs.stats();
175 return *this;
176 }
177
178public:
179 /// denotes this is a placeholder for synchronization
180 bool& is_dummy() { return std::get<0>(*this); }
181
182 /// thread identifier
183 uint32_t& tid() { return std::get<1>(*this); }
184
185 /// process identifier
186 uint32_t& pid() { return std::get<2>(*this); }
187
188 /// hash identifer
189 uint64_t& id() { return std::get<3>(*this); }
190
191 /// depth in call-graph
192 int64_t& depth() { return std::get<4>(*this); }
193
194 /// this is the instance that gets updated in call-graph
195 Tp& obj() { return std::get<5>(*this); }
196
197 /// statistics data for entry in call-graph
198 stats_type& stats() { return std::get<6>(*this); }
199
200 const bool& is_dummy() const { return std::get<0>(*this); }
201 const uint32_t& tid() const { return std::get<1>(*this); }
202 const uint32_t& pid() const { return std::get<2>(*this); }
203 const uint64_t& id() const { return std::get<3>(*this); }
204 const int64_t& depth() const { return std::get<4>(*this); }
205 const Tp& obj() const { return std::get<5>(*this); }
206 const stats_type& stats() const { return std::get<6>(*this); }
207
208 auto& data() { return this->obj(); }
209 auto& hash() { return this->id(); }
210 const auto& data() const { return this->obj(); }
211 const auto& hash() const { return this->id(); }
212};
213//
214//--------------------------------------------------------------------------------------//
215/// \struct tim::node::result
216/// \tparam Tp Component type
217///
218/// \brief This data type is used when rendering the flat representation (i.e.
219/// loop-iterable) representation of the calling-context. The prefix here will be
220/// identical to the prefix in the text output.
221template <typename Tp>
222struct result : public data<Tp>::result_type
223{
224 using uintvector_t = std::vector<uint64_t>;
228
229 result() = default;
230 ~result() = default;
231 result(const result&) = default;
232 result(result&&) noexcept = default;
233 result& operator=(const result&) = default;
234 result& operator=(result&&) noexcept = default;
235
236 result(base_type&& _base) noexcept
237 : base_type(std::forward<base_type>(_base))
238 {}
239
240 result(uint64_t _hash, const Tp& _data, const string_t& _prefix, int64_t _depth,
241 uint64_t _rolling, const uintvector_t& _hierarchy, const stats_type& _stats,
242 uint32_t _tid, uint32_t _pid);
243
244 /// measurement thread. May be `std::numeric_limits<uint16_t>::max()` (i.e. 65536) if
245 /// this entry is a combination of multiple threads
246 uint32_t& tid() { return std::get<0>(*this); }
247
248 /// the process identifier of the reporting process, if multiple process data is
249 /// combined, or the process identifier of the collecting process
250 uint32_t& pid() { return std::get<1>(*this); }
251
252 /// depth of the node in the calling-context
253 int64_t& depth() { return std::get<2>(*this); }
254
255 /// hash identifer of the node
256 uint64_t& hash() { return std::get<3>(*this); }
257
258 /// the summation of this hash and it's parent hashes
259 uint64_t& rolling_hash() { return std::get<4>(*this); }
260
261 /// the associated string with the hash + indentation and other decoration
262 string_t& prefix() { return std::get<5>(*this); }
263
264 /// an array of the hash value + each parent hash (not serialized)
265 uintvector_t& hierarchy() { return std::get<6>(*this); }
266
267 /// reference to the component
268 Tp& data() { return std::get<7>(*this); }
269
270 /// reference to the associate statistical accumulation of the data (if any)
271 stats_type& stats() { return std::get<8>(*this); }
272
273 /// alias for `hash()`
274 uint64_t& id() { return std::get<3>(*this); }
275
276 /// alias for `data()`
277 Tp& obj() { return std::get<7>(*this); }
278
279 const uint32_t& tid() const { return std::get<0>(*this); }
280 const uint32_t& pid() const { return std::get<1>(*this); }
281 const int64_t& depth() const { return std::get<2>(*this); }
282 const uint64_t& hash() const { return std::get<3>(*this); }
283 const uint64_t& rolling_hash() const { return std::get<4>(*this); }
284 const string_t& prefix() const { return std::get<5>(*this); }
285 const uintvector_t& hierarchy() const { return std::get<6>(*this); }
286 const Tp& data() const { return std::get<7>(*this); }
287 const stats_type& stats() const { return std::get<8>(*this); }
288 const uint64_t& id() const { return std::get<3>(*this); }
289 const Tp& obj() const { return std::get<7>(*this); }
290
291 bool operator==(const this_type& rhs) const
292 {
293 return (depth() == rhs.depth() && hash() == rhs.hash() &&
294 rolling_hash() == rhs.rolling_hash() && prefix() == rhs.prefix());
295 }
296
297 bool operator!=(const this_type& rhs) const { return !(*this == rhs); }
298
300 {
301 data() += rhs.data();
302 stats() += rhs.stats();
303 return *this;
304 }
305
307 {
308 data() -= rhs.data();
309 stats() -= rhs.stats();
310 return *this;
311 }
312};
313//
314//--------------------------------------------------------------------------------------//
315/// \struct tim::node::tree
316/// \tparam Tp Generally `tim::basic_tree<ComponentT>`
317///
318/// \brief This data type is used when rendering the hierarchical representation (i.e.
319/// requires recursion) representation of the calling-context. The prefix here has no
320/// decoration.
321template <typename Tp>
322struct tree : private data<Tp>::tree_type
323{
326 using data_value_type = typename Tp::value_type;
327 using data_base_type = typename Tp::base_type;
332
333public:
334 // ctor, dtor
335 tree();
336 explicit tree(base_type&& _base) noexcept;
337
338 tree(const graph<Tp>&);
339 tree& operator=(const graph<Tp>&);
340
341 ~tree() = default;
342 tree(const tree&) = default;
343 tree(tree&&) noexcept = default;
344 tree(bool _is_dummy, uint32_t _tid, uint32_t _pid, uint64_t _hash, int64_t _depth,
345 const Tp& _obj);
346
347public:
348 static Tp get_dummy();
349 bool operator==(const tree& rhs) const;
350 bool operator!=(const tree& rhs) const;
351 tree& operator=(const tree&) = default;
352 tree& operator=(tree&&) noexcept = default;
353 this_type& operator+=(const this_type& rhs)
354 {
355 inclusive() += rhs.inclusive();
356 exclusive() += rhs.exclusive();
357 for(const auto& itr : rhs.tid())
358 tid().insert(itr);
359 for(const auto& itr : rhs.pid())
360 pid().insert(itr);
361 return *this;
362 }
363
365 {
366 inclusive() -= rhs.inclusive();
367 exclusive() -= rhs.exclusive();
368 return *this;
369 }
370
371public:
372 /// returns whether or not this node is a synchronization point and, if so, should be
373 /// ignored
374 bool& is_dummy() { return std::get<0>(*this); }
375
376 /// returns the hash identifier for the associated string identifier
377 uint64_t& hash() { return std::get<1>(*this); }
378
379 /// returns the depth of the node in the tree. NOTE: this value may be relative to
380 /// dummy nodes
381 int64_t& depth() { return std::get<2>(*this); }
382
383 /// the set of thread ids this data was collected from
384 idset_type& tid() { return std::get<3>(*this); }
385
386 /// the set of process ids this data was collected from
387 idset_type& pid() { return std::get<4>(*this); }
388
389 /// the inclusive data + statistics
390 entry_type& inclusive() { return std::get<5>(*this); }
391
392 /// the exclusive data + statistics
393 entry_type& exclusive() { return std::get<6>(*this); }
394
395 const bool& is_dummy() const { return std::get<0>(*this); }
396 const uint64_t& hash() const { return std::get<1>(*this); }
397 const int64_t& depth() const { return std::get<2>(*this); }
398 const idset_type& tid() const { return std::get<3>(*this); }
399 const idset_type& pid() const { return std::get<4>(*this); }
400 const entry_type& inclusive() const { return std::get<5>(*this); }
401 const entry_type& exclusive() const { return std::get<6>(*this); }
402};
403//
404//--------------------------------------------------------------------------------------//
405//
406// Definitions
407//
408//--------------------------------------------------------------------------------------//
409//
410template <typename Tp>
412: base_type(false, threading::get_id(), process::get_id(), 0, 0, Tp{}, stats_type{})
413{}
414//
415//--------------------------------------------------------------------------------------//
416//
417template <typename Tp>
418graph<Tp>::graph(uint64_t _id, const Tp& _obj, int64_t _depth, uint32_t _tid,
419 uint32_t _pid, bool _is_dummy)
420: base_type(_is_dummy, _tid, _pid, _id, _depth, _obj, stats_type{})
421{}
422//
423//--------------------------------------------------------------------------------------//
424//
425template <typename Tp>
426bool
428{
429 return (id() == rhs.id() && depth() == rhs.depth());
430}
431//
432//--------------------------------------------------------------------------------------//
433//
434template <typename Tp>
435bool
437{
438 return !(*this == rhs);
439}
440//
441//--------------------------------------------------------------------------------------//
442//
443template <typename Tp>
444Tp
446{
447 return operation::dummy<Tp>{}();
448}
449//
450//--------------------------------------------------------------------------------------//
451//
452template <typename Tp>
453result<Tp>::result(uint64_t _id, const Tp& _data, const string_t& _prefix, int64_t _depth,
454 uint64_t _rolling, const uintvector_t& _hierarchy,
455 const stats_type& _stats, uint32_t _tid, uint32_t _pid)
456: base_type(_tid, _pid, _depth, _id, _rolling, _prefix, _hierarchy, _data, _stats)
457{}
458//--------------------------------------------------------------------------------------//
459//
460template <typename Tp>
462: base_type(false, 0, 0, idset_type{ threading::get_id() },
463 idset_type{ process::get_id() }, entry_type{}, entry_type{})
464{}
465//
466//--------------------------------------------------------------------------------------//
467//
468template <typename Tp>
470: base_type(rhs.is_dummy(), rhs.hash(), rhs.depth(), idset_type{ rhs.tid() },
471 idset_type{ rhs.pid() }, entry_type{ rhs.data(), rhs.stats() },
472 entry_type{ rhs.data(), rhs.stats() })
473{}
474//
475//--------------------------------------------------------------------------------------//
476//
477template <typename Tp>
480{
481 is_dummy() = rhs.is_dummy();
482 hash() = rhs.hash();
483 depth() = rhs.depth();
484 tid() = { rhs.tid() };
485 pid() = { rhs.pid() };
486 inclusive() = entry_type{ rhs.data(), rhs.stats() };
487 exclusive() = entry_type{ rhs.data(), rhs.stats() };
488 return *this;
489}
490//
491//--------------------------------------------------------------------------------------//
492//
493} // namespace node
494} // namespace tim
495//
496//--------------------------------------------------------------------------------------//
497//
498namespace tim
499{
500namespace cereal
501{
502//
503//--------------------------------------------------------------------------------------//
504//
505template <typename Archive, typename Tp>
506void
507save(Archive& ar, const tim::node::graph<Tp>& d)
508{
510 ar(cereal::make_nvp("hash", d.id()), cereal::make_nvp("prefix", _prefix),
511 cereal::make_nvp("entry", d.obj()), cereal::make_nvp("depth", d.depth()),
512 cereal::make_nvp("stats", d.stats()), cereal::make_nvp("tid", d.tid()),
513 cereal::make_nvp("pid", d.pid()), cereal::make_nvp("dummy", d.is_dummy()));
514}
515//
516//--------------------------------------------------------------------------------------//
517//
518template <typename Archive, typename Tp>
519void
521{
523 ar(cereal::make_nvp("hash", d.id()), cereal::make_nvp("prefix", _prefix),
524 cereal::make_nvp("entry", d.obj()), cereal::make_nvp("depth", d.depth()),
525 cereal::make_nvp("stats", d.stats()), cereal::make_nvp("tid", d.tid()),
526 cereal::make_nvp("pid", d.pid()), cereal::make_nvp("dummy", d.is_dummy()));
527 auto _id = tim::add_hash_id(_prefix);
528 if(_id != d.id())
529 tim::add_hash_id(_id, d.id());
530}
531//
532//--------------------------------------------------------------------------------------//
533//
534template <typename Archive, typename Tp>
535struct specialize<Archive, tim::node::graph<Tp>,
536 cereal::specialization::non_member_load_save>
537{};
538//
539//--------------------------------------------------------------------------------------//
540//
541template <typename Archive, typename Tp, typename StatT>
542void
543save(Archive& ar, const tim::node::entry<Tp, StatT>& e)
544{
545 ar(cereal::make_nvp("entry", e.data()));
546 ar(cereal::make_nvp("stats", e.stats()));
547}
548//
549//--------------------------------------------------------------------------------------//
550//
551template <typename Archive, typename Tp, typename StatT>
552void
554{
555 ar(cereal::make_nvp("entry", e.data()));
556 ar(cereal::make_nvp("stats", e.stats()));
557}
558//
559//--------------------------------------------------------------------------------------//
560//
561template <typename Archive, typename Tp, typename StatT>
562struct specialize<Archive, tim::node::entry<Tp, StatT>,
563 cereal::specialization::non_member_load_save>
564{};
565//
566//--------------------------------------------------------------------------------------//
567//
568template <typename Archive, typename Tp>
569void
570save(Archive& ar, const tim::node::tree<Tp>& t)
571{
572 auto _prefix =
574 ar(cereal::make_nvp("hash", t.hash()), cereal::make_nvp("prefix", _prefix),
575 cereal::make_nvp("tid", t.tid()), cereal::make_nvp("pid", t.pid()),
576 cereal::make_nvp("depth", t.depth()), cereal::make_nvp("is_dummy", t.is_dummy()));
577 ar(cereal::make_nvp("inclusive", t.inclusive()));
578 ar(cereal::make_nvp("exclusive", t.exclusive()));
579}
580//
581//--------------------------------------------------------------------------------------//
582//
583template <typename Archive, typename Tp>
584void
585load(Archive& ar, tim::node::tree<Tp>& t)
586{
588 ar(cereal::make_nvp("hash", t.hash()), cereal::make_nvp("prefix", _prefix),
589 cereal::make_nvp("tid", t.tid()), cereal::make_nvp("pid", t.pid()),
590 cereal::make_nvp("depth", t.depth()), cereal::make_nvp("is_dummy", t.is_dummy()));
591 ar(cereal::make_nvp("inclusive", t.inclusive()));
592 ar(cereal::make_nvp("exclusive", t.exclusive()));
593 auto _id = tim::add_hash_id(_prefix);
594 if(_id != t.hash())
595 tim::add_hash_id(_id, t.hash());
596}
597//
598//--------------------------------------------------------------------------------------//
599//
600template <typename Archive, typename Tp>
601struct specialize<Archive, tim::node::tree<Tp>,
602 cereal::specialization::non_member_load_save>
603{};
604//
605//--------------------------------------------------------------------------------------//
606//
607template <typename Archive, typename Tp>
608void
609save(Archive& ar, const tim::node::result<Tp>& r)
610{
611 ar(cereal::make_nvp("hash", r.hash()), cereal::make_nvp("prefix", r.prefix()),
612 cereal::make_nvp("depth", r.depth()), cereal::make_nvp("entry", r.data()),
613 cereal::make_nvp("stats", r.stats()),
614 cereal::make_nvp("rolling_hash", r.rolling_hash()));
615 // ar(cereal::make_nvp("hierarchy", r.hierarchy()));
616}
617//
618//--------------------------------------------------------------------------------------//
619//
620template <typename Archive, typename Tp>
621void
623{
624 ar(cereal::make_nvp("hash", r.hash()), cereal::make_nvp("prefix", r.prefix()),
625 cereal::make_nvp("depth", r.depth()), cereal::make_nvp("entry", r.data()),
626 cereal::make_nvp("stats", r.stats()),
627 cereal::make_nvp("rolling_hash", r.rolling_hash()));
628 // ar(cereal::make_nvp("hierarchy", r.hierarchy()));
629}
630//
631//--------------------------------------------------------------------------------------//
632//
633template <typename Archive, typename Tp>
634void
635save(Archive& ar, const std::vector<tim::node::result<Tp>>& result_nodes)
636{
637 ar(cereal::make_nvp("graph_size", result_nodes.size()));
638 ar.setNextName("graph");
639 ar.startNode();
640 ar.makeArray();
641 for(const auto& itr : result_nodes)
642 {
643 ar.startNode();
644 save(ar, itr);
645 ar.finishNode();
646 }
647 ar.finishNode();
648}
649//
650//--------------------------------------------------------------------------------------//
651//
652template <typename Archive, typename Tp>
653void
654load(Archive& ar, std::vector<tim::node::result<Tp>>& result_nodes)
655{
656 size_t nnodes = 0;
657 ar(cereal::make_nvp("graph_size", nnodes));
658 result_nodes.resize(nnodes);
659
660 ar.setNextName("graph");
661 ar.startNode();
662 for(auto& itr : result_nodes)
663 {
664 ar.startNode();
665 load(ar, itr);
666 ar.finishNode();
667 }
668 ar.finishNode();
669}
670//
671//--------------------------------------------------------------------------------------//
672//
673template <typename Archive, typename Tp>
674struct specialize<Archive, tim::node::result<Tp>,
675 cereal::specialization::non_member_load_save>
676{};
677//
678} // namespace cereal
679} // namespace tim
680//
681//--------------------------------------------------------------------------------------//
STL namespace.
void load(Archive &ar, tim::node::graph< Tp > &d)
Definition: node.hpp:520
void save(Archive &ar, std::shared_ptr< tim::tsettings< Tp, Tp & > > obj)
Definition: tsettings.hpp:471
hash_value_t add_hash_id(hash_map_ptr_t &_hash_map, string_view_cref_t _prefix)
add an string to the given hash-map (if it doesn't already exist) and return the hash
Definition: types.hpp:190
bool get_hash_identifier(const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id, std::string *&_ret)
return false
Definition: definition.hpp:326
std::tuple< bool, uint64_t, int64_t, idset_type, idset_type, entry_type, entry_type > tree_type
Definition: node.hpp:129
typename trait::statistics< Tp >::type type
Definition: node.hpp:119
std::tuple< bool, uint32_t, uint32_t, uint64_t, int64_t, Tp, stats_type > node_type
Definition: node.hpp:123
std::set< int64_t > idset_type
Definition: node.hpp:126
typename stats_policy::statistics_type stats_type
Definition: node.hpp:121
std::tuple< uint32_t, uint32_t, int64_t, uint64_t, uint64_t, string_t, uintvector_t, Tp, stats_type > result_type
Definition: node.hpp:125
std::vector< uint64_t > uintvector_t
Definition: node.hpp:117
entry< Tp, stats_type > entry_type
Definition: node.hpp:127
std::vector< string_t > strvector_t
Definition: node.hpp:116
std::string string_t
Definition: node.hpp:115
Definition: kokkosp.cpp:39
char const std::string & _prefix
Definition: config.cpp:55
std::string string_t
Definition: utility.hpp:98
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
Declare the storage types.
This data type is used in tim::node::tree for inclusive and exclusive values.
Definition: node.hpp:66
entry(Args &&... args)
Definition: node.hpp:73
entry(const base_type &_obj)
Definition: node.hpp:76
std::tuple< Tp, StatT > base_type
Definition: node.hpp:67
const Tp & data() const
component object with either inclusive or exclusive values
Definition: node.hpp:90
this_type & operator-=(const this_type &rhs)
Definition: node.hpp:102
Tp & data()
component object with either inclusive or exclusive values
Definition: node.hpp:84
this_type & operator+=(const this_type &rhs)
Definition: node.hpp:95
entry(base_type &&_obj) noexcept
Definition: node.hpp:79
StatT & stats()
statistics data with either inclusive or exclusive values
Definition: node.hpp:87
const StatT & stats() const
statistics data with either inclusive or exclusive values
Definition: node.hpp:93
This is the compact representation of a measurement in the call-graph.
Definition: node.hpp:139
static Tp get_dummy()
Definition: node.hpp:445
const auto & hash() const
Definition: node.hpp:211
const int64_t & depth() const
Definition: node.hpp:204
bool operator!=(const graph &rhs) const
Definition: node.hpp:436
int64_t & depth()
depth in call-graph
Definition: node.hpp:192
const Tp & obj() const
Definition: node.hpp:205
typename Tp::base_type data_base_type
Definition: node.hpp:143
stats_type & stats()
statistics data for entry in call-graph
Definition: node.hpp:198
bool & is_dummy()
denotes this is a placeholder for synchronization
Definition: node.hpp:180
const uint32_t & pid() const
Definition: node.hpp:202
auto & hash()
Definition: node.hpp:209
typename Tp::value_type data_value_type
Definition: node.hpp:142
this_type & operator-=(const this_type &rhs)
Definition: node.hpp:171
bool operator==(const graph &rhs) const
Definition: node.hpp:427
~graph()=default
auto & data()
Definition: node.hpp:208
std::string string_t
Definition: node.hpp:145
const bool & is_dummy() const
Definition: node.hpp:200
uint64_t & id()
hash identifer
Definition: node.hpp:189
graph(graph &&) noexcept=default
uint32_t & pid()
process identifier
Definition: node.hpp:186
typename data< Tp >::stats_type stats_type
Definition: node.hpp:144
typename data< Tp >::node_type base_type
Definition: node.hpp:141
const stats_type & stats() const
Definition: node.hpp:206
const uint32_t & tid() const
Definition: node.hpp:201
Tp & obj()
this is the instance that gets updated in call-graph
Definition: node.hpp:195
const uint64_t & id() const
Definition: node.hpp:203
graph(const graph &)=default
uint32_t & tid()
thread identifier
Definition: node.hpp:183
const auto & data() const
Definition: node.hpp:210
This data type is used when rendering the flat representation (i.e. loop-iterable) representation of ...
Definition: node.hpp:223
const uint64_t & id() const
Definition: node.hpp:288
const Tp & obj() const
Definition: node.hpp:289
this_type & operator-=(const this_type &rhs)
Definition: node.hpp:306
int64_t & depth()
depth of the node in the calling-context
Definition: node.hpp:253
uint32_t & pid()
the process identifier of the reporting process, if multiple process data is combined,...
Definition: node.hpp:250
const uint32_t & pid() const
Definition: node.hpp:280
result(const result &)=default
uint64_t & id()
alias for hash()
Definition: node.hpp:274
string_t & prefix()
the associated string with the hash + indentation and other decoration
Definition: node.hpp:262
typename data< Tp >::stats_type stats_type
Definition: node.hpp:226
const int64_t & depth() const
Definition: node.hpp:281
Tp & obj()
alias for data()
Definition: node.hpp:277
uint64_t & hash()
hash identifer of the node
Definition: node.hpp:256
bool operator==(const this_type &rhs) const
Definition: node.hpp:291
const string_t & prefix() const
Definition: node.hpp:284
this_type & operator+=(const this_type &rhs)
Definition: node.hpp:299
const uint64_t & rolling_hash() const
Definition: node.hpp:283
const Tp & data() const
Definition: node.hpp:286
uintvector_t & hierarchy()
an array of the hash value + each parent hash (not serialized)
Definition: node.hpp:265
const stats_type & stats() const
Definition: node.hpp:287
const uintvector_t & hierarchy() const
Definition: node.hpp:285
bool operator!=(const this_type &rhs) const
Definition: node.hpp:297
std::vector< uint64_t > uintvector_t
Definition: node.hpp:224
uint64_t & rolling_hash()
the summation of this hash and it's parent hashes
Definition: node.hpp:259
const uint64_t & hash() const
Definition: node.hpp:282
Tp & data()
reference to the component
Definition: node.hpp:268
uint32_t & tid()
measurement thread. May be std::numeric_limits<uint16_t>max() (i.e. 65536) if this entry is a combina...
Definition: node.hpp:246
typename data< Tp >::result_type base_type
Definition: node.hpp:225
result(result &&) noexcept=default
stats_type & stats()
reference to the associate statistical accumulation of the data (if any)
Definition: node.hpp:271
const uint32_t & tid() const
Definition: node.hpp:279
This data type is used when rendering the hierarchical representation (i.e. requires recursion) repre...
Definition: node.hpp:323
const entry_type & exclusive() const
Definition: node.hpp:401
tree & operator=(const graph< Tp > &)
Definition: node.hpp:479
tree(tree &&) noexcept=default
int64_t & depth()
returns the depth of the node in the tree. NOTE: this value may be relative to dummy nodes
Definition: node.hpp:381
entry_type & inclusive()
the inclusive data + statistics
Definition: node.hpp:390
typename Tp::base_type data_base_type
Definition: node.hpp:327
typename data< Tp >::stats_type stats_type
Definition: node.hpp:328
idset_type & pid()
the set of process ids this data was collected from
Definition: node.hpp:387
const uint64_t & hash() const
Definition: node.hpp:396
tree(const tree &)=default
typename Tp::value_type data_value_type
Definition: node.hpp:326
const idset_type & pid() const
Definition: node.hpp:399
const entry_type & inclusive() const
Definition: node.hpp:400
uint64_t & hash()
returns the hash identifier for the associated string identifier
Definition: node.hpp:377
const bool & is_dummy() const
Definition: node.hpp:395
std::string string_t
Definition: node.hpp:331
idset_type & tid()
the set of thread ids this data was collected from
Definition: node.hpp:384
tree(base_type &&_base) noexcept
this_type & operator-=(const this_type &rhs)
Definition: node.hpp:364
typename data< Tp >::entry_type entry_type
Definition: node.hpp:329
typename data< Tp >::idset_type idset_type
Definition: node.hpp:330
bool & is_dummy()
returns whether or not this node is a synchronization point and, if so, should be ignored
Definition: node.hpp:374
typename data< Tp >::tree_type base_type
Definition: node.hpp:325
entry_type & exclusive()
the exclusive data + statistics
Definition: node.hpp:393
const idset_type & tid() const
Definition: node.hpp:398
static Tp get_dummy()
~tree()=default
const int64_t & depth() const
Definition: node.hpp:397
This class post-processes strings for a given API.
Definition: decode.hpp:49
Specification of how to accumulate statistics. This will not be used unless tim::trait::statistics ha...
Definition: policy.hpp:48
statistics< type > statistics_type
Definition: policy.hpp:52