blob: 52a6f303cd472ac8c0a8c3c2cc0e501c2fe530a6 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001function plotTimingTest(filename)
2fid=fopen(filename);
3
4%DEBUG ; ( 9:53:33:859 | 0) VIDEO:-1 ; 7132; Stochastic test 1
5%DEBUG ; ( 9:53:33:859 | 0) VIDEO CODING:-1 ; 7132; Frame decoded: timeStamp=3000 decTime=10 at 10012
6%DEBUG ; ( 9:53:33:859 | 0) VIDEO:-1 ; 7132; timeStamp=3000 clock=10037 maxWaitTime=0
7%DEBUG ; ( 9:53:33:859 | 0) VIDEO:-1 ; 7132; timeStampMs=33 renderTime=54
8line = fgetl(fid);
9decTime = [];
10waitTime = [];
11renderTime = [];
12foundStart = 0;
13testName = 'Stochastic test 1';
14while ischar(line)
15 if length(line) == 0
16 line = fgetl(fid);
17 continue;
18 end
19 lineOrig = line;
20 line = line(72:end);
21 if ~foundStart
22 if strncmp(line, testName, length(testName))
23 foundStart = 1;
24 end
25 line = fgetl(fid);
26 continue;
27 end
28 [p, count] = sscanf(line, 'Frame decoded: timeStamp=%lu decTime=%d maxDecTime=%d, at %lu');
29 if count == 4
30 decTime = [decTime; p'];
31 line = fgetl(fid);
32 continue;
33 end
34 [p, count] = sscanf(line, 'timeStamp=%u clock=%u maxWaitTime=%u');
35 if count == 3
36 waitTime = [waitTime; p'];
37 line = fgetl(fid);
38 continue;
39 end
40 [p, count] = sscanf(line, 'timeStamp=%u renderTime=%u');
41 if count == 2
42 renderTime = [renderTime; p'];
43 line = fgetl(fid);
44 continue;
45 end
46 line = fgetl(fid);
47end
48fclose(fid);
49
50% Compensate for wrap arounds and start counting from zero.
51timeStamps = waitTime(:, 1);
52tsDiff = diff(timeStamps);
53wrapIdx = find(tsDiff < 0);
54timeStamps(wrapIdx+1:end) = hex2dec('ffffffff') + timeStamps(wrapIdx+1:end);
55timeStamps = timeStamps - timeStamps(1);
56
57figure;
58hold on;
59plot(timeStamps, decTime(:, 2), 'r');
60plot(timeStamps, waitTime(:, 3), 'g');
61plot(timeStamps(2:end), diff(renderTime(:, 2)), 'b');
62legend('Decode time', 'Max wait time', 'Render time diff');