diff options
Diffstat (limited to 'simpleperf/event_fd.h')
-rw-r--r-- | simpleperf/event_fd.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/simpleperf/event_fd.h b/simpleperf/event_fd.h index 96286fb3..1fc97134 100644 --- a/simpleperf/event_fd.h +++ b/simpleperf/event_fd.h @@ -24,8 +24,17 @@ #include <base/macros.h> +#include "perf_event.h" + class EventAttr; +struct PerfCounter { + uint64_t value; // The value of the event specified by the perf_event_file. + uint64_t time_enabled; // The enabled time. + uint64_t time_running; // The running time. + uint64_t id; // The id of the perf_event_file. +}; + // EventFd represents an opened perf_event_file. class EventFd { public: @@ -44,6 +53,8 @@ class EventFd { // It tells the kernel to stop counting and recording events specified by this file. bool DisableEvent(); + bool ReadCounter(PerfCounter* counter); + private: EventFd(int perf_event_fd, const std::string& event_name, pid_t pid, int cpu) : perf_event_fd_(perf_event_fd), event_name_(event_name), pid_(pid), cpu_(cpu) { |