aboutsummaryrefslogtreecommitdiff
path: root/webrtc/modules/video_coding/test/plotTimingTest.m
diff options
context:
space:
mode:
Diffstat (limited to 'webrtc/modules/video_coding/test/plotTimingTest.m')
-rw-r--r--webrtc/modules/video_coding/test/plotTimingTest.m62
1 files changed, 62 insertions, 0 deletions
diff --git a/webrtc/modules/video_coding/test/plotTimingTest.m b/webrtc/modules/video_coding/test/plotTimingTest.m
new file mode 100644
index 0000000000..52a6f303cd
--- /dev/null
+++ b/webrtc/modules/video_coding/test/plotTimingTest.m
@@ -0,0 +1,62 @@
+function plotTimingTest(filename)
+fid=fopen(filename);
+
+%DEBUG ; ( 9:53:33:859 | 0) VIDEO:-1 ; 7132; Stochastic test 1
+%DEBUG ; ( 9:53:33:859 | 0) VIDEO CODING:-1 ; 7132; Frame decoded: timeStamp=3000 decTime=10 at 10012
+%DEBUG ; ( 9:53:33:859 | 0) VIDEO:-1 ; 7132; timeStamp=3000 clock=10037 maxWaitTime=0
+%DEBUG ; ( 9:53:33:859 | 0) VIDEO:-1 ; 7132; timeStampMs=33 renderTime=54
+line = fgetl(fid);
+decTime = [];
+waitTime = [];
+renderTime = [];
+foundStart = 0;
+testName = 'Stochastic test 1';
+while ischar(line)
+ if length(line) == 0
+ line = fgetl(fid);
+ continue;
+ end
+ lineOrig = line;
+ line = line(72:end);
+ if ~foundStart
+ if strncmp(line, testName, length(testName))
+ foundStart = 1;
+ end
+ line = fgetl(fid);
+ continue;
+ end
+ [p, count] = sscanf(line, 'Frame decoded: timeStamp=%lu decTime=%d maxDecTime=%d, at %lu');
+ if count == 4
+ decTime = [decTime; p'];
+ line = fgetl(fid);
+ continue;
+ end
+ [p, count] = sscanf(line, 'timeStamp=%u clock=%u maxWaitTime=%u');
+ if count == 3
+ waitTime = [waitTime; p'];
+ line = fgetl(fid);
+ continue;
+ end
+ [p, count] = sscanf(line, 'timeStamp=%u renderTime=%u');
+ if count == 2
+ renderTime = [renderTime; p'];
+ line = fgetl(fid);
+ continue;
+ end
+ line = fgetl(fid);
+end
+fclose(fid);
+
+% Compensate for wrap arounds and start counting from zero.
+timeStamps = waitTime(:, 1);
+tsDiff = diff(timeStamps);
+wrapIdx = find(tsDiff < 0);
+timeStamps(wrapIdx+1:end) = hex2dec('ffffffff') + timeStamps(wrapIdx+1:end);
+timeStamps = timeStamps - timeStamps(1);
+
+figure;
+hold on;
+plot(timeStamps, decTime(:, 2), 'r');
+plot(timeStamps, waitTime(:, 3), 'g');
+plot(timeStamps(2:end), diff(renderTime(:, 2)), 'b');
+legend('Decode time', 'Max wait time', 'Render time diff'); \ No newline at end of file