| 190 | } |
| 191 | |
| 192 | void 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 | |
| 216 | void KittyPerfWatch::poll(int timeout_ms, const std::function<bool(const KittyPerfSample &)> &cb) |
| 217 | { |
nothing calls this directly
no outgoing calls
no test coverage detected