#define SIMPLE_PERF_EVENT_H_
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
// the event type is supported by the kernel.
struct EventType {
- bool IsSupportedByKernel() const;
+ EventType(const std::string& name, uint32_t type, uint64_t config)
+ : name(name), type(type), config(config) {
+ }
- const char* name;
+ EventType() : type(0), config(0) {
+ }
+
+ std::string name;
uint32_t type;
uint64_t config;
};
-class EventTypeFactory {
- public:
- static const std::vector<const EventType>& GetAllEventTypes();
- static const EventType* FindEventTypeByName(const std::string& name,
- bool report_unsupported_type = true);
- static const EventType* FindEventTypeByConfig(uint32_t type, uint64_t config);
+const std::vector<EventType>& GetAllEventTypes();
+const EventType* FindEventTypeByConfig(uint32_t type, uint64_t config);
+const EventType* FindEventTypeByName(const std::string& name);
+
+struct EventTypeAndModifier {
+ std::string name;
+ EventType event_type;
+ std::string modifier;
+ bool exclude_user;
+ bool exclude_kernel;
+ bool exclude_hv;
+ bool exclude_host;
+ bool exclude_guest;
+ int precise_ip : 2;
+
+ EventTypeAndModifier()
+ : exclude_user(false),
+ exclude_kernel(false),
+ exclude_hv(false),
+ exclude_host(false),
+ exclude_guest(false),
+ precise_ip(0) {
+ }
};
+std::unique_ptr<EventTypeAndModifier> ParseEventType(const std::string& event_type_str);
+
#endif // SIMPLE_PERF_EVENT_H_