コード例 #1
0
static void PrintEventTypesOfType(uint32_t type, const std::string& type_name,
                                  const std::vector<EventType>& event_types) {
  printf("List of %s:\n", type_name.c_str());
  for (auto& event_type : event_types) {
    if (event_type.type == type &&
        IsEventAttrSupportedByKernel(CreateDefaultPerfEventAttr(event_type))) {
      printf("  %s\n", event_type.name.c_str());
    }
  }
  printf("\n");
}
static void PrintEventTypesOfType(uint32_t type, const std::string& type_name,
                                  const std::vector<EventType>& event_types) {
  printf("List of %s:\n", type_name.c_str());
  for (auto& event_type : event_types) {
    if (event_type.type == type) {
      perf_event_attr attr = CreateDefaultPerfEventAttr(event_type);
      // Exclude kernel to list supported events even when
      // /proc/sys/kernel/perf_event_paranoid is 2.
      attr.exclude_kernel = 1;
      if (IsEventAttrSupportedByKernel(attr)) {
        printf("  %s\n", event_type.name.c_str());
      }
    }
  }
  printf("\n");
}