The Sparta Modeling Framework
Loading...
Searching...
No Matches
StateTimerUnit.hpp
1// <StateTimerUnit> -*- C++ -*-
2
3
4#pragma once
5
8#include "sparta/functional/DataView.hpp"
14#include "sparta/utils/Enum.hpp"
17
18namespace sparta
19{
20
21// type for the shared_ptr of a map of vectors. The map use state_set_hash_code,
22// the vector contains the state_set_delta_ for each StateSet
23typedef std::shared_ptr<std::unordered_map<uint32_t, std::vector<sparta::Clock::Cycle> *>>
24 StateTimerDataContainerPtr;
25
31{
32private:
33 // forward declaration
34 class StateTimerPool;
35
36public:
37
45 {
46 friend class StateTimerPool;
47
48 public:
49
50 typedef uint32_t TimerId;
51 typedef std::shared_ptr<StateTimer> Handle;
52 typedef std::shared_ptr<std::unordered_map<uint32_t, uint32_t>> StateSetInfo;
53
54 ~StateTimer() {}
55
60 template<class EnumClassT>
61 void startState(EnumClassT state_enum)
62 {
63 uint32_t state_set_hash_code;
64 uint32_t state_index;
65 uint32_t active_state_in_set;
66 std::shared_ptr<StateSet> state_set;
67
68 // using state_set_hash_code as state set identifier,
69 // and state_index for state in the set.
70 state_set_hash_code = typeid(EnumClassT).hash_code();
71 state_index = static_cast<uint32_t>(state_enum);
72
73 // find the state set in the timer.
74 auto it = state_set_map_.find(state_set_hash_code);
75 sparta_assert(it != state_set_map_.end(),
76 "Can not find state enum class in timer.");
77 state_set = it->second;
78
79 if (state_set->active_state_index_.isValid())
80 {
81 active_state_in_set = state_set->active_state_index_.getValue();
82 sparta_assert(active_state_in_set != state_index ,
83 "State aleady started");
84 sparta_assert(state_set->active_state_starting_time_ > 0,
85 "Wrong active state starting time.");
86
87 // implicitly update the time delta of the active state in the set, if there is one.
88 endTimerState_(state_set);
89 }
90
91 // set the new state to the active state in set.
92 sparta_assert(state_index < state_set->state_set_delta_.size(),
93 "State enum out of range.")
94 state_set->active_state_index_ = state_index;
95 state_set->active_state_starting_time_ = clk_->currentCycle();
96 }
97
102 template<class EnumClassT>
103 void endState(EnumClassT state_enum)
104 {
105 uint32_t state_set_hash_code;
106 uint32_t state_index;
107 int32_t active_state_in_set;
108 std::shared_ptr<StateSet> state_set;
109
110 // using state_set_hash_code as state set identifier,
111 // and state_index for state in the set.
112 state_set_hash_code = typeid(EnumClassT).hash_code();
113 state_index = static_cast<uint32_t>(state_enum);
114
115 // find the state set in the timer.
116 auto it = state_set_map_.find(state_set_hash_code);
117 sparta_assert(it != state_set_map_.end(),
118 "Can not find state enum class in timer.");
119 state_set = it->second;
120
121 // the end state needs to be the active one
122 sparta_assert(state_set->active_state_index_.isValid() ,
123 "No active state in the set when endState.");
124 active_state_in_set = state_set->active_state_index_.getValue();
125 sparta_assert((uint32_t)active_state_in_set==state_index,
126 "State does not match active state in the set when endState.");
127
128 // end the state
129 endTimerState_(state_set);
130
131 state_set->active_state_index_.clearValid();
132 state_set->active_state_starting_time_ = 0;
133 }
134
135
140 template<class EnumClassT>
141 void operator=(EnumClassT state_enum)
142 {
143 startState(state_enum);
144 }
145
146 private:
147
152 struct StateSet
153 {
154 // The state index for the active state
155 utils::ValidValue<uint32_t> active_state_index_;
156 // The starting time for the active state
157 sparta::Clock::Cycle active_state_starting_time_;
158 // Delta time of all the states
159 std::vector<sparta::Clock::Cycle> state_set_delta_;
160
161 StateSet(uint32_t num_state):
162 active_state_starting_time_(0),
163 state_set_delta_(std::vector<sparta::Clock::Cycle>(num_state, 0))
164 {
165 // Initial active_state_index_ to invalid
166 active_state_index_.clearValid();
167 }
168 };
169
181 StateTimer(const sparta::Clock * clk, TimerId timer_id,
182 StateSetInfo state_set_info_map_ptr,
183 StateTimerUnit * state_timer_unit_ptr):
184 clk_(clk),
185 timer_id_(timer_id),
186 state_timer_unit_ptr_(state_timer_unit_ptr),
187 last_query_time_(0)
188 {
189 // use state_set_info_map_ptr to initial state_set_map_.
190 for (auto it = state_set_info_map_ptr->begin(); it != state_set_info_map_ptr->end(); ++it)
191 {
192 state_set_map_.insert(std::map<uint32_t, std::shared_ptr<StateSet>>::value_type
193 (it->first, std::shared_ptr<StateSet>(new StateSet(it->second))));
194 }
195 }
196
201 void endTimerState_(std::shared_ptr<StateSet> &state_set)
202 {
203 uint32_t active_state_in_set = state_set->active_state_index_.getValue();
204 if (state_set->active_state_starting_time_ > last_query_time_)
205 {
206 state_set->state_set_delta_[active_state_in_set] +=
207 clk_->currentCycle() - state_set->active_state_starting_time_;
208 }
209 else
210 {
211 state_set->state_set_delta_[active_state_in_set] +=
212 clk_->currentCycle() - last_query_time_;
213 }
214 }
215
220 void queryStateTimer_();
221
226 void releaseStateTimer_();
227
232 struct CustomDeleter
233 {
234 public:
235 CustomDeleter(const std::weak_ptr<StateTimerPool> & pool_ptr):
236 state_timer_pool_ptr_(pool_ptr)
237 {}
238
239 void operator()(StateTimer *ptr)
240 {
241 if(!state_timer_pool_ptr_.expired())
242 {
243 ptr->releaseStateTimer_();
244 }
245 }
246 private:
247 std::weak_ptr<StateTimerPool> state_timer_pool_ptr_;
248 };
249
250 // sparta::Clock used to get current time
251 const sparta::Clock * clk_ = nullptr;
252 // The Id of the StateTimer, came from the index in the timer list vector in StateTimerPool
253 TimerId timer_id_;
254 // Pointer to StateTimerUnit, used when query or release
255 StateTimerUnit * state_timer_unit_ptr_;
256 // A map contains all the state sets
257 std::unordered_map<uint32_t, std::shared_ptr<StateSet>> state_set_map_;
258 // last query time used for dynamic query
259 sparta::Clock::Cycle last_query_time_;
260
261 }; // class StateTimer
262
275 template<class... ArgsT>
276 StateTimerUnit(TreeNode * parent,
277 std::string state_timer_unit_name,
278 std::string description,
279 uint32_t num_timer_init,
280 uint32_t lower,
281 uint32_t upper,
282 uint32_t bin_size,
283 ArgsT...state_sets);
284
285 ~StateTimerUnit()
286 {
287 state_timer_pool_ptr_->releaseAllActiveTimer();
288 }
289
294 StateTimer::Handle allocateStateTimer()
295 {
296 return state_timer_pool_ptr_->allocateTimer();
297 }
298
302 std::string dynamicQuery()
303 {
304 state_timer_pool_ptr_->queryAllActiveTimer();
305 return state_timer_histogram_ptr_->getDisplayStringCumulativeAllState();
306 }
307
311 template<class EnumClassT>
312 std::string dynamicQuery(EnumClassT state_enum)
313 {
314 uint32_t state_set_hash_code;
315 uint32_t state_index;
316
317 state_set_hash_code = typeid(EnumClassT).hash_code();
318 state_index = static_cast<uint32_t>(state_enum);
319
320 state_timer_pool_ptr_->queryAllActiveTimer();
321 return state_timer_histogram_ptr_->getDisplayStringCumulativeOneState(state_set_hash_code, state_index);
322 }
323
324private:
325
330 class StateTimerPool
331 {
332 public:
333
344 StateTimerPool(TreeNode * parent,
345 StateTimer::StateSetInfo state_set_info_map_ptr,
346 StateTimerUnit * state_timer_unit_ptr,
347 uint32_t num_state_timer_init);
348
353 StateTimer::Handle allocateTimer()
354 {
355 StateTimer::TimerId timer_id;
356 // check avalability in timer_list
357 if(available_timer_vec_ptr_->size()==0)
358 {
359 // create more time if not exceed MAX_NUM_STATETIMER
360 uint32_t current_num_timer = timer_list_ptr_->size();
361 sparta_assert(current_num_timer < MAX_NUM_STATETIMER,
362 "No timer available, pool exceeds MAX capacity.")
363 std::cout << "Warining: "<< current_num_timer <<
364 " StateTimers are inflight, creating more." << std::endl;
365 for (uint32_t i = current_num_timer; i < current_num_timer + num_state_timer_init_; i++)
366 {
367 timer_list_ptr_->push_back(StateTimer::Handle
368 (new StateTimer(clk_, i, state_set_info_map_ptr_, state_timer_unit_ptr_)));
369 available_timer_vec_ptr_->push_back(std::make_pair(i, timer_list_ptr_->at(i)));
370 }
371 sparta_assert(current_num_timer + num_state_timer_init_ == timer_list_ptr_->size(),
372 "Number of Timers created does not add up.")
373 }
374
375 timer_id = available_timer_vec_ptr_->back().first;
376 active_timer_map_ptr_->insert(std::map<StateTimer::TimerId, StateTimer::Handle>::value_type
377 (timer_id, available_timer_vec_ptr_->back().second));
378 available_timer_vec_ptr_->pop_back();
379 sparta_assert(active_timer_map_ptr_->size() + available_timer_vec_ptr_->size()
380 == timer_list_ptr_->size(), "Number of Timers does not add up.")
381 return StateTimer::Handle(timer_list_ptr_->at(timer_id).get(), StateTimer::CustomDeleter(my_life_));
382 }
383
388 void releaseTimer(StateTimer::TimerId timer_id)
389 {
390 // check it should be in the active timer map
391 auto it = active_timer_map_ptr_->find(timer_id);
392 sparta_assert(it != active_timer_map_ptr_->end(),
393 "Timer not in active timer map when release. ");
394 available_timer_vec_ptr_->push_back(std::make_pair(timer_id, it->second));
395 active_timer_map_ptr_->erase(it);
396 sparta_assert(active_timer_map_ptr_->size() + available_timer_vec_ptr_->size()
397 == timer_list_ptr_->size(), "Number of Timers does not add up.")
398 }
399
403 void queryAllActiveTimer();
404
408 void releaseAllActiveTimer();
409
410 private:
411
412 // pointer to a vector of all StateTimer
413 std::unique_ptr<std::vector<StateTimer::Handle>> timer_list_ptr_;
414 // pointer to a map of active StateTimer: <timer_id, StateTimer pointer>
415 std::unique_ptr<std::unordered_map<StateTimer::TimerId, StateTimer::Handle>>
416 active_timer_map_ptr_;
417 // pointer to a vector of available StateTimer: <timer_id, StateTimer pointer>
418 std::unique_ptr<std::vector<std::pair<StateTimer::TimerId, StateTimer::Handle>>>
419 available_timer_vec_ptr_;
420 // A shared_ptr point to it self, used to track its life time
421 std::shared_ptr<StateTimerPool> my_life_;
422 // Initial number of total StateTimers in pool, used as incremental interval
423 uint32_t num_state_timer_init_;
424 // A map uses the state set hash_code, contains the number of state in the set
425 StateTimer::StateSetInfo state_set_info_map_ptr_;
426 // sparta::Clock used to get current time
427 const sparta::Clock * clk_ = nullptr;
428 // Pointer to StateTimerUnit, used when query or release
429 StateTimerUnit * state_timer_unit_ptr_;
430 // Max number of StateTimers in pool
431 const uint32_t MAX_NUM_STATETIMER = 10000;
432
433 }; // class StateTimerPool
434
439 class StateTimerHistogram
440 {
441 public:
442
458 StateTimerHistogram(TreeNode * parent,
459 std::string state_timer_unit_name,
460 std::unordered_map<uint32_t, std::string> state_set_name_map,
461 StateTimerDataContainerPtr state_timer_data_container_ptr,
462 StateTimer::StateSetInfo state_set_info_map_ptr,
463 uint32_t lower, uint32_t upper, uint32_t bin_size):
464 state_timer_data_container_ptr_(state_timer_data_container_ptr)
465 {
466 // use state_set_info_map_ptr to initial timer_histogram_map_, they have the same states.
467 for (auto it = state_set_info_map_ptr->begin(); it != state_set_info_map_ptr->end(); ++it)
468 {
469 std::shared_ptr<std::vector<std::shared_ptr<sparta::Histogram>>>
470 histogram_vector(new std::vector<std::shared_ptr<sparta::Histogram>>);
471 for (uint32_t i = 0; i < it->second; i++)
472 {
473 histogram_vector->push_back(std::shared_ptr<sparta::Histogram>
474 (new sparta::Histogram(parent,
475 state_timer_unit_name + "_histogram_set_" + state_set_name_map[it->first] +
476 "_state_" + std::to_string(i), "state timer histogram" ,
477 /*lower*/ lower, /*upper*/ upper , /*bin size*/ bin_size)));
478 }
479 timer_histogram_map_.insert(std::unordered_map<uint32_t,
480 std::shared_ptr<std::vector<std::shared_ptr<sparta::Histogram>>>>::value_type
481 (it->first, histogram_vector));
482 }
483 }
484
488 void updateHistogram()
489 {
490 for (auto it = timer_histogram_map_.begin(); it != timer_histogram_map_.end(); ++it)
491 {
492 for (uint32_t i = 0; i < it->second->size(); i++)
493 {
494 // add the delta of each state in the container to histogram, then reset the container.
495 // Since the container has the pointers to the timer, this will actually reset the timer.
496 (*it->second)[i]->addValue((*(*state_timer_data_container_ptr_)[it->first])[i]);
497 (*(*state_timer_data_container_ptr_)[it->first])[i] = 0;
498 }
499 }
500 }
501
505 std::string getDisplayStringCumulativeAllState()
506 {
507 std::string histogram_string = "";
508 for (auto it = timer_histogram_map_.begin(); it != timer_histogram_map_.end(); ++it)
509 {
510 for (uint32_t i = 0; i < it->second->size(); i++)
511 {
512 histogram_string += (*it->second)[i]->getDisplayStringCumulative();
513 }
514 }
515 return histogram_string;
516 }
517
521 std::string getDisplayStringCumulativeOneState(uint32_t state_set_hash_code, uint32_t state_index)
522 {
523 std::string histogram_string = "";
524 auto it = timer_histogram_map_.find(state_set_hash_code);
525 sparta_assert(it != timer_histogram_map_.end(),
526 "Can not find state enum class in histogram map.");
527 histogram_string = (*it->second)[state_index]->getDisplayStringCumulative();
528 return histogram_string;
529 }
530
531 private:
532 // A map of sparta::Histogram, using the hash_code of each state set (enum class), each set has
533 // a vector of sparta::Histogram, each of them represent a state in the set.
534 std::unordered_map<uint32_t, std::shared_ptr<std::vector<std::shared_ptr<sparta::Histogram>>>>
535 timer_histogram_map_;
536 // A pointer to the container used for updating the histograms
537 StateTimerDataContainerPtr state_timer_data_container_ptr_;
538 }; // class StateTimerHistogram
539
545 template<class ArgsHeadT, class... ArgsTailT>
546 void addStateSet_(ArgsHeadT state_sets_head, ArgsTailT... state_sets_tail)
547 {
548 uint32_t state_set_hash_code = typeid(state_sets_head).hash_code();
549 uint32_t num_state = static_cast<uint32_t>(state_sets_head);
550 sparta_assert(state_set_info_map_ptr_->find(state_set_hash_code) == state_set_info_map_ptr_->end(),
551 "Same enum class exists.");
552 state_set_info_map_ptr_->insert(std::unordered_map<uint32_t,uint32_t>::value_type
553 (state_set_hash_code, num_state));
554 // using typeid().name() as state set name for now
555 state_set_name_map_.insert(std::unordered_map<uint32_t, std::string>::value_type
556 (state_set_hash_code, typeid(state_sets_head).name()));
557
558 addStateSet_(state_sets_tail...);
559 }
560
561 void addStateSet_()
562 {}
563
570 void updateStateHistogram_(StateTimer::TimerId timer_id, bool is_release_timer)
571 {
572 // update the histogram
573 state_timer_histogram_ptr_->updateHistogram();
574 // release timer if needed
575 if (is_release_timer)
576 {
577 state_timer_pool_ptr_->releaseTimer(timer_id);
578 }
579 }
580
585 StateTimerDataContainerPtr getStateTimerInfoContainer_()
586 {
587 return state_timer_data_container_ptr_;
588 }
589
590 // The pointer to the container
591 StateTimerDataContainerPtr state_timer_data_container_ptr_;
592 // A map uses the state set hash_code, contains the number of state in the set
593 StateTimer::StateSetInfo state_set_info_map_ptr_;
594 // The pointer to StateTimerPool
595 std::unique_ptr<StateTimerPool> state_timer_pool_ptr_;
596 // The pointer to StateTimerHistogram
597 std::unique_ptr<StateTimerHistogram> state_timer_histogram_ptr_;
598 // A map uses the state set hash_code, contains the name string of each set
599 std::unordered_map<uint32_t, std::string> state_set_name_map_;
600
601}; // class StateTimerUnit
602
607inline void StateTimerUnit::StateTimer::queryStateTimer_()
608{
609 // already queried in the same cycle, should not update the timer and histogram again
610 if (last_query_time_ == clk_->currentCycle())
611 return;
612 std::shared_ptr<StateTimerUnit::StateTimer::StateSet> state_set;
613 // get the container pointer
614 StateTimerDataContainerPtr
615 timer_info_container = state_timer_unit_ptr_->getStateTimerInfoContainer_();
616 // put the address of state_set_delta_ vector of each state set in the container
617 for (auto it=state_set_map_.begin(); it!=state_set_map_.end(); ++it)
618 {
619 // update the time delta if there is active state
620 state_set = it->second;
621 if (state_set->active_state_index_.isValid())
622 {
623 sparta_assert(clk_->currentCycle() >= state_set->active_state_starting_time_,
624 "Wrong timing: current cycle less than state start time");
625
626 // do not reset active state since this is query,
627 // state_set_delta_ will be reset after the the histograms are updated
628 endTimerState_(state_set);
629 }
630 (*timer_info_container)[it->first] = & state_set->state_set_delta_;
631 }
632 // let StateTimerUnit know when the container is ready,
633 // "false" in updateStateHistogram_() means do not release timer
634 state_timer_unit_ptr_->updateStateHistogram_(timer_id_, false);
635 last_query_time_ = clk_->currentCycle();
636}
637
642inline void StateTimerUnit::StateTimer::releaseStateTimer_()
643{
644 std::shared_ptr<StateTimerUnit::StateTimer::StateSet> state_set;
645 // get the container pointer
646 StateTimerDataContainerPtr
647 timer_info_container = state_timer_unit_ptr_->getStateTimerInfoContainer_();
648 // put the address of state_set_delta_ vector of each state set in the container
649 for (auto it=state_set_map_.begin(); it!=state_set_map_.end(); ++it)
650 {
651 // update the time delta if there is active state
652 state_set = it->second;
653 if (state_set->active_state_index_.isValid())
654 {
655 sparta_assert(clk_->currentCycle() >= state_set->active_state_starting_time_,
656 "Wrong timing: current cycle less than state start time");
657
658 // end the active state,
659 // state_set_delta_ will be reset after the the histograms are updated
660 endTimerState_(state_set);
661
662 state_set->active_state_index_.clearValid();
663 state_set->active_state_starting_time_ = 0;
664 }
665 (*timer_info_container)[it->first] = & state_set->state_set_delta_;
666 }
667 // let StateTimerUnit know when the container is ready,
668 // "true" in updateStateHistogram_() means release timer
669 state_timer_unit_ptr_->updateStateHistogram_(timer_id_, true);
670}
671
675inline void StateTimerUnit::StateTimerPool::queryAllActiveTimer()
676{
677 // query all the active timer in pool
678 for (auto it=active_timer_map_ptr_->begin(); it!=active_timer_map_ptr_->end(); ++it)
679 {
680 it->second->queryStateTimer_();
681 }
682}
683
687inline void StateTimerUnit::StateTimerPool::releaseAllActiveTimer()
688{
689 // release all the active timer in pool
690 while (active_timer_map_ptr_->size()>0)
691 {
692 auto it= active_timer_map_ptr_->begin();
693 it->second->releaseStateTimer_();
694 }
695}
696
708inline StateTimerUnit::StateTimerPool::StateTimerPool(TreeNode * parent,
709 StateTimerUnit::StateTimer::StateSetInfo state_set_info_map_ptr,
710 StateTimerUnit * state_timer_unit_ptr, uint32_t num_state_timer_init):
711 timer_list_ptr_(new std::vector<StateTimerUnit::StateTimer::Handle>),
712 active_timer_map_ptr_(new std::unordered_map<StateTimerUnit::StateTimer::TimerId,
713 StateTimerUnit::StateTimer::Handle>),
714 available_timer_vec_ptr_(new std::vector<std::pair<StateTimerUnit::StateTimer::TimerId,
715 StateTimerUnit::StateTimer::Handle>>),
716 my_life_(this, [](void*){}),
717 num_state_timer_init_(num_state_timer_init),
718 state_set_info_map_ptr_(state_set_info_map_ptr),
719 clk_(parent->getClock()),
720 state_timer_unit_ptr_(state_timer_unit_ptr)
721{
722 for (uint32_t i = 0; i < num_state_timer_init_; i++)
723 {
724 timer_list_ptr_->push_back(StateTimerUnit::StateTimer::Handle
725 (new StateTimerUnit::StateTimer(clk_, i, state_set_info_map_ptr_,
726 state_timer_unit_ptr_)));
727 available_timer_vec_ptr_->push_back(std::make_pair(i, timer_list_ptr_->at(i)));
728 }
729}
730
744template<class... ArgsT>
746 std::string state_timer_unit_name,
747 std::string description,
748 uint32_t num_timer_init,
749 uint32_t lower, /*lower value of histogram*/
750 uint32_t upper, /*upper value of histogram*/
751 uint32_t bin_size, /*bin size of histogram*/
752 ArgsT...state_sets):
753 TreeNode(state_timer_unit_name, description)
754{
755 setExpectedParent_(parent);
756 if(parent != nullptr)
757 {
758 parent->addChild(this);
759 }
760 state_timer_data_container_ptr_ = StateTimerDataContainerPtr
761 (new std::unordered_map<uint32_t, std::vector<sparta::Clock::Cycle> *>);
762 state_set_info_map_ptr_ = StateTimerUnit::StateTimer::StateSetInfo
763 (new std::unordered_map<uint32_t, uint32_t>);
764 static_assert(sizeof...(state_sets)>0,
765 "At least one state enum set need to be provided.");
766 addStateSet_(state_sets...);
767 state_timer_pool_ptr_ = std::unique_ptr<StateTimerPool>
768 (new StateTimerPool(parent, state_set_info_map_ptr_, this, num_timer_init));
769 state_timer_histogram_ptr_ = std::unique_ptr<StateTimerHistogram>
770 (new StateTimerHistogram(parent->getChild(state_timer_unit_name),
771 state_timer_unit_name, state_set_name_map_,
772 state_timer_data_container_ptr_, state_set_info_map_ptr_,
773 lower, upper, bin_size));
774}
775
776} // namespace sparta
777
Byte order types and byte-swapping routines.
File that defines the Clock class.
HistogramEnum implementation using sparta Counters.
Histogram implementation using sparta Counters.
Virtual interface node for simulator instrumentation (e.g. counters, stats, nontifications).
Set of macros for Sparta assertions. Caught by the framework.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
Exception class for all of Sparta.
Basic Node framework in sparta device tree composite pattern.
File that defines a ValidValue.
A representation of simulated time.
Definition Clock.hpp:51
Cycle currentCycle() const
Get the current cycle (uses current tick from the Scheduler)
Definition Clock.hpp:176
The timer that user can access to start/end tracking state. A StateTimer::Handle is returned from Sta...
void endState(EnumClassT state_enum)
End timing state.
void startState(EnumClassT state_enum)
Start timing state.
void operator=(EnumClassT state_enum)
Assignment for starting a state in the timer.
A high level wrapper contains the StateTimerPool and StateTimerHistogram.
StateTimerUnit(TreeNode *parent, std::string state_timer_unit_name, std::string description, uint32_t num_timer_init, uint32_t lower, uint32_t upper, uint32_t bin_size, ArgsT...state_sets)
StateTimerUnit constructor.
StateTimer::Handle allocateStateTimer()
Allocate a StateTimer, used by user.
std::string dynamicQuery(EnumClassT state_enum)
Dynamically query one state of all timers, histograms will be updated, used by user.
std::string dynamicQuery()
Dynamically query the timers, histograms will be updated, used by user.
Node in a composite tree representing a sparta Tree item.
Definition TreeNode.hpp:205
TreeNode()=delete
Not default-constructable.
void addChild(TreeNode *child, bool inherit_phase=true)
Adds a TreeNode to this node as a child.
TreeNode * getChild(const std::string &name, bool must_exist=true)
Retrieves a child with this dotted path name.
void setExpectedParent_(const TreeNode *parent)
Tracks a node as an expected parent without actually adding this node as a child. This is used almost...
Provides a wrapper around a value to ensure that the value is assigned.
void clearValid()
Clear the validity of this object.
Macros for handling exponential backoff.