niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | function plotTimingTest(filename) |
| 2 | fid=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 |
| 8 | line = fgetl(fid); |
| 9 | decTime = []; |
| 10 | waitTime = []; |
| 11 | renderTime = []; |
| 12 | foundStart = 0; |
| 13 | testName = 'Stochastic test 1'; |
| 14 | while 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); |
| 47 | end |
| 48 | fclose(fid); |
| 49 | |
| 50 | % Compensate for wrap arounds and start counting from zero. |
| 51 | timeStamps = waitTime(:, 1); |
| 52 | tsDiff = diff(timeStamps); |
| 53 | wrapIdx = find(tsDiff < 0); |
| 54 | timeStamps(wrapIdx+1:end) = hex2dec('ffffffff') + timeStamps(wrapIdx+1:end); |
| 55 | timeStamps = timeStamps - timeStamps(1); |
| 56 | |
| 57 | figure; |
| 58 | hold on; |
| 59 | plot(timeStamps, decTime(:, 2), 'r'); |
| 60 | plot(timeStamps, waitTime(:, 3), 'g'); |
| 61 | plot(timeStamps(2:end), diff(renderTime(:, 2)), 'b'); |
| 62 | legend('Decode time', 'Max wait time', 'Render time diff'); |