MCPcopy Create free account
hub / github.com/MJx0/KittyMemoryEx / pollOnce

Method pollOnce

KittyMemoryEx/KittyPerfEvent.cpp:192–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void KittyPerfWatch::pollOnce(int timeout_ms, KittyPerfSample *out)
193{
194 if (_watches.empty())
195 return;
196
197 std::vector<pollfd> pfds;
198 pfds.reserve(_watches.size());
199
200 for (auto &w : _watches)
201 pfds.push_back({w.fd, POLLIN, 0});
202
203 int ret = ::poll(pfds.data(), pfds.size(), timeout_ms);
204 if (ret <= 0)
205 return;
206
207 for (size_t i = 0; i < pfds.size(); ++i)
208 {
209 if (pfds[i].revents & POLLIN)
210 {
211 consumeRecord(_watches[i], out);
212 }
213 }
214}
215
216void KittyPerfWatch::poll(int timeout_ms, const std::function<bool(const KittyPerfSample &)> &cb)
217{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected