matlab files which plot graphichs by using the result files are added

This commit is contained in:
Cagatay Sonmez 2017-06-19 22:43:39 +03:00
parent 4d98cac8b5
commit 472b0b5693
9 changed files with 374 additions and 0 deletions

View File

@ -0,0 +1,55 @@
%--------------------------------------------------------------
%description
% returns a value according to the given arguments
%--------------------------------------------------------------
function [ret_val] = getConfiguration(argType)
if(argType == 1)
ret_val = 'D:\output\20-06-2017_00-31\default_config';
elseif(argType == 2)
ret_val = 60 * 125; %simulation time (in seconds)
elseif(argType == 3)
ret_val = 1; %Number of iterations
elseif(argType == 4)
ret_val = 1; %x tick interval for number of mobile devices
elseif(argType == 5)
ret_val = {'SINGLE_TIER','TWO_TIER'};
elseif(argType == 6)
ret_val = {'1-tier','2-tier'};
elseif(argType == 7)
ret_val=[350 60 450 450]; %position of figure
elseif(argType == 8)
ret_val = 20; %server load log interval (in seconds)
elseif(argType == 9)
ret_val = 'Number of Mobile Devices'; %Common text for s axis
elseif(argType == 10)
ret_val = 100; %min number of mobile device
elseif(argType == 11)
ret_val = 100; %step size of mobile device count
elseif(argType == 12)
ret_val =1000; %max number of mobile device
elseif(argType == 19)
ret_val = 1; %return 1 if you want to plot errors
elseif(argType == 20)
ret_val=1; %return 1 if graph is plotted colerful
elseif(argType == 21)
ret_val=[0.55 0 0]; %color of first line
elseif(argType == 22)
ret_val=[0 0.15 0.6]; %color of second line
elseif(argType == 23)
ret_val=[0 0.23 0]; %color of third line
elseif(argType == 24)
ret_val=[0.6 0 0.6]; %color of fourth line
elseif(argType == 25)
ret_val=[0.08 0.08 0.08]; %color of fifth line
elseif(argType == 26)
ret_val=[0 0.8 0.8]; %color of sixth line
elseif(argType == 27)
ret_val=[0.8 0.4 0]; %color of seventh line
elseif(argType == 28)
ret_val=[0.8 0.8 0]; %color of eighth line
elseif(argType == 40)
ret_val={'-k*','-ko','-ks','-kv','-kp','-kd','-kx','-kh'}; %line style (marker) of the colerless line
elseif(argType == 50)
ret_val={':k*',':ko',':ks',':kv',':kp',':kd',':kx',':kh'}; %line style (marker) of the colerfull line
end
end

View File

