]> Git Repo - linux.git/blobdiff - tools/perf/util/parse-events.c
perf_counter tools: Define separate declarations for H/W and S/W events
[linux.git] / tools / perf / util / parse-events.c
index 9d5f1ca50e6fe4fc8466f3d97f8051a1e39253f2..12abab3a0d63196a50a37a88f0df791c33c397af 100644 (file)
@@ -13,35 +13,35 @@ int                                 nr_counters;
 struct perf_counter_attr               attrs[MAX_COUNTERS];
 
 struct event_symbol {
-       __u8    type;
-       __u64   config;
+       u8      type;
+       u64     config;
        char    *symbol;
 };
 
-#define C(x, y) .type = PERF_TYPE_##x, .config = PERF_COUNT_##y
-#define CR(x, y) .type = PERF_TYPE_##x, .config = y
+#define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x
+#define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x
 
 static struct event_symbol event_symbols[] = {
-  { C(HARDWARE, HW_CPU_CYCLES),                "cpu-cycles",           },
-  { C(HARDWARE, HW_CPU_CYCLES),                "cycles",               },
-  { C(HARDWARE, HW_INSTRUCTIONS),      "instructions",         },
-  { C(HARDWARE, HW_CACHE_REFERENCES),  "cache-references",     },
-  { C(HARDWARE, HW_CACHE_MISSES),      "cache-misses",         },
-  { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branch-instructions", },
-  { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branches",            },
-  { C(HARDWARE, HW_BRANCH_MISSES),     "branch-misses",        },
-  { C(HARDWARE, HW_BUS_CYCLES),                "bus-cycles",           },
-
-  { C(SOFTWARE, SW_CPU_CLOCK),         "cpu-clock",            },
-  { C(SOFTWARE, SW_TASK_CLOCK),                "task-clock",           },
-  { C(SOFTWARE, SW_PAGE_FAULTS),       "page-faults",          },
-  { C(SOFTWARE, SW_PAGE_FAULTS),       "faults",               },
-  { C(SOFTWARE, SW_PAGE_FAULTS_MIN),   "minor-faults",         },
-  { C(SOFTWARE, SW_PAGE_FAULTS_MAJ),   "major-faults",         },
-  { C(SOFTWARE, SW_CONTEXT_SWITCHES),  "context-switches",     },
-  { C(SOFTWARE, SW_CONTEXT_SWITCHES),  "cs",                   },
-  { C(SOFTWARE, SW_CPU_MIGRATIONS),    "cpu-migrations",       },
-  { C(SOFTWARE, SW_CPU_MIGRATIONS),    "migrations",           },
+  { CHW(CPU_CYCLES),           "cpu-cycles",           },
+  { CHW(CPU_CYCLES),           "cycles",               },
+  { CHW(INSTRUCTIONS),         "instructions",         },
+  { CHW(CACHE_REFERENCES),     "cache-references",     },
+  { CHW(CACHE_MISSES),         "cache-misses",         },
+  { CHW(BRANCH_INSTRUCTIONS),  "branch-instructions",  },
+  { CHW(BRANCH_INSTRUCTIONS),  "branches",             },
+  { CHW(BRANCH_MISSES),                "branch-misses",        },
+  { CHW(BUS_CYCLES),           "bus-cycles",           },
+
+  { CSW(CPU_CLOCK),            "cpu-clock",            },
+  { CSW(TASK_CLOCK),           "task-clock",           },
+  { CSW(PAGE_FAULTS),          "page-faults",          },
+  { CSW(PAGE_FAULTS),          "faults",               },
+  { CSW(PAGE_FAULTS_MIN),      "minor-faults",         },
+  { CSW(PAGE_FAULTS_MAJ),      "major-faults",         },
+  { CSW(CONTEXT_SWITCHES),     "context-switches",     },
+  { CSW(CONTEXT_SWITCHES),     "cs",                   },
+  { CSW(CPU_MIGRATIONS),       "cpu-migrations",       },
+  { CSW(CPU_MIGRATIONS),       "migrations",           },
 };
 
 #define __PERF_COUNTER_FIELD(config, name) \
@@ -63,8 +63,8 @@ static char *hw_event_names[] = {
 };
 
 static char *sw_event_names[] = {
-       "cpu-clock-ticks",
-       "task-clock-ticks",
+       "cpu-clock-msecs",
+       "task-clock-msecs",
        "page-faults",
        "context-switches",
        "CPU-migrations",
@@ -75,7 +75,7 @@ static char *sw_event_names[] = {
 #define MAX_ALIASES 8
 
 static char *hw_cache [][MAX_ALIASES] = {
-       { "L1-data"             , "l1-d", "l1d", "l1"                           },
+       { "L1-data"             , "l1-d", "l1d"                                 },
        { "L1-instruction"      , "l1-i", "l1i"                                 },
        { "L2"                  , "l2"                                          },
        { "Data-TLB"            , "dtlb", "d-tlb"                               },
@@ -96,7 +96,7 @@ static char *hw_cache_result [][MAX_ALIASES] = {
 
 char *event_name(int counter)
 {
-       __u64 config = attrs[counter].config;
+       u64 config = attrs[counter].config;
        int type = attrs[counter].type;
        static char buf[32];
 
@@ -112,7 +112,7 @@ char *event_name(int counter)
                return "unknown-hardware";
 
        case PERF_TYPE_HW_CACHE: {
-               __u8 cache_type, cache_op, cache_result;
+               u8 cache_type, cache_op, cache_result;
                static char name[100];
 
                cache_type   = (config >>  0) & 0xff;
@@ -202,7 +202,7 @@ static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *a
  */
 static int parse_event_symbols(const char *str, struct perf_counter_attr *attr)
 {
-       __u64 config, id;
+       u64 config, id;
        int type;
        unsigned int i;
        const char *sep, *pstr;
This page took 0.036143 seconds and 4 git commands to generate.