From: Adrian Hunter <adrian.hun...@intel.com>

Instruction Tracing uses a new perf_event_attr member
named itrace_config.  Add support for parsing pmu format
values and term types based on itrace_config.

Signed-off-by: Adrian Hunter <adrian.hun...@intel.com>
---
 tools/perf/util/parse-events.c | 4 ++++
 tools/perf/util/parse-events.h | 1 +
 tools/perf/util/parse-events.l | 1 +
 tools/perf/util/pmu.c          | 3 +++
 tools/perf/util/pmu.h          | 1 +
 tools/perf/util/pmu.l          | 1 +
 tools/perf/util/pmu.y          | 9 ++++++++-
 7 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 464dafd..d494a5a 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -576,6 +576,10 @@ do {                                                       
        \
        case PARSE_EVENTS__TERM_TYPE_NAME:
                CHECK_TYPE_VAL(STR);
                break;
+       case PARSE_EVENTS__TERM_TYPE_ITRACE_CONFIG:
+               CHECK_TYPE_VAL(NUM);
+               attr->itrace_config = term->val.num;
+               break;
        default:
                return -EINVAL;
        }
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index f1cb4c4..86a2721 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -49,6 +49,7 @@ enum {
        PARSE_EVENTS__TERM_TYPE_NAME,
        PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
        PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
+       PARSE_EVENTS__TERM_TYPE_ITRACE_CONFIG,
 };
 
 struct parse_events_term {
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 3432995..85106c4 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -133,6 +133,7 @@ config2                     { return term(yyscanner, 
PARSE_EVENTS__TERM_TYPE_CONFIG2); }
 name                   { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NAME); 
}
 period                 { return term(yyscanner, 
PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); }
 branch_type            { return term(yyscanner, 
PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); }
+itrace_config          { return term(yyscanner, 
PARSE_EVENTS__TERM_TYPE_ITRACE_CONFIG); }
 ,                      { return ','; }
 "/"                    { BEGIN(INITIAL); return '/'; }
 {name_minus}           { return str(yyscanner, PE_NAME); }
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index c6c240f..e308dfe 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -547,6 +547,9 @@ static int pmu_config_term(struct list_head *formats,
        case PERF_PMU_FORMAT_VALUE_CONFIG2:
                vp = &attr->config2;
                break;
+       case PERF_PMU_FORMAT_VALUE_ITRACE_CONFIG:
+               vp = &attr->itrace_config;
+               break;
        default:
                return -EINVAL;
        }
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index d5266d1..52e4d30 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -9,6 +9,7 @@ enum {
        PERF_PMU_FORMAT_VALUE_CONFIG,
        PERF_PMU_FORMAT_VALUE_CONFIG1,
        PERF_PMU_FORMAT_VALUE_CONFIG2,
+       PERF_PMU_FORMAT_VALUE_ITRACE_CONFIG,
 };
 
 #define PERF_PMU_FORMAT_BITS 64
diff --git a/tools/perf/util/pmu.l b/tools/perf/util/pmu.l
index a15d9fb..c94ee8cd 100644
--- a/tools/perf/util/pmu.l
+++ b/tools/perf/util/pmu.l
@@ -29,6 +29,7 @@ num_dec         [0-9]+
 config         { return PP_CONFIG; }
 config1                { return PP_CONFIG1; }
 config2                { return PP_CONFIG2; }
+itrace_config  { return PP_ITRACE_CONFIG; }
 -              { return '-'; }
 :              { return ':'; }
 ,              { return ','; }
diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
index bfd7e85..caa190e 100644
--- a/tools/perf/util/pmu.y
+++ b/tools/perf/util/pmu.y
@@ -20,7 +20,7 @@ do { \
 
 %}
 
-%token PP_CONFIG PP_CONFIG1 PP_CONFIG2
+%token PP_CONFIG PP_CONFIG1 PP_CONFIG2 PP_ITRACE_CONFIG
 %token PP_VALUE PP_ERROR
 %type <num> PP_VALUE
 %type <bits> bit_term
@@ -60,6 +60,13 @@ PP_CONFIG2 ':' bits
                                      PERF_PMU_FORMAT_VALUE_CONFIG2,
                                      $3));
 }
+|
+PP_ITRACE_CONFIG ':' bits
+{
+       ABORT_ON(perf_pmu__new_format(format, name,
+                                     PERF_PMU_FORMAT_VALUE_ITRACE_CONFIG,
+                                     $3));
+}
 
 bits:
 bits ',' bit_term
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to