NetAudioLog.m 2.42 KB
Newer Older
1
%% Einlesen der Logs
2
3
close all;
clear all;
4
5
NetAudioLogNet = readtable( 'NetAudioLogNet.txt' );
NetAudioLogStream = readtable( 'NetAudioLogStream.txt' );
Anne Heimes's avatar
Anne Heimes committed
6
NetAudioLogClient = readtable( 'NetAudioLogClient.txt' );
7

8
9
10
11
minTime = min(NetAudioLogStream.WorldTimeStamp(1),NetAudioLogNet.WorldTimeStamp(1));
TimeNet = NetAudioLogNet.WorldTimeStamp - minTime;
TimeStream = NetAudioLogStream.WorldTimeStamp - minTime;
BlockLenght = NetAudioLogNet.NumSamplesTransmitted(1);
12
13
14
15
16
17
18

TimeState = [TimeStream NetAudioLogStream.StreamingStatus];
TimeUnderrun = TimeState(find(TimeState(:,2)==3), 1);
TimeOverrun = TimeState(find(TimeState(:,2)==4), 1);
TimeStream = TimeState(find(TimeState(:,2)==2), 1);

%% Plot Freie Smaples und Bufferstutus
19
20
21
22
Data = [NetAudioLogNet.WorldTimeStamp NetAudioLogNet.FreeSamples; NetAudioLogStream.WorldTimeStamp NetAudioLogStream.FreeSamples];
Data = sortrows(Data,1 );
Data(:,1) = Data(:,1) - minTime();
Data(:,2) = (Data(:,2)) / BlockLenght;
23
medianBlock = (max(Data(:,2)) - min(Data(:,2))) / 2;
24
subplot(2,2,1:2)
25
26
27
28
plot( Data(:,1), Data(:,2) )
hold on
plot( TimeUnderrun, zeros(size(TimeUnderrun)) + max(Data(:,2)),'r*')
plot( TimeOverrun, zeros(size(TimeOverrun)) + min(Data(:,2)),'r+')
29
30
31
32
33
title('Freie Blcke im Ring Buffer')
xlabel('Zeit in s')
ylabel('Anzahl der Blcke')

%% Plot Latenz
Anne Heimes's avatar
Anne Heimes committed
34
DiffTime = diff(NetAudioLogClient.WorldTimeStamp * 1000);
Anne's avatar
Anne committed
35
36
median = mean(DiffTime(:,1));
medianVec = zeros(size(DiffTime(:,1))); 
37
medianVec = medianVec + median;
38
39
40
41
42
DiffTime = [NetAudioLogClient.WorldTimeStamp(2:end) - minTime DiffTime NetAudioLogClient.ProtocolStatus(2:end)];
DiffTime = sortrows(DiffTime,3);
LatenzWaiting = DiffTime(find(DiffTime(:,3)<222), (1:2));
LatenzRunnning = DiffTime(find(DiffTime(:,3)>221), (1:2));
medianRunning = mean(LatenzRunnning(:,2));
Anne's avatar
Anne committed
43
44
medianRunningVec = zeros(size(LatenzRunnning(:,1))); 
medianRunningVec = medianRunningVec + medianRunning;
45
46
sollLatenz = (BlockLenght / 44100) * 1000;
sollLatenzVec = zeros(size(LatenzRunnning(:,1))); 
47
48
49
sollLatenzVec = sollLatenzVec + sollLatenz

subplot(2,2,3:4)
50
plot( LatenzRunnning(:,1), LatenzRunnning(:,2))
Anne's avatar
Anne committed
51
hold on
52
53
plot( LatenzRunnning(:,1), medianRunningVec, 'r')
plot( LatenzRunnning(:,1), sollLatenzVec, 'g')
54
55
plot( TimeUnderrun, zeros(size(TimeUnderrun)) + sollLatenz,'r*')
plot( TimeOverrun, zeros(size(TimeOverrun)) + medianRunning,'r*')
56
title('Latenz pro Block')
57
legend('Latenz', 'Durchschnittliche Latenz', 'SollLatenz', 'Underruns', 'Overruns')
58
59
xlabel('Zeit in ms')
ylabel('Latenz in ms')
60
legend('show')