18 #ifndef ION_PROFILE_TIMELINESEARCH_H_
19 #define ION_PROFILE_TIMELINESEARCH_H_
29 typedef std::function<bool(const TimelineNode*)>
Predicate;
41 const std::string& node_name);
49 const std::string& node_name, uint32 begin, uint32 end);
72 const_iterator
begin()
const;
73 const_iterator
end()
const;
84 }
while (iter_ != search_results_->
timeline().
end() &&
91 : iter_(iter), search_results_(search_results) {}
95 return (iter_ == other.iter_) && (search_results_ == other.search_results_);
100 return !(*
this == other);
105 : timeline_(timeline),
107 return node->GetType() == node_type;
112 const std::string& node_name)
113 : timeline_(timeline),
115 return node->GetType() == node_type && node->GetName() == node_name;
120 uint32 begin, uint32 end)
121 : timeline_(timeline),
123 return node->GetType() == node_type && node->GetBegin() >= begin &&
124 node->GetEnd() <= end;
129 const std::string& node_name,
130 uint32 begin, uint32 end)
131 : timeline_(timeline),
133 return node->GetType() == node_type && node->GetName() == node_name &&
134 node->GetBegin() >= begin && node->GetEnd() <=
end;
139 : timeline_(timeline),
148 : timeline_(timeline),
predicate_(predicate) {}
151 auto iter = timeline_.
begin();
152 while (iter != timeline_.
end() && !predicate_(*iter)) {
162 #endif // ION_PROFILE_TIMELINESEARCH_H_
Traverses the hierarchy in pre-order.
const ion::port::ThreadId & GetThreadId() const
const_iterator end() const
Returns a const iterator to the end of the timeline.
Copyright 2016 Google Inc.
const_iterator begin() const
Returns a const iterator over the timeline. The root node is skipped.
Copyright 2016 Google Inc.
const_iterator end() const
Search all nodes in a timeline that match a predicate.
const Timeline & timeline() const
TimelineSearch(const Timeline &timeline, TimelineNode::Type node_type)
Searches nodes by type.
const_iterator begin() const
const Predicate & predicate() const
std::function< bool(const TimelineNode *)> Predicate
Copyright 2016 Google Inc.
Copyright 2016 Google Inc.
bool operator!=(const const_iterator &other) const
const_iterator operator++()
const_iterator(Timeline::const_iterator iter, const TimelineSearch *search)
pthread_t ThreadId
Defines a type that can be used to identify a thread.
predicate_([node_type, begin, end](const TimelineNode *node){return node->GetType()==node_type &&node->GetBegin() >=begin &&node->GetEnd()<=end;})
bool operator==(const const_iterator &other) const
const TimelineNode * operator*() const