NetAudioServerLog.m 4.5 KB
Newer Older
Anne's avatar
Anne committed
1 2 3
%% Einlesen der Logs
close all;
clear all;
4
BlockSize = '32';
Anne's avatar
Anne committed
5 6 7
NetAudioLogServer = dir(['NetAudioLogServer_BS' BlockSize '*.txt']);
NetAudioLogServer = {NetAudioLogServer.name};
NetAudioLogServerTab = readtable(NetAudioLogServer{1}, 'FileType', 'text', 'Delimiter', '\t');
8 9
minTimeServer = NetAudioLogServerTab.WorldTimeStamp(1);
maxTimeServer = NetAudioLogServerTab.WorldTimeStamp(end);
Anne's avatar
Anne committed
10 11 12 13 14
channel = NetAudioLogServer{1}(28:end-4);

for k=2:numel(NetAudioLogServer) 
    temp = readtable(NetAudioLogServer{k}, 'FileType', 'text', 'Delimiter', '\t');
    NetAudioLogServerTab = [NetAudioLogServerTab; temp];
15 16
    minTimeServer = min(minTime, temp.WorldTimeStamp(1));
    maxTimeServer = max(maxTime, temp.WorldTimeStamp(end));
Anne's avatar
Anne committed
17 18 19
    channel = [channel; NetAudioLogServer{k}(28:end-4)];
end

20 21 22
NetAudioLogClient = dir(['NetAudioLogClient_BS' BlockSize '*.txt']);
NetAudioLogClient = {NetAudioLogClient.name};
NetAudioLogClientTab = readtable(NetAudioLogClient{1}, 'FileType', 'text', 'Delimiter', '\t');
23 24
minTimeClient = NetAudioLogClientTab.WorldTimeStamp(1);
maxTimeClient = NetAudioLogClientTab.WorldTimeStamp(end);
25 26 27
for k=2:numel(NetAudioLogClient) 
    temp = readtable(NetAudioLogClient{k}, 'FileType', 'text', 'Delimiter', '\t');
    NetAudioLogClientTab = [NetAudioLogClientTab; temp];
28 29
    minTimeClient = min(minTime, temp.WorldTimeStamp(1));
    maxTimeClient = max(maxTime, temp.WorldTimeStamp(end));
30
end
31 32
NetAudioLogClientTab.WorldTimeStamp = NetAudioLogClientTab.WorldTimeStamp - minTimeClient;
NetAudioLogServerTab.WorldTimeStamp = NetAudioLogServerTab.WorldTimeStamp - minTimeServer;
33 34


Anne's avatar
Anne committed
35
%% Protocolstatus ersetzten
36 37 38 39 40 41 42
Protocol = {'100', 'NP CLIENT OPEN';...
    '101', 'NP CLIENT CLOSE';...
    '111', 'NP CLIENT SENDING RINGBUFFER FREE SAMPLES';...
    '200', 'NP SERVER OPEN';...
    '201', 'NP SERVER CLOSE';...
    '211', 'NP SERVER GET RINGBUFFER FREE SAMPLES';...
    '222', 'NP SERVER SENDING SAMPLES'};
Anne's avatar
Anne committed
43
%NumPro = zeros(size(NetAudioLogServerTab.ProtocolStatus));
44 45 46 47 48 49 50 51 52 53
Time100 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 100));
Time101 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 101));
Time111 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 111));
Time200 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 200));
Time201 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 201));
Time211 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 211));
Time222 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 222));

TimeClient = {Time100 Time101 Time111 Time200 Time201 Time211 Time222};

54 55 56 57 58 59 60
Time100 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 100));
Time101 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 101));
Time111 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 111));
Time200 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 200));
Time201 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 201));
Time211 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 211));
Time222 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 222));
Anne's avatar
Anne committed
61

62
TimeServer = {Time100 Time101 Time111 Time200 Time201 Time211 Time222};
Anne's avatar
Anne committed
63 64

%% Plot Protocol
65
%plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.ProtocolStatus)
66 67

%subplot(2,2,1:4)
68
plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.FreeSamples)
69 70 71 72 73 74 75 76
hold on
%subplot(2,2,3:4)
%plot(NetAudioLogClientTab.WorldTimeStamp, NetAudioLogClientTab.FreeSamples)
legendeServer = {};
legendeClient = {};
legendeServer{1} = 'Freie Samples Server';
legendeClient{1} = 'Freie Samples Client';

77
i = 2;
78
j = 2;
79
for k = (1:7)
80 81 82 83
    if size(TimeServer{k}, 1) ~= 0
        %subplot(2,2,1:4)
        plot(TimeServer{k}, ones(size(TimeServer{k})),'.')
        legendeServer{i} = Protocol{k,2};
84 85
        i = i + 1;
    end
86 87 88 89 90 91
    if size(TimeClient{k}, 1) ~= 0
        %subplot(2,2,3:4)
        %plot(TimeClient{k}, ones(size(TimeClient{k})),'.')
        legendeClient{i} = Protocol{k,2};
        j = j + 1;
    end
92
end
93 94 95 96 97 98 99 100
%subplot(2,2,1:2)
title(['Protokolstatus Server'])
xlabel('Zeit in s')
legend(legendeServer);
%subplot(2,2,3:4)
%title(['Protokolstatus Client'])
%xlabel('Zeit in s')
%legend(legendeClient);
101
legend('show');