@ -0,0 +1,20 @@
function [] = plotAvgFailedTask()
plotGenericResult(1, 2, 'Failed Tasks (%)', 'ALL_APPS', 1);
plotGenericResult(1, 2, {'Failed Tasks for';'Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 1);
plotGenericResult(1, 2, 'Failed Tasks for Health App (%)', 'HEALTH_APP', 1);
plotGenericResult(1, 2, 'Failed Tasks for Infotainment App (%)', 'INFOTAINMENT_APP', 1);
plotGenericResult(1, 2, 'Failed Tasks for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 1);
plotGenericResult(2, 2, 'Failed Tasks on Cloudlet (%)', 'ALL_APPS', 0);
plotGenericResult(2, 2, {'Failed Tasks on Cloudlet';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 1);
plotGenericResult(2, 2, 'Failed Tasks on Cloudlet for Health App (%)', 'HEALTH_APP', 1);
plotGenericResult(2, 2, 'Failed Tasks on Cloudlet for Infotainment App (%)', 'INFOTAINMENT_APP', 1);
plotGenericResult(2, 2, 'Failed Tasks on Cloudlet for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 1);
plotGenericResult(3, 2, 'Failed Tasks on Cloud (%)', 'ALL_APPS', 1);
plotGenericResult(3, 2, {'Failed Tasks on Cloud for';'Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 1);
plotGenericResult(3, 2, 'Failed Tasks on Cloud for Health App (%)', 'HEALTH_APP', 1);
plotGenericResult(3, 2, 'Failed Tasks on Cloud for Infotainment App (%)', 'INFOTAINMENT_APP', 1);
plotGenericResult(3, 2, 'Failed Tasks on Cloud for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 1);
end

View File

@ -0,0 +1,20 @@
function [] = plotAvgNetworkDelay()
plotGenericResult(1, 7, 'Average Network Delay (sec)', 'ALL_APPS', 0);
plotGenericResult(1, 7, {'Average Network Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', 0);
plotGenericResult(1, 7, 'Average Network Delay for Health App (sec)', 'HEALTH_APP', 0);
plotGenericResult(1, 7, {'Average Network Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', 0);
plotGenericResult(1, 7, {'Average Network Delay';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', 0);
plotGenericResult(2, 7, 'Average WLAN Delay (sec)', 'ALL_APPS', 0);
plotGenericResult(2, 7, {'Average WLAN Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', 0);
plotGenericResult(2, 7, 'Average WLAN Delay for Health App (sec)', 'HEALTH_APP', 0);
plotGenericResult(2, 7, {'Average WLAN Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', 0);
plotGenericResult(2, 7, {'Average WLAN Delay';'for Heavy Comp. App %(sec)'}, 'HEAVY_COMP_APP', 0);
plotGenericResult(3, 7, 'Average WAN Delay (sec)', 'ALL_APPS', 0);
plotGenericResult(3, 7, {'Average WAN Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', 0);
plotGenericResult(3, 7, 'Average WAN Delay for Health App (sec)', 'HEALTH_APP', 0);
plotGenericResult(3, 7, {'Average WAN Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', 0);
plotGenericResult(3, 7, {'Average WAN Delay';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', 0);
end

View File

@ -0,0 +1,20 @@
function [] = plotAvgProcessingTime()
plotGenericResult(1, 6, 'Processing Time (sec)', 'ALL_APPS', 0);
plotGenericResult(1, 6, 'Processing Time for Augmented Reality App (sec)', 'AUGMENTED_REALITY', 0);
plotGenericResult(1, 6, 'Processing Time for Health App (sec)', 'HEALTH_APP', 0);
plotGenericResult(1, 6, 'Processing Time for Infotainment App (sec)', 'INFOTAINMENT_APP', 0);
plotGenericResult(1, 6, 'Processing Time for Heavy Comp. App (sec)', 'HEAVY_COMP_APP', 0);
plotGenericResult(2, 6, 'Processing Time on Cloudlet (sec)', 'ALL_APPS', 0);
plotGenericResult(2, 6, {'Processing Time on Cloudlet';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', 0);
plotGenericResult(2, 6, {'Processing Time on Cloudlet';'for Health App (sec)'}, 'HEALTH_APP', 0);
plotGenericResult(2, 6, {'Processing Time on Cloudlet';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', 0);
plotGenericResult(2, 6, {'Processing Time on Cloudlet';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', 0);
plotGenericResult(3, 6, 'Processing Time on Cloud (sec)', 'ALL_APPS', 0);
plotGenericResult(3, 6, {'Processing Time on Cloud';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', 0);
plotGenericResult(3, 6, {'Processing Time on Cloud';'for Health App (sec)'}, 'HEALTH_APP', 0);
plotGenericResult(3, 6, {'Processing Time on Cloud';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', 0);
plotGenericResult(3, 6, {'Processing Time on Cloud';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', 0);
end

View File

@ -0,0 +1,21 @@
function [] = plotAvgServiceTime()
plotGenericResult(1, 5, 'Service Time (sec)', 'ALL_APPS', 0);
plotGenericResult(1, 5, 'Service Time for Augmented Reality App (sec)', 'AUGMENTED_REALITY', 0);
plotGenericResult(1, 5, 'Service Time for Health App (sec)', 'HEALTH_APP', 0);
plotGenericResult(1, 5, 'Service Time for Infotainment App (sec)', 'INFOTAINMENT_APP', 0);
plotGenericResult(1, 5, 'Service Time for Heavy Comp. App (sec)', 'HEAVY_COMP_APP', 0);
plotGenericResult(2, 5, 'Service Time on Cloudlet (sec)', 'ALL_APPS', 0);
plotGenericResult(2, 5, {'Service Time on Cloudlet';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', 0);
plotGenericResult(2, 5, 'Service Time on Cloudlet for Health App (sec)', 'HEALTH_APP', 0);
plotGenericResult(2, 5, {'Service Time on Cloudlet';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', 0);
plotGenericResult(2, 5, {'Service Time on Cloudlet';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', 0);
plotGenericResult(3, 5, 'Service Time on Cloud (sec)', 'ALL_APPS', 0);
plotGenericResult(3, 5, {'Service Time on Cloud';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', 0);
plotGenericResult(3, 5, 'Service Time on Cloud for Health App (sec)', 'HEALTH_APP', 0);
plotGenericResult(3, 5, {'Service Time on Cloud';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', 0);
plotGenericResult(3, 5, {'Service Time on Cloud';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', 0);
end

View File

@ -0,0 +1,9 @@
function [] = plotAvgVmUtilization()
plotGenericResult(1, 8, 'Average VM Utilization (%)', 'ALL_APPS', 0);
plotGenericResult(1, 8, {'Average VM Utilization';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 0);
plotGenericResult(1, 8, 'Average VM Utilization for Health App (%)', 'HEALTH_APP', 0);
plotGenericResult(1, 8, 'Average VM Utilization for Infotainment App (%)', 'INFOTAINMENT_APP', 0);
plotGenericResult(1, 8, 'Average VM Utilization for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 0);
end

View File

@ -0,0 +1,129 @@
function [] = plotGenericResult(rowOfset, columnOfset, yLabel, appType, calculatePercentage)
folderPath = getConfiguration(1);
numOfSimulations = getConfiguration(3);
stepOfxAxis = getConfiguration(4);
scenarioType = getConfiguration(5);
startOfMobileDeviceLoop = getConfiguration(10);
stepOfMobileDeviceLoop = getConfiguration(11);
endOfMobileDeviceLoop = getConfiguration(12);
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
all_results = zeros(numOfSimulations, size(scenarioType,2), numOfMobileDevices);
min_max_results = zeros(2, size(scenarioType,2), numOfMobileDevices);
if ~exist('appType','var')
appType = 'ALL_APPS';
end
for s=1:numOfSimulations
for i=1:size(scenarioType,2)
for j=1:numOfMobileDevices
try
mobileDeviceNumber = startOfMobileDeviceLoop + stepOfMobileDeviceLoop * (j-1);
filePath = strcat(folderPath,'\ite',int2str(s),'\SIMRESULT_',char(scenarioType(i)),'_NEXT_FIT_',int2str(mobileDeviceNumber),'DEVICES_',appType,'_GENERIC.log')
readData = dlmread(filePath,';',rowOfset,0);
value = readData(1,columnOfset);
if(calculatePercentage==1)
totalTask = readData(1,1)+readData(1,2);
value = (100 * value) / totalTask;
end
all_results(s,i,j) = value;
catch err
error(err)
end
end
end
end
if(numOfSimulations == 1)
results = all_results;
else
results = mean(all_results); %still 3d matrix but 1xMxN format
end
results = squeeze(results); %remove singleton dimensions
for i=1:size(scenarioType,2)
for j=1:numOfMobileDevices
x=all_results(:,i,j); % Create Data
SEM = std(x)/sqrt(length(x)); % Standard Error
ts = tinv([0.05 0.95],length(x)-1); % T-Score
CI = mean(x) + ts*SEM; % Confidence Intervals
if(CI(1) < 0)
CI(1) = 0;
end
if(CI(2) < 0)
CI(2) = 0;
end
min_max_results(1,i,j) = results(i,j) - CI(1);
min_max_results(2,i,j) = CI(2) - results(i,j);
end
end
types = zeros(1,numOfMobileDevices);
for i=1:numOfMobileDevices
types(i)=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
end
hFig = figure;
set(hFig, 'Position',getConfiguration(7));
set(0,'DefaultAxesFontName','Times New Roman');
set(0,'DefaultTextFontName','Times New Roman');
set(0,'DefaultAxesFontSize',12);
set(0,'DefaultTextFontSize',12);
if(getConfiguration(20) == 1)
for i=stepOfxAxis:stepOfxAxis:numOfMobileDevices
xIndex=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
markers = getConfiguration(50);
for j=1:size(scenarioType,2)
plot(xIndex, results(j,i),char(markers(j)),'MarkerFaceColor',getConfiguration(20+j),'color',getConfiguration(20+j));
hold on;
end
end
for j=1:size(scenarioType,2)
if(getConfiguration(19) == 1)
errorbar(types, results(j,:), min_max_results(1,j,:),min_max_results(2,j,:),':k','color',getConfiguration(20+j),'LineWidth',1.5);
else
plot(types, results(j,:),':k','color',getConfiguration(20+j),'LineWidth',1.5);
end
hold on;
end
set(gca,'color','none');
else
markers = getConfiguration(40);
for j=1:size(scenarioType,2)
if(getConfiguration(19) == 1)
errorbar(types, results(j,:),min_max_results(1,j,:),min_max_results(2,j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1.4);
else
plot(types, results(j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1.4);
end
hold on;
end
%set(gcf, 'Position',getConfiguration(28));
end
lgnd = legend(getConfiguration(6),'Location','NorthWest');
if(getConfiguration(20) == 1)
set(lgnd,'color','none');
end
hold off;
axis square
xlabel(getConfiguration(9));
set(gca,'XTick', (stepOfxAxis*stepOfMobileDeviceLoop):(stepOfxAxis*stepOfMobileDeviceLoop):endOfMobileDeviceLoop);
ylabel(yLabel);
set(gca,'XLim',[startOfMobileDeviceLoop-5 endOfMobileDeviceLoop+5]);
set(get(gca,'Xlabel'),'FontSize',12)
set(get(gca,'Ylabel'),'FontSize',12)
set(lgnd,'FontSize',12)
end

View File

@ -0,0 +1,75 @@
function [] = plotLocation()
folderPath = getConfiguration(1);
numOfSimulations = getConfiguration(3);
stepOfxAxis = getConfiguration(4);
startOfMobileDeviceLoop = getConfiguration(10);
stepOfMobileDeviceLoop = getConfiguration(11);
endOfMobileDeviceLoop = getConfiguration(12);
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
placeTypes = {'Attractiveness L1','Attractiveness L2','Attractiveness L3'};
results = zeros(size(placeTypes,2),numOfMobileDevices);
for s=1:numOfSimulations
indexCounter = 1;
for i=startOfMobileDeviceLoop:stepOfMobileDeviceLoop:endOfMobileDeviceLoop
try
filePath = strcat(folderPath,'\ite',int2str(s),'\SIMRESULT_SINGLE_TIER_NEXT_FIT_',int2str(i),'DEVICES_LOCATION.log');
readData = dlmread(filePath,';',1,0);
for j=1:size(placeTypes,2)
results(j,indexCounter) = results(j,indexCounter) + mean(readData(:,j+1));
end
catch err
error(err)
end
indexCounter = indexCounter + 1;
end
end
results = results/numOfSimulations;
types = zeros(1,numOfMobileDevices);
for i=1:numOfMobileDevices
types(i)=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
end
hFig = figure;
set(hFig, 'Position',getConfiguration(7));
if(getConfiguration(20) == 1)
for i=stepOfxAxis:stepOfxAxis:numOfMobileDevices
xIndex=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
markers = {':k*',':ko',':ks',':kv'};
for j=1:size(placeTypes,2)
plot(xIndex, results(j,i),char(markers(j)),'MarkerFaceColor',getConfiguration(20+j),'color',getConfiguration(20+j));
hold on;
end
end
for j=1:size(placeTypes,2)
plot(types, results(j,:),':k','color',getConfiguration(20+j),'LineWidth',1.5);
hold on;
end
set(gca,'color','none');
else
markers = {'-k*','-ko','-ks','-kv'};
for j=1:size(placeTypes,2)
plot(types, results(j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1.4);
hold on;
end
%set(gcf, 'Position',getConfiguration(28));
end
lgnd = legend(placeTypes,'Location','NorthWest');
if(getConfiguration(20) == 1)
set(lgnd,'color','none');
end
hold off;
axis square
xlabel('Number of Devices in the Simulation');
set(gca,'XTick', (stepOfxAxis*stepOfMobileDeviceLoop):(stepOfxAxis*stepOfMobileDeviceLoop):endOfMobileDeviceLoop);
ylabel('Average Number of Devices in Related Place');
%set(gca,'YLim',[2 6]);
end

View File

@ -0,0 +1,25 @@
function [] = plotTaskFailureReason()
plotGenericResult(1, 10, 'Failed Task due to VM Capacity (%)', 'ALL_APPS', 1);
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 1);
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 1);
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 1);
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 1);
plotGenericResult(1, 11, 'Average Failed Task due to Mobility (%)', 'ALL_APPS', 1);
plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 1);
plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 1);
plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 1);
plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 1);
plotGenericResult(2, 4, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 1);
plotGenericResult(2, 4, {'Failed Tasks due to WLAN';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 1);
plotGenericResult(2, 4, {'Failed Tasks due to WLAN';'for Health App (%)', 'HEALTH_APP'}, 1);
plotGenericResult(2, 4, {'Failed Tasks due to WLAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 1);
plotGenericResult(2, 4, {'Failed Tasks due to WLAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 1);
plotGenericResult(3, 4, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 1);
plotGenericResult(3, 4, {'Failed Tasks due to WAN';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 1);
plotGenericResult(3, 4, {'Failed Tasks due to WAN';'for Health App (%)'}, 'HEALTH_APP', 1);
plotGenericResult(3, 4, {'Failed Tasks due to WAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 1);
plotGenericResult(3, 4, {'Failed Tasks due to WAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 1);
end