[LNT] r264041 - [profile] Swap the order of counters and address.
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 22 04:45:44 PDT 2016
Author: jamesm
Date: Tue Mar 22 06:45:44 2016
New Revision: 264041
URL: http://llvm.org/viewvc/llvm-project?rev=264041&view=rev
Log:
[profile] Swap the order of counters and address.
Each of these (profilev1 and cPerf) had unit tests, but they weren't consistent between themselves which meant this failed in practice.
Modified:
lnt/trunk/lnt/testing/profile/cPerf.cpp
lnt/trunk/lnt/testing/profile/perf.py
lnt/trunk/tests/testing/cPerf.py
Modified: lnt/trunk/lnt/testing/profile/cPerf.cpp
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/profile/cPerf.cpp?rev=264041&r1=264040&r2=264041&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/profile/cPerf.cpp (original)
+++ lnt/trunk/lnt/testing/profile/cPerf.cpp Tue Mar 22 06:45:44 2016
@@ -597,9 +597,9 @@ void PerfReader::emitLine(uint64_t PC,
PyDict_SetItemString(CounterDict, KV.first,
PyLong_FromUnsignedLongLong((unsigned long long)KV.second));
- auto *Line = Py_BuildValue("[KNs]",
- (unsigned long long) PC,
+ auto *Line = Py_BuildValue("[NKs]",
CounterDict,
+ (unsigned long long) PC,
(char*) Text.c_str());
Lines.push_back(Line);
}
Modified: lnt/trunk/lnt/testing/profile/perf.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/profile/perf.py?rev=264041&r1=264040&r2=264041&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/profile/perf.py (original)
+++ lnt/trunk/lnt/testing/profile/perf.py Tue Mar 22 06:45:44 2016
@@ -1,7 +1,8 @@
-
-import json, os
+import json, os, traceback
from profile import ProfileImpl
from profilev1impl import ProfileV1
+from lnt.testing.util.commands import warning
+
try:
import cPerf
except:
@@ -30,8 +31,8 @@ class LinuxPerfProfile(ProfileImpl):
for f in data['functions'].values():
fc = f['counters']
for l in f['data']:
- for k,v in l[1].items():
- l[1][k] = 100.0 * float(v) / fc[k]
+ for k,v in l[0].items():
+ l[0][k] = 100.0 * float(v) / fc[k]
for k,v in fc.items():
fc[k] = 100.0 * v / data['counters'][k]
@@ -40,6 +41,5 @@ class LinuxPerfProfile(ProfileImpl):
except:
if propagateExceptions:
raise
- # FIXME: import warning!
warning(traceback.format_exc())
return None
Modified: lnt/trunk/tests/testing/cPerf.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/testing/cPerf.py?rev=264041&r1=264040&r2=264041&view=diff
==============================================================================
--- lnt/trunk/tests/testing/cPerf.py (original)
+++ lnt/trunk/tests/testing/cPerf.py Tue Mar 22 06:45:44 2016
@@ -15,12 +15,112 @@ class CPerfTest(unittest.TestCase):
'Inputs')
self.fake_nm = 'python %s/fake-nm.py' % self.inputs
- self.expected_data = {
- 'fib-aarch64': {u'functions': {u'fib': {u'data': [[4196040, {u'cycles': 22.476272172208624}, u'\ta9be4ff4 \tstp\tx20, x19, [sp,#-32]!'], [4196044, {u'cycles': 20.81533649797271}, u'\ta9017bfd \tstp\tx29, x30, [sp,#16]'], [4196048, {}, u'\t910043fd \tadd\tx29, sp, #0x10'], [4196052, {}, u'\t71000813 \tsubs\tw19, w0, #0x2'], [4196056, {}, u'\t540000eb \tb.lt\t4006f4 <fib+0x2c>'], [4196060, {u'cycles': 10.065491723992467}, u'\t51000400 \tsub\tw0, w0, #0x1'], [4196064, {}, u'\t97fffffa \tbl\t4006c8 <fib>'], [4196068, {u'cycles': 5.858831022967777}, u'\t2a0003f4 \tmov\tw20, w0'], [4196072, {}, u'\t2a1303e0 \tmov\tw0, w19'], [4196076, {}, u'\t97fffff7 \tbl\t4006c8 <fib>'], [4196080, {u'cycles': 7.57924022814841}, u'\t0b140000 \tadd\tw0, w0, w20'], [4196084, {u'cycles': 19.240308514111305}, u'\ta9417bfd \tldp\tx29, x30, [sp,#16]'], [4196088, {u'cycles': 13.964519840598708}, u'\ta8c24ff4 \tldp\tx20, x19, [sp],#32'], [4196092, {}, u'\td65f03c0 \tret']], u'counters': {u'cycles': 9
9.77243187496647}}}, u'counters': {u'cycles': 240949386}},
- 'fib2-aarch64': {u'functions': {u'fib': {u'data': [[4196040, {u'cycles': 23.48637833693693, u'branch-misses': 21.904846340904687, u'cache-misses': 37.4486921529175}, u'\ta9be4ff4 \tstp\tx20, x19, [sp,#-32]!'], [4196044, {u'cycles': 20.34001001463117, u'branch-misses': 2.6443747907452115, u'cache-misses': 17.08651911468813}, u'\ta9017bfd \tstp\tx29, x30, [sp,#16]'], [4196048, {}, u'\t910043fd \tadd\tx29, sp, #0x10'], [4196052, {}, u'\t71000813 \tsubs\tw19, w0, #0x2'], [4196056, {}, u'\t540000eb \tb.lt\t4006f4 <fib+0x2c>'], [4196060, {u'cycles': 9.787981545863996, u'branch-misses': 30.264575146698622, u'cache-misses': 20.69215291750503}, u'\t51000400 \tsub\tw0, w0, #0x1'], [4196064, {}, u'\t97fffffa \tbl\t4006c8 <fib>'], [4196068, {u'cycles': 7.702120542412432, u'branch-misses': 0.11195131191739062, u'cache-misses': 2.3621730382293764}, u'\t2a0003f4 \tmov\tw20, w0'], [4196072, {}, u'\t2a1303e0 \tmov\tw0, w19'], [4196076, {}, u'\t97fffff7 \tbl\t4006c8 <fib>'], [4196080, {u'
cycles': 7.362266427937867, u'branch-misses': 19.03265916580028, u'cache-misses': 3.8229376257545273}, u'\t0b140000 \tadd\tw0, w0, w20'], [4196084, {u'cycles': 18.387547715628735, u'branch-misses': 4.9891297644011345, u'cache-misses': 7.553319919517103}, u'\ta9417bfd \tldp\tx29, x30, [sp,#16]'], [4196088, {u'cycles': 12.93369541658887, u'branch-misses': 21.05246347953268, u'cache-misses': 11.03420523138833}, u'\ta8c24ff4 \tldp\tx20, x19, [sp],#32'], [4196092, {}, u'\td65f03c0 \tret']], u'counters': {u'cycles': 99.78902404723429, u'branch-misses': 99.7405382129432, u'cache-misses': 75.18000847098688}}}, u'counters': {u'cycles': 243618286, u'branch-misses': 1820692, u'cache-misses': 33054}}
- }
-
-
+ self.expected_data = {'fib-aarch64': {u'counters': {u'cycles': 240949386},
+ u'functions': {u'fib': {u'counters': {u'cycles': 99.77243187496647},
+ u'data': [[{u'cycles': 22.476272172208624},
+ 4196040,
+ u'\ta9be4ff4 \tstp\tx20, x19, [sp,#-32]!'],
+ [{u'cycles': 20.81533649797271},
+ 4196044,
+ u'\ta9017bfd \tstp\tx29, x30, [sp,#16]'],
+ [{},
+ 4196048,
+ u'\t910043fd \tadd\tx29, sp, #0x10'],
+ [{},
+ 4196052,
+ u'\t71000813 \tsubs\tw19, w0, #0x2'],
+ [{},
+ 4196056,
+ u'\t540000eb \tb.lt\t4006f4 <fib+0x2c>'],
+ [{u'cycles': 10.065491723992467},
+ 4196060,
+ u'\t51000400 \tsub\tw0, w0, #0x1'],
+ [{},
+ 4196064,
+ u'\t97fffffa \tbl\t4006c8 <fib>'],
+ [{u'cycles': 5.858831022967777},
+ 4196068,
+ u'\t2a0003f4 \tmov\tw20, w0'],
+ [{},
+ 4196072,
+ u'\t2a1303e0 \tmov\tw0, w19'],
+ [{},
+ 4196076,
+ u'\t97fffff7 \tbl\t4006c8 <fib>'],
+ [{u'cycles': 7.57924022814841},
+ 4196080,
+ u'\t0b140000 \tadd\tw0, w0, w20'],
+ [{u'cycles': 19.240308514111305},
+ 4196084,
+ u'\ta9417bfd \tldp\tx29, x30, [sp,#16]'],
+ [{u'cycles': 13.964519840598708},
+ 4196088,
+ u'\ta8c24ff4 \tldp\tx20, x19, [sp],#32'],
+ [{},
+ 4196092,
+ u'\td65f03c0 \tret']]}}},
+ 'fib2-aarch64': {u'counters': {u'branch-misses': 1820692,
+ u'cache-misses': 33054,
+ u'cycles': 243618286},
+ u'functions': {u'fib': {u'counters': {u'branch-misses': 99.7405382129432,
+ u'cache-misses': 75.18000847098688,
+ u'cycles': 99.78902404723429},
+ u'data': [[{u'branch-misses': 21.904846340904687,
+ u'cache-misses': 37.4486921529175,
+ u'cycles': 23.48637833693693},
+ 4196040,
+ u'\ta9be4ff4 \tstp\tx20, x19, [sp,#-32]!'],
+ [{u'branch-misses': 2.6443747907452115,
+ u'cache-misses': 17.08651911468813,
+ u'cycles': 20.34001001463117},
+ 4196044,
+ u'\ta9017bfd \tstp\tx29, x30, [sp,#16]'],
+ [{},
+ 4196048,
+ u'\t910043fd \tadd\tx29, sp, #0x10'],
+ [{},
+ 4196052,
+ u'\t71000813 \tsubs\tw19, w0, #0x2'],
+ [{},
+ 4196056,
+ u'\t540000eb \tb.lt\t4006f4 <fib+0x2c>'],
+ [{u'branch-misses': 30.264575146698622,
+ u'cache-misses': 20.69215291750503,
+ u'cycles': 9.787981545863996},
+ 4196060,
+ u'\t51000400 \tsub\tw0, w0, #0x1'],
+ [{},
+ 4196064,
+ u'\t97fffffa \tbl\t4006c8 <fib>'],
+ [{u'branch-misses': 0.11195131191739062,
+ u'cache-misses': 2.3621730382293764,
+ u'cycles': 7.702120542412432},
+ 4196068,
+ u'\t2a0003f4 \tmov\tw20, w0'],
+ [{},
+ 4196072,
+ u'\t2a1303e0 \tmov\tw0, w19'],
+ [{},
+ 4196076,
+ u'\t97fffff7 \tbl\t4006c8 <fib>'],
+ [{u'branch-misses': 19.03265916580028,
+ u'cache-misses': 3.8229376257545273,
+ u'cycles': 7.362266427937867},
+ 4196080,
+ u'\t0b140000 \tadd\tw0, w0, w20'],
+ [{u'branch-misses': 4.9891297644011345,
+ u'cache-misses': 7.553319919517103,
+ u'cycles': 18.387547715628735},
+ 4196084,
+ u'\ta9417bfd \tldp\tx29, x30, [sp,#16]'],
+ [{u'branch-misses': 21.05246347953268,
+ u'cache-misses': 11.03420523138833,
+ u'cycles': 12.93369541658887},
+ 4196088,
+ u'\ta8c24ff4 \tldp\tx20, x19, [sp],#32'],
+ [{},
+ 4196092,
+ u'\td65f03c0 \tret']]}}}}
def _getNm(self, perf_data_fname, non_dynamic=False):
stub = perf_data_fname.rsplit('.perf_data', 1)[0]
More information about the llvm-commits
mailing list