forked from intel/event-converter-for-linux-perf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial scripts for the project "event-converter-for-linux-perf". Signed-off-by: Jin Yao <[email protected]>
- Loading branch information
Jin Yao
committed
Oct 21, 2020
1 parent
4858ab9
commit d2a3c51
Showing
35 changed files
with
2,625 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Copyright (c) 2020, Intel Corporation | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
* Neither the name of Intel Corporation nor the names of its contributors | ||
may be used to endorse or promote products derived from this software | ||
without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
# Copyright (c) 2020, Intel Corporation | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# * Redistributions of source code must retain the above copyright notice, | ||
# this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# * Neither the name of Intel Corporation nor the names of its contributors | ||
# may be used to endorse or promote products derived from this software | ||
# without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
|
||
# EXTRACTMETRICS PublicTMASpreadsheet.CSV | ||
|
||
set -e | ||
|
||
E="--extrajson cstate.json" | ||
|
||
./extract-tmam-metrics.py --extramodel CLX CLX --memory $E $1 > clx-metrics.json | ||
./extract-tmam-metrics.py --extramodel SKX SKX $E $1 > skx-metrics.json | ||
./extract-tmam-metrics.py --extramodel BDX BDX $E $1 > bdx-metrics.json | ||
./extract-tmam-metrics.py --extramodel HSX HSX $E $1 > hsx-metrics.json | ||
./extract-tmam-metrics.py --extramodel IVT IVT $E $1 > ivt-metrics.json | ||
./extract-tmam-metrics.py --extramodel JKT JKT/SNB-EP $E $1 > jkt-metrics.json | ||
|
||
./extract-tmam-metrics.py --extramodel SKL SKL/KBL $E $1 > skl-metrics.json | ||
./extract-tmam-metrics.py --extramodel BDW BDW/BDW-DE $E $1 > bdw-metrics.json | ||
./extract-tmam-metrics.py --extramodel HSW HSW $E $1 > hsw-metrics.json | ||
./extract-tmam-metrics.py --extramodel IVB IVB $E $1 > ivb-metrics.json | ||
./extract-tmam-metrics.py --extramodel SNB SNB $E $1 > snb-metrics.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,133 @@ | ||
# event-converter-for-linux-perf | ||
# event-converter-for-linux-perf | ||
|
||
Intel publishes PMU events JSON files on 01.org. | ||
(https://download.01.org/perfmon/) | ||
|
||
This project converts the Intel published events to Linux perf format | ||
events thus Linux perf can use Intel specific PMU events. | ||
|
||
This project uses "BSD clause 3" license (see COPYING). | ||
|
||
Scripts usage: | ||
-------------- | ||
csv-field | ||
- print csv fields from csv | ||
- csv-field field1 ... fieldN < csv | ||
|
||
event-oprofile | ||
- convert a CSV or JSON PMU event table to oprofile format generic json version | ||
- event-oprofile cpu.csv|cpu.json cpu | ||
|
||
evj2csv | ||
- convert json event format to csv | ||
|
||
EXTRACTMETRICS | ||
- EXTRACTMETRICS PublicTMASpreadsheet.CSV | ||
- see example below | ||
|
||
extract-tmam-metrics.py | ||
- extract metrics for cpu from TMAM spreadsheet and generate JSON metrics files | ||
- extract-tmam-metrics.py CPU tmam-csv-file.csv > cpu-metrics.json | ||
|
||
gen-metrics | ||
- generate json metric files in perf tree from TMAM | ||
- gen-metrics TMEM-file linux-tree | ||
|
||
json2csv | ||
- convert json to equivalent CSV (with tabs) | ||
|
||
json-remove-events | ||
- remove selected events from json file | ||
|
||
json-to-perf-json.py | ||
- generate split perf json files from a single perf json files | ||
- see example below | ||
|
||
line-len | ||
- print line lengths of file (to workaround git send-email limitations) | ||
|
||
merge-json | ||
- merge json event files | ||
- merge-json file1.json file2... > merged.json | ||
|
||
op-all-events | ||
- print all oprofile events | ||
- ophelp --xml | op-all-events | ||
|
||
pd-shell | ||
- open a pandas shell for json file (need pandas) | ||
|
||
print-all | ||
- print all events from a json event file in perf format | ||
|
||
print-alone | ||
- print events with "TakenAlone" set | ||
|
||
print-datala | ||
- print all datala events from a json event file | ||
- print-datala file.json | ||
|
||
print-expr | ||
- print all events from a json event matching expr (need pandas) | ||
- print-expr "pandas expr" file.json | ||
|
||
print-names | ||
- print event name | ||
|
||
print-pebs | ||
- print all pebs events from a json event file in perf format | ||
- print-pebs file.json | ||
|
||
print-pebs-raw | ||
- print all pebs events raw encoding from a json event file in perf format | ||
- print-pebs-raw file.json | ||
|
||
revev | ||
- print names for hex events | ||
- revev jsonfile hex-event ... | ||
|
||
rev-event | ||
- print all events from a json event file in perf format (no special) | ||
|
||
uncore_csv_json | ||
- generate split uncore json from csv spreadsheet input | ||
- uncore_csv_json csv orig-pme-json targetdir | ||
- see example below | ||
|
||
Examples: | ||
--------- | ||
1. Generate core event json for one specified platform, such as skylakex. | ||
|
||
$ python json-to-perf-json.py --outdir ./skx-output skylakex_core_v1.24.json | ||
cache.json | ||
floating-point.json | ||
frontend.json | ||
memory.json | ||
other.json | ||
pipeline.json | ||
virtual-memory.json | ||
|
||
skylakex_core_v1.24.json is downloaded from https://download.01.org/perfmon/. | ||
|
||
2. Generate uncore event json | ||
|
||
$ python uncore_csv_json --all perf-uncore-events-clx.csv cascadelakex_uncore_v1.11.json ./clx-output cascadelakex_uncore_v1.11_experimental.json | ||
...... | ||
generating Uncore-Memory | ||
generating Uncore-Other | ||
|
||
cascadelakex_uncore_v1.11.json and cascadelakex_uncore_v1.11_experimental.json | ||
are downloaded from https://download.01.org/perfmon/. | ||
|
||
3. Generate metrics for CLX | ||
|
||
$ python extract-tmam-metrics.py CLX TMA_Metrics.csv | ||
|
||
TMA_Metrics.csv is downloaded from //download.01.org/perfmon/. | ||
|
||
4. Generate metrics for all archs | ||
$ ./EXTRACTMETRICS TMA_Metrics.csv | ||
|
||
Andi Kleen <[email protected]> | ||
Liang Kan <[email protected]> | ||
Jin Yao <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"MetricExpr": "(cstate_core@c3\\-residency@ / msr@tsc@) * 100", | ||
"MetricGroup": "Power", | ||
"BriefDescription": "C3 residency percent per core", | ||
"MetricName": "C3_Core_Residency" | ||
}, | ||
{ | ||
"MetricExpr": "(cstate_core@c6\\-residency@ / msr@tsc@) * 100", | ||
"MetricGroup": "Power", | ||
"BriefDescription": "C6 residency percent per core", | ||
"MetricName": "C6_Core_Residency" | ||
}, | ||
{ | ||
"MetricExpr": "(cstate_core@c7\\-residency@ / msr@tsc@) * 100", | ||
"MetricGroup": "Power", | ||
"BriefDescription": "C7 residency percent per core", | ||
"MetricName": "C7_Core_Residency" | ||
}, | ||
{ | ||
"MetricExpr": "(cstate_pkg@c2\\-residency@ / msr@tsc@) * 100", | ||
"MetricGroup": "Power", | ||
"BriefDescription": "C2 residency percent per package", | ||
"MetricName": "C2_Pkg_Residency" | ||
}, | ||
{ | ||
"MetricExpr": "(cstate_pkg@c3\\-residency@ / msr@tsc@) * 100", | ||
"MetricGroup": "Power", | ||
"BriefDescription": "C3 residency percent per package", | ||
"MetricName": "C3_Pkg_Residency" | ||
}, | ||
{ | ||
"MetricExpr": "(cstate_pkg@c6\\-residency@ / msr@tsc@) * 100", | ||
"MetricGroup": "Power", | ||
"BriefDescription": "C6 residency percent per package", | ||
"MetricName": "C6_Pkg_Residency" | ||
}, | ||
{ | ||
"MetricExpr": "(cstate_pkg@c7\\-residency@ / msr@tsc@) * 100", | ||
"MetricGroup": "Power", | ||
"BriefDescription": "C7 residency percent per package", | ||
"MetricName": "C7_Pkg_Residency" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/python | ||
|
||
# Copyright (c) 2020, Intel Corporation | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# * Redistributions of source code must retain the above copyright notice, | ||
# this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# * Neither the name of Intel Corporation nor the names of its contributors | ||
# may be used to endorse or promote products derived from this software | ||
# without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
|
||
# print csv fields from csv | ||
# csv-field field1 ... fieldN < csv | ||
import csv | ||
import sys | ||
import fnmatch | ||
|
||
def dictopen(f): | ||
#dialect = csv.Sniffer().sniff(f.read(1024)) | ||
#f.seek(0) | ||
#return csv.DictReader(f, dialect=dialect) | ||
return csv.DictReader(f) | ||
|
||
c = dictopen(sys.stdin) | ||
for j in c: | ||
for f in sys.argv[1:]: | ||
try: | ||
if "*" in f: | ||
for k in j.keys(): | ||
if fnmatch.fnmatch(k, f): | ||
print j[k], | ||
else: | ||
print j[f], | ||
except KeyError: | ||
print "?", | ||
Oops, something went wrong.