| 123 | } |
| 124 | |
| 125 | void reset() { |
| 126 | if (m_err || !useCounters()) return; |
| 127 | init_if_not(); |
| 128 | extra = 0; |
| 129 | if (m_fd > 0) { |
| 130 | if (ioctl (m_fd, PERF_EVENT_IOC_RESET, 0) < 0) { |
| 131 | // Logger::Warning("perf_event failed to reset with: %s", |
| 132 | // folly::errnoStr(errno).c_str()); |
| 133 | m_err = -1; |
| 134 | return; |
| 135 | } |
| 136 | auto ret = ::read(m_fd, reset_values, sizeof(reset_values)); |
| 137 | if (ret != sizeof(reset_values)) { |
| 138 | // Logger::Warning("perf_event failed to reset with: %s", |
| 139 | // folly::errnoStr(errno).c_str()); |
| 140 | m_err = -1; |
| 141 | return; |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | public: |
| 147 | std::string m_desc; |
nothing calls this directly
no test coverage detected