MCPcopy Create free account
hub / github.com/GlobedGD/globed2 / updateWithFrame

Method updateWithFrame

src/ui/game/ProfilerOverlay.cpp:105–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void ProfilerOverlay::updateWithFrame(const ProfilerFrame& frame) {
106 // log::debug("Add new frame (time {}):", frame.totalTime);
107 // for (auto& s : frame.samples) {
108 // log::debug("- {}: {}", s.name, s.time);
109 // }
110
111 m_frames.emplace_back(Instant::now(), frame);
112
113 // keep last 2 seconds of data in the graph
114 auto cutoff = Instant::now() - Duration::fromSecs(2);
115
116 while (!m_frames.empty()) {
117 auto& [time, _] = m_frames.front();
118 if (time < cutoff) {
119 m_frames.pop_front();
120 } else {
121 break;
122 }
123 }
124
125 for (auto& sample : frame.samples) {
126 if (m_legendNames.insert(sample.name).second) {
127 this->addNewEntryToLegend(sample.name, sample.color);
128 }
129 }
130}
131
132void ProfilerOverlay::addNewEntryToLegend(std::string_view name, cocos2d::ccColor4F color) {
133 auto container = Build<RowContainer>::create()

Callers 1

selPostUpdateMethod · 0.80

Calls 3

addNewEntryToLegendMethod · 0.95
emptyMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected