xref: /aosp_15_r20/external/walt/pywalt/plothist.py (revision bf47c6829f95be9dd55f4c5bbc44a71c90aad403)
1*bf47c682SAndroid Build Coastguard Worker#
2*bf47c682SAndroid Build Coastguard Worker# Utility script to plot a histogram of tap latency results
3*bf47c682SAndroid Build Coastguard Worker# run in iPython pylab mode using the -i flag
4*bf47c682SAndroid Build Coastguard Worker# ipython --pylab
5*bf47c682SAndroid Build Coastguard Worker# %run -i plothist.py
6*bf47c682SAndroid Build Coastguard Worker# show()
7*bf47c682SAndroid Build Coastguard Worker
8*bf47c682SAndroid Build Coastguard Worker# Copy / paste data from walt.py output here
9*bf47c682SAndroid Build Coastguard Workerdt_down += [32.97, 21.91, 23.06, 21.72, 67.31, 22.71, 29.52, 39.83, 38.55, 24.35, 30.14, 30.52, 38.66, 21.43, 28.69, 29.57, 21.93, 22.64, 38.77]
10*bf47c682SAndroid Build Coastguard Workerdt_up += [15.86, 17.36, 15.93, 21.32, 20.16, 18.95, 14.13, 6.05, 17.58, 12.21, 13.23, 16.17, 19.14, 11.35]
11*bf47c682SAndroid Build Coastguard Worker
12*bf47c682SAndroid Build Coastguard Worker
13*bf47c682SAndroid Build Coastguard Workerdt_down = array(dt_down)
14*bf47c682SAndroid Build Coastguard Workerdt_up = array(dt_up)
15*bf47c682SAndroid Build Coastguard Worker
16*bf47c682SAndroid Build Coastguard Worker
17*bf47c682SAndroid Build Coastguard Worker# Filter out number that are definitely garbage
18*bf47c682SAndroid Build Coastguard Worker
19*bf47c682SAndroid Build Coastguard Workerdt_down = dt_down[dt_down < 150]
20*bf47c682SAndroid Build Coastguard Workerdt_up = dt_up[dt_up < 150]
21*bf47c682SAndroid Build Coastguard Worker
22*bf47c682SAndroid Build Coastguard Workerhist([dt_down, dt_up])
23*bf47c682SAndroid Build Coastguard Worker
24*bf47c682SAndroid Build Coastguard Workerxlabel('tap latency [ms]')
25*bf47c682SAndroid Build Coastguard Workerylabel('Count')
26*bf47c682SAndroid Build Coastguard Workergrid(True)
27*bf47c682SAndroid Build Coastguard Workerlegend([
28*bf47c682SAndroid Build Coastguard Worker    'tap down N=%d med=%0.1f' % (len(dt_down), median(dt_down)),
29*bf47c682SAndroid Build Coastguard Worker    'tap up N=%d med=%0.1f' % (len(dt_up), median(dt_up)),
30*bf47c682SAndroid Build Coastguard Worker    ])
31*bf47c682SAndroid Build Coastguard Workertitle('Tap latency')