Mesa (master): intel/perf: emit counter units in generated code

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 20 12:32:35 UTC 2020


Module: Mesa
Branch: master
Commit: a7890f559b34e5a97689f16f0f1cdb1651fc4de7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7890f559b34e5a97689f16f0f1cdb1651fc4de7

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Wed Oct  3 11:51:24 2018 +0100

intel/perf: emit counter units in generated code

We'll use this coming extension.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2775>

---

 src/intel/perf/gen_perf.h  | 34 ++++++++++++++++++++++++++++++++++
 src/intel/perf/gen_perf.py |  5 +++++
 2 files changed, 39 insertions(+)

diff --git a/src/intel/perf/gen_perf.h b/src/intel/perf/gen_perf.h
index d35246d2f10..70525d06441 100644
--- a/src/intel/perf/gen_perf.h
+++ b/src/intel/perf/gen_perf.h
@@ -62,6 +62,39 @@ enum gen_perf_counter_data_type {
    GEN_PERF_COUNTER_DATA_TYPE_DOUBLE,
 };
 
+enum gen_perf_counter_units {
+   /* size */
+   GEN_PERF_COUNTER_UNITS_BYTES,
+
+   /* frequency */
+   GEN_PERF_COUNTER_UNITS_HZ,
+
+   /* time */
+   GEN_PERF_COUNTER_UNITS_NS,
+   GEN_PERF_COUNTER_UNITS_US,
+
+   /**/
+   GEN_PERF_COUNTER_UNITS_PIXELS,
+   GEN_PERF_COUNTER_UNITS_TEXELS,
+   GEN_PERF_COUNTER_UNITS_THREADS,
+   GEN_PERF_COUNTER_UNITS_PERCENT,
+
+   /* events */
+   GEN_PERF_COUNTER_UNITS_MESSAGES,
+   GEN_PERF_COUNTER_UNITS_NUMBER,
+   GEN_PERF_COUNTER_UNITS_CYCLES,
+   GEN_PERF_COUNTER_UNITS_EVENTS,
+   GEN_PERF_COUNTER_UNITS_UTILIZATION,
+
+   /**/
+   GEN_PERF_COUNTER_UNITS_EU_SENDS_TO_L3_CACHE_LINES,
+   GEN_PERF_COUNTER_UNITS_EU_ATOMIC_REQUESTS_TO_L3_CACHE_LINES,
+   GEN_PERF_COUNTER_UNITS_EU_REQUESTS_TO_L3_CACHE_LINES,
+   GEN_PERF_COUNTER_UNITS_EU_BYTES_PER_L3_CACHE_LINE,
+
+   GEN_PERF_COUNTER_UNITS_MAX
+};
+
 struct gen_pipeline_stat {
    uint32_t reg;
    uint32_t numerator;
@@ -133,6 +166,7 @@ struct gen_perf_query_counter {
    const char *symbol_name;
    enum gen_perf_counter_type type;
    enum gen_perf_counter_data_type data_type;
+   enum gen_perf_counter_units units;
    uint64_t raw_max;
    size_t offset;
    uint64_t query_mask;
diff --git a/src/intel/perf/gen_perf.py b/src/intel/perf/gen_perf.py
index e1ee1528ef1..a64d6ac3d5f 100644
--- a/src/intel/perf/gen_perf.py
+++ b/src/intel/perf/gen_perf.py
@@ -353,6 +353,10 @@ def output_availability(set, availability, counter_name):
         c_outdent(4)
 
 
+def output_units(unit):
+    return unit.replace(' ', '_').upper()
+
+
 def output_counter_report(set, counter, current_offset):
     data_type = counter.get('data_type')
     data_type_uc = data_type.upper()
@@ -381,6 +385,7 @@ def output_counter_report(set, counter, current_offset):
     c("counter->symbol_name = \"" + counter.get('symbol_name') + "\";\n")
     c("counter->type = GEN_PERF_COUNTER_TYPE_" + semantic_type_uc + ";\n")
     c("counter->data_type = GEN_PERF_COUNTER_DATA_TYPE_" + data_type_uc + ";\n")
+    c("counter->units = GEN_PERF_COUNTER_UNITS_" + output_units(counter.get('units')) + ";\n")
     c("counter->raw_max = " + set.max_values[counter.get('symbol_name')] + ";\n")
 
     current_offset = pot_align(current_offset, sizeof(c_type))



More information about the mesa-commit mailing list