History

add graphs to audio stats

Zach Pomerantz committed 10 years ago

Commit 60353741 parent f5e1d4d7 files · +122 −60Browse files

Unified · Split

7 files
  1. scripts/developer/utilities/audio/Jitter.qml +12 −8
  2. scripts/developer/utilities/audio/MovingValue.qml +11 −4
  3. scripts/developer/utilities/audio/MovingValuePair.qml +13 −7
  4. scripts/developer/utilities/audio/Stream.qml +5 −0
  5. scripts/developer/utilities/audio/stats.js +1 −1
  6. scripts/developer/utilities/audio/stats.qml +70 −37
  7. scripts/developer/utilities/lib/plotperf/PlotPerf.qml +10 −3
scripts/developer/utilities/audio/Jitter.qml+12−8
@@ -13,24 +13,28 @@ import QtQuick.Controls 1.4 · 12 unmodified lines
1313 import QtQuick.Layouts 1.3
1414
1515 ColumnLayout {
16+ id: jitter
1617 property var max
1718 property var avg
1819 property var maxWindow
1920 property var avgWindow
21+ property bool showGraphs: false
2022
2123 MovingValuePair {
2224 label: "Total"
23− label1: "Average"
24− label2: "Maximum"
25− source1: avg
26− source2: max
25+ label1: "Maximum"
26+ label2: "Average"
27+ source1: max
28+ source2: avg
29+ showGraphs: jitter.showGraphs
2730 }
2831 MovingValuePair {
2932 label: "Window"
30− label1: "Average"
31− label2: "Maximum"
32− source1: avgWindow
33− source2: maxWindow
33+ label1: "Maximum"
34+ label2: "Average"
35+ source1: maxWindow
36+ source2: avgWindow
37+ showGraphs: jitter.showGraphs
3438 }
3539 }
3640
scripts/developer/utilities/audio/MovingValue.qml+11−4
@@ -11,12 +11,14 @@ · 10 unmodified lines
1111 import QtQuick 2.5
1212 import QtQuick.Controls 1.4
1313 import QtQuick.Layouts 1.3
14+import "../lib/plotperf"
1415
1516 RowLayout {
1617 id: value
1718 property string label
1819 property var source
1920 property string unit: "ms"
21+ property bool showGraphs: false
2022
2123 width: parent.width
2224 property int dataPixelWidth: 150
@@ -26,15 +28,20 @@ RowLayout { · 3 unmodified lines
2628 text: value.label
2729 }
2830 Label {
31+ visible: !value.showGraphs
2932 Layout.preferredWidth: 0
3033 horizontalAlignment: Text.AlignRight
3134 text: value.source + ' ' + unit
3235 }
33− Label {
36+ PlotPerf {
37+ visible: value.showGraphs
3438 Layout.fillWidth: true
35− horizontalAlignment: Text.AlignRight
36− Layout.alignment: Qt.AlignRight
37− text: "Placeholder"
39+ height: 70
40+
41+ valueUnit: value.unit
42+ valueNumDigits: 0
43+
44+ plots: [{ binding: "source" }]
3845 }
3946 }
4047
scripts/developer/utilities/audio/MovingValuePair.qml+13−7
@@ -11,16 +11,17 @@ · 10 unmodified lines
1111 import QtQuick 2.5
1212 import QtQuick.Controls 1.4
1313 import QtQuick.Layouts 1.3
14+import "../lib/plotperf"
1415
1516 RowLayout {
1617 id: value
1718 property string label
1819 property string label1
1920 property string label2
20− property var source
2121 property var source1
2222 property var source2
2323 property string unit: "ms"
24+ property bool showGraphs: false
2425
2526 property int labelPixelWidth: 50
2627 property int dataPixelWidth: 100
@@ -37,6 +38,7 @@ RowLayout { · 10 unmodified lines
3738 text: value.label1
3839 }
3940 Label {
41+ visible: !value.showGraphs
4042 Layout.preferredWidth: 0
4143 horizontalAlignment: Text.AlignRight
4244 text: value.source1 + ' ' + unit
@@ -48,18 +50,22 @@ RowLayout { · 5 unmodified lines
4850 text: value.label2
4951 }
5052 Label {
53+ visible: !value.showGraphs
5154 Layout.preferredWidth: 0
5255 horizontalAlignment: Text.AlignRight
5356 text: value.source2 + ' ' + unit
5457 }
5558 }
5659 }
57− Label {
60+ PlotPerf {
61+ visible: value.showGraphs
62+
5863 Layout.fillWidth: true
59− horizontalAlignment: Text.AlignRight
60− Layout.alignment: Qt.AlignRight
61− text: "Placeholder"
62− }
64+ height: 70
6365
64−}
66+ valueUnit: value.unit
67+ valueNumDigits: 0
6568
69+ plots: [{ binding: "source1" }, { binding: "source2" }]
70+ }
71+}
scripts/developer/utilities/audio/Stream.qml+5−0
@@ -13,7 +13,9 @@ import QtQuick.Controls 1.4 · 12 unmodified lines
1313 import QtQuick.Layouts 1.3
1414
1515 ColumnLayout {
16+ id: root
1617 property var stream
18+ property bool showGraphs: false
1719
1820 Label {
1921 Layout.alignment: Qt.AlignCenter
@@ -24,10 +26,12 @@ ColumnLayout { · 4 unmodified lines
2426 label: "Desired"
2527 source: stream.framesDesired
2628 unit: "frames"
29+ showGraphs: root.showGraphs
2730 }
2831 MovingValue {
2932 label: "Unplayed"
3033 source: stream.unplayedMsMax
34+ showGraphs: root.showGraphs
3135 }
3236 Value {
3337 label: "Available (avg)"
@@ -44,6 +48,7 @@ ColumnLayout { · 10 unmodified lines
4448 avg: stream.timegapMsAvg
4549 maxWindow: stream.timegapMsMaxWindow
4650 avgWindow: stream.timegapMsAvgWindow
51+ showGraphs: root.showGraphs
4752 }
4853
4954 Label {
scripts/developer/utilities/audio/stats.js+1−1
@@ -17,7 +17,7 @@ var qml = Script.resolvePath('stats.qml'); · 16 unmodified lines
1717 var window = new OverlayWindow({
1818 title: 'Audio Interface Statistics',
1919 source: qml,
20− width: 400, height: 720 // stats.qml may be too large for some screens
20+ width: 800, height: 720 // stats.qml may be too large for some screens
2121 });
2222 window.setPosition(INITIAL_OFFSET, INITIAL_OFFSET);
2323
scripts/developer/utilities/audio/stats.qml+70−37
@@ -13,52 +13,85 @@ import QtQuick.Controls 1.4 · 12 unmodified lines
1313 import QtQuick.Layouts 1.3
1414
1515 Column {
16+ id: stats
1617 width: parent.width
1718 height: parent.height
19+ property bool showGraphs: toggleGraphs.checked
1820
19− Section {
20− label: "Latency"
21− description: "Audio pipeline latency, broken out and summed"
22− control: ColumnLayout {
23− MovingValue { label: "Input Read"; source: AudioStats.inputReadMsMax }
24− MovingValue { label: "Input Ring"; source: AudioStats.inputUnplayedMsMax }
25− MovingValue { label: "Network (client->mixer)"; source: AudioStats.pingMs / 2 }
26− MovingValue { label: "Mixer Ring"; source: AudioStats.mixerStream.unplayedMsMax }
27− MovingValue { label: "Network (mixer->client)"; source: AudioStats.pingMs / 2 }
28− MovingValue { label: "Output Ring"; source: AudioStats.clientStream.unplayedMsMax }
29− MovingValue { label: "Output Read"; source: AudioStats.outputUnplayedMsMax }
30− MovingValue { label: "TOTAL"
31− source: AudioStats.inputReadMsMax +
32− AudioStats.inputUnplayedMsMax +
33− AudioStats.outputUnplayedMsMax +
34− AudioStats.mixerStream.unplayedMsMax +
35− AudioStats.clientStream.unplayedMsMax +
36− AudioStats.pingMs
37− }
21+ RowLayout {
22+ width: parent.width
23+ height: 30
24+
25+ Button {
26+ id: toggleGraphs
27+ property bool checked: false
28+
29+ Layout.alignment: Qt.AlignCenter
30+
31+ text: checked ? "Hide graphs" : "Show graphs"
32+ onClicked: function() { checked = !checked; }
3833 }
3934 }
4035
41− Section {
42− label: "Upstream Jitter"
43− description: "Timegaps in packets sent to the mixer"
44− control: Jitter {
45− max: AudioStats.sentTimegapMsMax
46− avg: AudioStats.sentTimegapMsAvg
47− maxWindow: AudioStats.sentTimegapMsMaxWindow
48− avgWindow: AudioStats.sentTimegapMsAvgWindow
36+ Grid {
37+ width: parent.width
38+ height: parent.height - 30
39+
40+ Column {
41+ width: parent.width / 2
42+ height: parent.height
43+
44+ Section {
45+ label: "Latency"
46+ description: "Audio pipeline latency, broken out and summed"
47+ control: ColumnLayout {
48+ MovingValue { label: "Input Read"; source: AudioStats.inputReadMsMax; showGraphs: stats.showGraphs }
49+ MovingValue { label: "Input Ring"; source: AudioStats.inputUnplayedMsMax; showGraphs: stats.showGraphs }
50+ MovingValue { label: "Network (client->mixer)"; source: AudioStats.pingMs / 2; showGraphs: stats.showGraphs }
51+ MovingValue { label: "Mixer Ring"; source: AudioStats.mixerStream.unplayedMsMax; showGraphs: stats.showGraphs }
52+ MovingValue { label: "Network (mixer->client)"; source: AudioStats.pingMs / 2; showGraphs: stats.showGraphs }
53+ MovingValue { label: "Output Ring"; source: AudioStats.clientStream.unplayedMsMax; showGraphs: stats.showGraphs }
54+ MovingValue { label: "Output Read"; source: AudioStats.outputUnplayedMsMax; showGraphs: stats.showGraphs }
55+ MovingValue { label: "TOTAL"; showGraphs: stats.showGraphs
56+ source: AudioStats.inputReadMsMax +
57+ AudioStats.inputUnplayedMsMax +
58+ AudioStats.outputUnplayedMsMax +
59+ AudioStats.mixerStream.unplayedMsMax +
60+ AudioStats.clientStream.unplayedMsMax +
61+ AudioStats.pingMs
62+ }
63+ }
64+ }
65+
66+ Section {
67+ label: "Upstream Jitter"
68+ description: "Timegaps in packets sent to the mixer"
69+ control: Jitter {
70+ max: AudioStats.sentTimegapMsMax
71+ avg: AudioStats.sentTimegapMsAvg
72+ maxWindow: AudioStats.sentTimegapMsMaxWindow
73+ avgWindow: AudioStats.sentTimegapMsAvgWindow
74+ showGraphs: stats.showGraphs
75+ }
76+ }
4977 }
50− }
5178
52− Section {
53− label: "Mixer (upstream)"
54− description: "This client's remote audio stream, as seen by the server's mixer"
55− control: Stream { stream: AudioStats.mixerStream }
56− }
79+ Column {
80+ width: parent.width / 2
81+ height: parent.height
5782
58− Section {
59− label: "Client (downstream)"
60− description: "This client's received audio stream, between the network and the OS"
61− control: Stream { stream: AudioStats.clientStream }
83+ Section {
84+ label: "Mixer (upstream)"
85+ description: "This client's remote audio stream, as seen by the server's mixer"
86+ control: Stream { stream: AudioStats.mixerStream; showGraphs: stats.showGraphs }
87+ }
88+
89+ Section {
90+ label: "Client (downstream)"
91+ description: "This client's received audio stream, between the network and the OS"
92+ control: Stream { stream: AudioStats.clientStream; showGraphs: stats.showGraphs }
93+ }
94+ }
6295 }
6396 }
6497
scripts/developer/utilities/lib/plotperf/PlotPerf.qml+10−3
@@ -55,9 +55,17 @@ Item { · 54 unmodified lines
5555 function createValues() {
5656 for (var i =0; i < plots.length; i++) {
5757 var plot = plots[i];
58+ var object = plot["object"] || root.object;
59+ var value = plot["prop"];
60+ var isBinding = plot["binding"];
61+ if (isBinding) {
62+ object = root.parent;
63+ value = isBinding;
64+ }
5865 _values.push( {
59− object: (plot["object"] !== undefined ? plot["object"] : root.object),
60− value: plot["prop"],
66+ object: object,
67+ value: value,
68+ fromBinding: isBinding,
6169 valueMax: 1,
6270 numSamplesConstantMax: 0,
6371 valueHistory: new Array(),
@@ -218,7 +226,6 @@ Item { · 154 unmodified lines
218226 anchors.rightMargin: -hitboxExtension
219227
220228 onClicked: {
221− print("PerfPlot clicked!")
222229 resetMax();
223230 }
224231 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t