diff --git a/.gitignore b/.gitignore index af5efaf..0e113b8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,9 @@ Desktop.ini # bin folder bin +# simulation output folder +sim_results + # eclipse's files .settings .classpath diff --git a/scripts/sample_app1/config/default_config.properties b/scripts/sample_app1/config/default_config.properties index 8abd908..f1c9f28 100644 --- a/scripts/sample_app1/config/default_config.properties +++ b/scripts/sample_app1/config/default_config.properties @@ -2,7 +2,7 @@ simulation_time=30 warm_up_period=3 vm_load_check_interval=0.1 -vm_location_check_interval=0.1 +location_check_interval=0.1 file_log_enabled=true deep_file_log_enabled=false diff --git a/scripts/sample_app1/matlab/plotGenericResult.m b/scripts/sample_app1/matlab/plotGenericResult.m index be15845..9e92ba8 100644 --- a/scripts/sample_app1/matlab/plotGenericResult.m +++ b/scripts/sample_app1/matlab/plotGenericResult.m @@ -21,7 +21,7 @@ function [] = plotGenericResult(rowOfset, columnOfset, yLabel, appType, calculat 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') + 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); diff --git a/scripts/sample_app1/matlab/plotTaskFailureReason.m b/scripts/sample_app1/matlab/plotTaskFailureReason.m index d8f2c8e..54f94bb 100644 --- a/scripts/sample_app1/matlab/plotTaskFailureReason.m +++ b/scripts/sample_app1/matlab/plotTaskFailureReason.m @@ -1,27 +1,27 @@ function [] = plotTaskFailureReason() plotGenericResult(1, 10, 'Failed Task due to VM Capacity (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(1, 11, 'Failed Task due to Mobility (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(5, 5, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(5, 7, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); end \ No newline at end of file diff --git a/scripts/sample_app2/config/default_config.properties b/scripts/sample_app2/config/default_config.properties index 68c237d..75e9047 100644 --- a/scripts/sample_app2/config/default_config.properties +++ b/scripts/sample_app2/config/default_config.properties @@ -2,7 +2,7 @@ simulation_time=30 warm_up_period=3 vm_load_check_interval=0.1 -vm_location_check_interval=0.1 +location_check_interval=0.1 file_log_enabled=true deep_file_log_enabled=false diff --git a/scripts/sample_app2/matlab/plotTaskFailureReason.m b/scripts/sample_app2/matlab/plotTaskFailureReason.m index 4e71b7f..a808001 100644 --- a/scripts/sample_app2/matlab/plotTaskFailureReason.m +++ b/scripts/sample_app2/matlab/plotTaskFailureReason.m @@ -1,33 +1,33 @@ function [] = plotTaskFailureReason() plotGenericResult(1, 10, 'Failed Task due to VM Capacity (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(1, 11, 'Failed Task due to Mobility (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(5, 5, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(5, 6, 'Failed Tasks due to MAN failure (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(5, 7, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); end \ No newline at end of file diff --git a/scripts/sample_app3/config/default_config.properties b/scripts/sample_app3/config/default_config.properties index 830d1a6..7c4fe34 100644 --- a/scripts/sample_app3/config/default_config.properties +++ b/scripts/sample_app3/config/default_config.properties @@ -2,7 +2,7 @@ simulation_time=33 warm_up_period=3 vm_load_check_interval=0.1 -vm_location_check_interval=0.1 +location_check_interval=0.1 file_log_enabled=true deep_file_log_enabled=false diff --git a/scripts/sample_app3/matlab/plotTaskFailureReason.m b/scripts/sample_app3/matlab/plotTaskFailureReason.m index e6216a0..daa6991 100644 --- a/scripts/sample_app3/matlab/plotTaskFailureReason.m +++ b/scripts/sample_app3/matlab/plotTaskFailureReason.m @@ -1,20 +1,20 @@ function [] = plotTaskFailureReason() plotGenericResult(1, 10, 'Failed Task due to VM Capacity (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(1, 11, 'Failed Task due to Mobility (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(1, 4, 'Failed Tasks due to Network failure (%)', 'ALL_APPS', 'percentage_for_failed'); - plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); - plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); - plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); - plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); + plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); + plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); + plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); + plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); end \ No newline at end of file diff --git a/scripts/sample_app4/config/default_config.properties b/scripts/sample_app4/config/default_config.properties index 9b58b8d..879a804 100644 --- a/scripts/sample_app4/config/default_config.properties +++ b/scripts/sample_app4/config/default_config.properties @@ -2,7 +2,7 @@ simulation_time=33 warm_up_period=3 vm_load_check_interval=0.1 -vm_location_check_interval=0.1 +location_check_interval=0.1 file_log_enabled=true deep_file_log_enabled=false diff --git a/scripts/sample_app4/matlab/plotTaskFailureReason.m b/scripts/sample_app4/matlab/plotTaskFailureReason.m index 2bd25b8..0bfee09 100755 --- a/scripts/sample_app4/matlab/plotTaskFailureReason.m +++ b/scripts/sample_app4/matlab/plotTaskFailureReason.m @@ -1,31 +1,31 @@ function [] = plotTaskFailureReason() plotGenericResult(1, 10, 'Failed Task due to VM Capacity (%)', 'ALL_APPS', 'percentage_for_failed'); -% plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); -% plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); -% plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); -% plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); +% plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); +% plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); +% plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); +% plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(1, 11, 'Average Failed Task due to Mobility (%)', 'ALL_APPS', 'percentage_for_failed'); -% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); -% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); -% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); -% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); +% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); +% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); +% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); +% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(5, 4, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed'); -% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); -% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); -% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); -% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); +% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); +% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); +% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); +% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(5, 5, 'Failed Tasks due to MAN failure (%)', 'ALL_APPS', 'percentage_for_failed'); -% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); -% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); -% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); -% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); +% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); +% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); +% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); +% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); plotGenericResult(5, 6, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed'); -% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed'); -% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Health App (%)'}, 'HEALTH_APP', 'for_failed'); -% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed'); -% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed'); +% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed'); +% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed'); +% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed'); +% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed'); end diff --git a/src/edu/boun/edgecloudsim/applications/sample_app2/MainApp.java b/src/edu/boun/edgecloudsim/applications/sample_app2/MainApp.java index a25df0c..8ee4f43 100644 --- a/src/edu/boun/edgecloudsim/applications/sample_app2/MainApp.java +++ b/src/edu/boun/edgecloudsim/applications/sample_app2/MainApp.java @@ -24,17 +24,17 @@ import edu.boun.edgecloudsim.utils.SimLogger; import edu.boun.edgecloudsim.utils.SimUtils; public class MainApp { - + /** * Creates main() to run this example */ public static void main(String[] args) { //disable console output of cloudsim library Log.disable(); - + //enable console output and file output of this application SimLogger.enablePrintLog(); - + int iterationNumber = 1; String configFile = ""; String outputFolder = ""; @@ -61,12 +61,12 @@ public class MainApp { SimLogger.printLine("cannot initialize simulation settings!"); System.exit(0); } - + if(SS.getFileLoggingEnabled()){ SimLogger.enableFileLog(); SimUtils.cleanOutputFolder(outputFolder); } - + DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date SimulationStartDate = Calendar.getInstance().getTime(); String now = df.format(SimulationStartDate); @@ -88,7 +88,7 @@ public class MainApp { SimLogger.printLine("Scenario: " + simScenario + " - Policy: " + orchestratorPolicy + " - #iteration: " + iterationNumber); SimLogger.printLine("Duration: " + SS.getSimulationTime()/60 + " min (warm up period: "+ SS.getWarmUpPeriod()/60 +" min) - #devices: " + j); SimLogger.getInstance().simStarted(outputFolder,"SIMRESULT_" + simScenario + "_" + orchestratorPolicy + "_" + j + "DEVICES"); - + try { // First step: Initialize the CloudSim package. It should be called @@ -96,16 +96,16 @@ public class MainApp { int num_user = 2; // number of grid users Calendar calendar = Calendar.getInstance(); boolean trace_flag = false; // mean trace events - + // Initialize the CloudSim library CloudSim.init(num_user, calendar, trace_flag, 0.01); - + // Generate EdgeCloudsim Scenario Factory ScenarioFactory sampleFactory = new SampleScenarioFactory(j,SS.getSimulationTime(), orchestratorPolicy, simScenario); - + // Generate EdgeCloudSim Simulation Manager SimManager manager = new SimManager(sampleFactory, j, simScenario, orchestratorPolicy); - + // Start simulation manager.startSimulation(); } @@ -115,7 +115,7 @@ public class MainApp { e.printStackTrace(); System.exit(0); } - + Date ScenarioEndDate = Calendar.getInstance().getTime(); now = df.format(ScenarioEndDate); SimLogger.printLine("Scenario finished at " + now + ". It took " + SimUtils.getTimeDifference(ScenarioStartDate,ScenarioEndDate)); diff --git a/src/edu/boun/edgecloudsim/applications/sample_app2/SampleMobileDeviceManager.java b/src/edu/boun/edgecloudsim/applications/sample_app2/SampleMobileDeviceManager.java index 4d808e1..fe0a776 100644 --- a/src/edu/boun/edgecloudsim/applications/sample_app2/SampleMobileDeviceManager.java +++ b/src/edu/boun/edgecloudsim/applications/sample_app2/SampleMobileDeviceManager.java @@ -298,7 +298,8 @@ public class SampleMobileDeviceManager extends MobileDeviceManager { task.setSubmittedLocation(currentLocation); //add related task to log list - SimLogger.getInstance().addLog(task.getCloudletId(), + SimLogger.getInstance().addLog(task.getMobileDeviceId(), + task.getCloudletId(), task.getTaskType(), (int)task.getCloudletLength(), (int)task.getCloudletFileSize(), diff --git a/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileDeviceManager.java b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileDeviceManager.java index 6eebe35..2d1cf1f 100644 --- a/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileDeviceManager.java +++ b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileDeviceManager.java @@ -191,7 +191,8 @@ public class SampleMobileDeviceManager extends MobileDeviceManager { task.setSubmittedLocation(currentLocation); //add related task to log list - SimLogger.getInstance().addLog(task.getCloudletId(), + SimLogger.getInstance().addLog(task.getMobileDeviceId(), + task.getCloudletId(), task.getTaskType(), (int)task.getCloudletLength(), (int)task.getCloudletFileSize(), diff --git a/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileServerManager.java b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileServerManager.java index 8e09050..da6e7a7 100644 --- a/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileServerManager.java +++ b/src/edu/boun/edgecloudsim/applications/sample_app3/SampleMobileServerManager.java @@ -166,7 +166,7 @@ public class SampleMobileServerManager extends MobileServerManager{ //4. Create Hosts with its id and list of PEs and add them to the list of machines MobileHost host = new MobileHost( //Hosts should have unique IDs, so create Mobile Hosts after Edge+Cloud Hosts - i+SimSettings.getInstance().getNumOfEdgeHosts()+SimSettings.getInstance().getNumOfCouldHost(), + i+SimSettings.getInstance().getNumOfEdgeHosts()+SimSettings.getInstance().getNumOfCloudHost(), new RamProvisionerSimple(ram), new BwProvisionerSimple(bandwidth), //kbps storage, diff --git a/src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyExperimentalNetworkModel.java b/src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyExperimentalNetworkModel.java index 0422db4..7b137fe 100644 --- a/src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyExperimentalNetworkModel.java +++ b/src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyExperimentalNetworkModel.java @@ -357,7 +357,7 @@ public class FuzzyExperimentalNetworkModel extends NetworkModel { return getWanDownloadDelay(accessPointLocation, dataSize); } - private double calculateMM1(double propogationDelay, double bandwidth /*Kbps*/, double PoissonMean, double avgTaskSize /*KB*/, int deviceCount){ + private double calculateMM1(double propagationDelay, double bandwidth /*Kbps*/, double PoissonMean, double avgTaskSize /*KB*/, int deviceCount){ double mu=0, lamda=0; avgTaskSize = avgTaskSize * 8; //convert from KB to Kb @@ -369,7 +369,7 @@ public class FuzzyExperimentalNetworkModel extends NetworkModel { if(result < 0) return 0; - result += propogationDelay; + result += propagationDelay; return (result > 15) ? 0 : result; } diff --git a/src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyMobileDeviceManager.java b/src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyMobileDeviceManager.java index e3eb421..951230e 100644 --- a/src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyMobileDeviceManager.java +++ b/src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyMobileDeviceManager.java @@ -286,7 +286,8 @@ public class FuzzyMobileDeviceManager extends MobileDeviceManager { task.setSubmittedLocation(currentLocation); //add related task to log list - SimLogger.getInstance().addLog(task.getCloudletId(), + SimLogger.getInstance().addLog(task.getMobileDeviceId(), + task.getCloudletId(), task.getTaskType(), (int)task.getCloudletLength(), (int)task.getCloudletFileSize(), diff --git a/src/edu/boun/edgecloudsim/cloud_server/CloudVM.java b/src/edu/boun/edgecloudsim/cloud_server/CloudVM.java index 6c71349..5702e07 100644 --- a/src/edu/boun/edgecloudsim/cloud_server/CloudVM.java +++ b/src/edu/boun/edgecloudsim/cloud_server/CloudVM.java @@ -20,7 +20,7 @@ import edu.boun.edgecloudsim.core.SimSettings; public class CloudVM extends Vm { private SimSettings.VM_TYPES type; - + public CloudVM(int id, int userId, double mips, int numberOfPes, int ram, long bw, long size, String vmm, CloudletScheduler cloudletScheduler) { super(id, userId, mips, numberOfPes, ram, bw, size, vmm, cloudletScheduler); @@ -32,15 +32,15 @@ public class CloudVM extends Vm { return type; } - /** - * dynamically reconfigures the mips value of a VM in CloudSim - * - * @param mips new mips value for this VM. - */ + /** + * dynamically reconfigures the mips value of a VM in CloudSim + * + * @param mips new mips value for this VM. + */ public void reconfigureMips(double mips){ super.setMips(mips); super.getHost().getVmScheduler().deallocatePesForVm(this); - + List mipsShareAllocated = new ArrayList(); for(int i= 0; i()); for(int j = 0; j < SimSettings.getInstance().getNumOfCloudVMsPerHost(); j++){ String vmm = "Xen"; @@ -131,7 +131,7 @@ public class DefaultCloudServerManager extends CloudServerManager{ // 1. We need to create a list to store one or more Machines List hostList = new ArrayList(); - for (int i = 0; i < SimSettings.getInstance().getNumOfCouldHost(); i++) { + for (int i = 0; i < SimSettings.getInstance().getNumOfCloudHost(); i++) { int numOfVMPerHost = SimSettings.getInstance().getNumOfCloudVMsPerHost(); int numOfCores = SimSettings.getInstance().getCoreForCloudVM() * numOfVMPerHost; double mips = SimSettings.getInstance().getMipsForCloudVM() * numOfVMPerHost; diff --git a/src/edu/boun/edgecloudsim/core/SimManager.java b/src/edu/boun/edgecloudsim/core/SimManager.java index e6a3f34..750df1f 100644 --- a/src/edu/boun/edgecloudsim/core/SimManager.java +++ b/src/edu/boun/edgecloudsim/core/SimManager.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.util.List; import org.cloudbus.cloudsim.Host; -import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.core.CloudSim; import org.cloudbus.cloudsim.core.SimEntity; import org.cloudbus.cloudsim.core.SimEvent; @@ -185,7 +184,7 @@ public class SimManager extends SimEntity { } } - for(int i = 0; i= 0 && index < taskLookUpTable.length) + result = taskLookUpTable[index]; + + return result; + } + public String getTaskName(int taskType) { return taskNames[taskType]; } - + private void isAttributePresent(Element element, String key) { - String value = element.getAttribute(key); - if (value.isEmpty() || value == null){ - throw new IllegalArgumentException("Attribute '" + key + "' is not found in '" + element.getNodeName() +"'"); - } + String value = element.getAttribute(key); + if (value.isEmpty() || value == null){ + throw new IllegalArgumentException("Attribute '" + key + "' is not found in '" + element.getNodeName() +"'"); + } } private void isElementPresent(Element element, String key) { try { String value = element.getElementsByTagName(key).item(0).getTextContent(); - if (value.isEmpty() || value == null){ - throw new IllegalArgumentException("Element '" + key + "' is not found in '" + element.getNodeName() +"'"); - } + if (value.isEmpty() || value == null){ + throw new IllegalArgumentException("Element '" + key + "' is not found in '" + element.getNodeName() +"'"); + } } catch (Exception e) { throw new IllegalArgumentException("Element '" + key + "' is not found in '" + element.getNodeName() +"'"); } } - + + private Boolean checkElement(Element element, String key) { + Boolean result = true; + try { + String value = element.getElementsByTagName(key).item(0).getTextContent(); + if (value.isEmpty() || value == null){ + result = false; + } + } catch (Exception e) { + result = false; + } + + return result; + } + private void parseApplicationsXML(String filePath) { Document doc = null; @@ -519,64 +617,55 @@ public class SimSettings { doc = dBuilder.parse(devicesFile); doc.getDocumentElement().normalize(); + String mandatoryAttributes[] = { + "usage_percentage", //usage percentage [0-100] + "prob_cloud_selection", //prob. of selecting cloud [0-100] + "poisson_interarrival", //poisson mean (sec) + "active_period", //active period (sec) + "idle_period", //idle period (sec) + "data_upload", //avg data upload (KB) + "data_download", //avg data download (KB) + "task_length", //avg task length (MI) + "required_core", //required # of core + "vm_utilization_on_edge", //vm utilization on edge vm [0-100] + "vm_utilization_on_cloud", //vm utilization on cloud vm [0-100] + "vm_utilization_on_mobile", //vm utilization on mobile vm [0-100] + "delay_sensitivity"}; //delay_sensitivity [0-1] + + String optionalAttributes[] = { + "max_delay_requirement"}; //maximum delay requirement (sec) + NodeList appList = doc.getElementsByTagName("application"); - taskLookUpTable = new double[appList.getLength()][13]; + taskLookUpTable = new double[appList.getLength()] + [mandatoryAttributes.length + optionalAttributes.length]; + taskNames = new String[appList.getLength()]; for (int i = 0; i < appList.getLength(); i++) { Node appNode = appList.item(i); - + Element appElement = (Element) appNode; isAttributePresent(appElement, "name"); - isElementPresent(appElement, "usage_percentage"); - isElementPresent(appElement, "prob_cloud_selection"); - isElementPresent(appElement, "poisson_interarrival"); - isElementPresent(appElement, "active_period"); - isElementPresent(appElement, "idle_period"); - isElementPresent(appElement, "data_upload"); - isElementPresent(appElement, "data_download"); - isElementPresent(appElement, "task_length"); - isElementPresent(appElement, "required_core"); - isElementPresent(appElement, "vm_utilization_on_edge"); - isElementPresent(appElement, "vm_utilization_on_cloud"); - isElementPresent(appElement, "vm_utilization_on_mobile"); - isElementPresent(appElement, "delay_sensitivity"); - String taskName = appElement.getAttribute("name"); taskNames[i] = taskName; - - double usage_percentage = Double.parseDouble(appElement.getElementsByTagName("usage_percentage").item(0).getTextContent()); - double prob_cloud_selection = Double.parseDouble(appElement.getElementsByTagName("prob_cloud_selection").item(0).getTextContent()); - double poisson_interarrival = Double.parseDouble(appElement.getElementsByTagName("poisson_interarrival").item(0).getTextContent()); - double active_period = Double.parseDouble(appElement.getElementsByTagName("active_period").item(0).getTextContent()); - double idle_period = Double.parseDouble(appElement.getElementsByTagName("idle_period").item(0).getTextContent()); - double data_upload = Double.parseDouble(appElement.getElementsByTagName("data_upload").item(0).getTextContent()); - double data_download = Double.parseDouble(appElement.getElementsByTagName("data_download").item(0).getTextContent()); - double task_length = Double.parseDouble(appElement.getElementsByTagName("task_length").item(0).getTextContent()); - double required_core = Double.parseDouble(appElement.getElementsByTagName("required_core").item(0).getTextContent()); - double vm_utilization_on_edge = Double.parseDouble(appElement.getElementsByTagName("vm_utilization_on_edge").item(0).getTextContent()); - double vm_utilization_on_cloud = Double.parseDouble(appElement.getElementsByTagName("vm_utilization_on_cloud").item(0).getTextContent()); - double vm_utilization_on_mobile = Double.parseDouble(appElement.getElementsByTagName("vm_utilization_on_mobile").item(0).getTextContent()); - double delay_sensitivity = Double.parseDouble(appElement.getElementsByTagName("delay_sensitivity").item(0).getTextContent()); - - taskLookUpTable[i][0] = usage_percentage; //usage percentage [0-100] - taskLookUpTable[i][1] = prob_cloud_selection; //prob. of selecting cloud [0-100] - taskLookUpTable[i][2] = poisson_interarrival; //poisson mean (sec) - taskLookUpTable[i][3] = active_period; //active period (sec) - taskLookUpTable[i][4] = idle_period; //idle period (sec) - taskLookUpTable[i][5] = data_upload; //avg data upload (KB) - taskLookUpTable[i][6] = data_download; //avg data download (KB) - taskLookUpTable[i][7] = task_length; //avg task length (MI) - taskLookUpTable[i][8] = required_core; //required # of core - taskLookUpTable[i][9] = vm_utilization_on_edge; //vm utilization on edge vm [0-100] - taskLookUpTable[i][10] = vm_utilization_on_cloud; //vm utilization on cloud vm [0-100] - taskLookUpTable[i][11] = vm_utilization_on_mobile; //vm utilization on mobile vm [0-100] - taskLookUpTable[i][12] = delay_sensitivity; //delay_sensitivity [0-1] + + for(int m=0; m mipsShareAllocated = new ArrayList(); + for(int i= 0; i edge orchestrator to edge device @@ -103,7 +103,7 @@ public class MM1Queue extends NetworkModel { double delay = 0; Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(destDeviceId,CloudSim.clock()); - + //cloud server to mobile device if(sourceDeviceId == SimSettings.CLOUD_DATACENTER_ID){ double wlanDelay = getWlanDownloadDelay(accessPointLocation, CloudSim.clock()); @@ -114,57 +114,57 @@ public class MM1Queue extends NetworkModel { //edge device (wifi access point) to mobile device else{ delay = getWlanDownloadDelay(accessPointLocation, CloudSim.clock()); - + EdgeHost host = (EdgeHost)(SimManager. getInstance(). getEdgeServerManager(). getDatacenterList().get(sourceDeviceId). getHostList().get(0)); - + //if source device id is the edge server which is located in another location, add internal lan delay //in our scenario, serving wlan ID is equal to the host id, because there is only one host in one place if(host.getLocation().getServingWlanId() != accessPointLocation.getServingWlanId()) delay += (SimSettings.getInstance().getInternalLanDelay() * 2); } - + return delay; } - + public int getMaxNumOfClientsInPlace(){ return maxNumOfClientsInPlace; } - + private int getDeviceCount(Location deviceLocation, double time){ int deviceCount = 0; - + for(int i=0; i 5) ? -1 : result; } - + private double getWlanDownloadDelay(Location accessPointLocation, double time) { return calculateMM1(0, SimSettings.getInstance().getWlanBandwidth(), @@ -172,7 +172,7 @@ public class MM1Queue extends NetworkModel { avgTaskOutputSize, getDeviceCount(accessPointLocation, time)); } - + private double getWlanUploadDelay(Location accessPointLocation, double time) { return calculateMM1(0, SimSettings.getInstance().getWlanBandwidth(), @@ -180,7 +180,7 @@ public class MM1Queue extends NetworkModel { avgTaskInputSize, getDeviceCount(accessPointLocation, time)); } - + private double getWanDownloadDelay(Location accessPointLocation, double time) { return calculateMM1(SimSettings.getInstance().getWanPropagationDelay(), SimSettings.getInstance().getWanBandwidth(), @@ -188,7 +188,7 @@ public class MM1Queue extends NetworkModel { avgTaskOutputSize, getDeviceCount(accessPointLocation, time)); } - + private double getWanUploadDelay(Location accessPointLocation, double time) { return calculateMM1(SimSettings.getInstance().getWanPropagationDelay(), SimSettings.getInstance().getWanBandwidth(), @@ -200,24 +200,24 @@ public class MM1Queue extends NetworkModel { @Override public void uploadStarted(Location accessPointLocation, int destDeviceId) { // TODO Auto-generated method stub - + } @Override public void uploadFinished(Location accessPointLocation, int destDeviceId) { // TODO Auto-generated method stub - + } @Override public void downloadStarted(Location accessPointLocation, int sourceDeviceId) { // TODO Auto-generated method stub - + } @Override public void downloadFinished(Location accessPointLocation, int sourceDeviceId) { // TODO Auto-generated method stub - + } } diff --git a/src/edu/boun/edgecloudsim/network/NetworkModel.java b/src/edu/boun/edgecloudsim/network/NetworkModel.java index e912654..6b56888 100644 --- a/src/edu/boun/edgecloudsim/network/NetworkModel.java +++ b/src/edu/boun/edgecloudsim/network/NetworkModel.java @@ -24,26 +24,26 @@ public abstract class NetworkModel { numberOfMobileDevices=_numberOfMobileDevices; simScenario = _simScenario; }; - + /** - * initializes custom network model - */ + * initializes custom network model + */ public abstract void initialize(); - - /** - * calculates the upload delay from source to destination device - */ + + /** + * calculates the upload delay from source to destination device + */ public abstract double getUploadDelay(int sourceDeviceId, int destDeviceId, Task task); - - /** - * calculates the download delay from source to destination device - */ + + /** + * calculates the download delay from source to destination device + */ public abstract double getDownloadDelay(int sourceDeviceId, int destDeviceId, Task task); - - /** - * Mobile device manager should inform network manager about the network operation - * This information may be important for some network delay models - */ + + /** + * Mobile device manager should inform network manager about the network operation + * This information may be important for some network delay models + */ public abstract void uploadStarted(Location accessPointLocation, int destDeviceId); public abstract void uploadFinished(Location accessPointLocation, int destDeviceId); public abstract void downloadStarted(Location accessPointLocation, int sourceDeviceId); diff --git a/src/edu/boun/edgecloudsim/task_generator/IdleActiveLoadGenerator.java b/src/edu/boun/edgecloudsim/task_generator/IdleActiveLoadGenerator.java index 8856e58..4130a4b 100644 --- a/src/edu/boun/edgecloudsim/task_generator/IdleActiveLoadGenerator.java +++ b/src/edu/boun/edgecloudsim/task_generator/IdleActiveLoadGenerator.java @@ -59,7 +59,7 @@ public class IdleActiveLoadGenerator extends LoadGeneratorModel{ } } if(randomTaskType == -1){ - SimLogger.printLine("Impossible is occured! no random task type!"); + SimLogger.printLine("Impossible is occurred! no random task type!"); continue; } diff --git a/src/edu/boun/edgecloudsim/task_generator/LoadGeneratorModel.java b/src/edu/boun/edgecloudsim/task_generator/LoadGeneratorModel.java index 9d518c4..feaaba8 100644 --- a/src/edu/boun/edgecloudsim/task_generator/LoadGeneratorModel.java +++ b/src/edu/boun/edgecloudsim/task_generator/LoadGeneratorModel.java @@ -29,6 +29,12 @@ public abstract class LoadGeneratorModel { simScenario=_simScenario; }; + /* + * Default Constructor: Creates an empty LoadGeneratorModel + */ + public LoadGeneratorModel() { + } + /* * each task has a virtual start time * it will be used while generating task diff --git a/src/edu/boun/edgecloudsim/utils/Location.java b/src/edu/boun/edgecloudsim/utils/Location.java index 9c322cf..f25e3b7 100644 --- a/src/edu/boun/edgecloudsim/utils/Location.java +++ b/src/edu/boun/edgecloudsim/utils/Location.java @@ -21,6 +21,12 @@ public class Location { yPos = _yPos; } + /* + * Default Constructor: Creates an empty Location + */ + public Location() { + } + @Override public boolean equals(Object other){ boolean result = false; diff --git a/src/edu/boun/edgecloudsim/utils/PoissonDistr.java b/src/edu/boun/edgecloudsim/utils/PoissonDistr.java index 9e3dc98..7821a54 100644 --- a/src/edu/boun/edgecloudsim/utils/PoissonDistr.java +++ b/src/edu/boun/edgecloudsim/utils/PoissonDistr.java @@ -1,8 +1,8 @@ /* * Title: EdgeCloudSim - Poisson Distribution - * + * * Description: Wrapper class for colt Poisson Distribution - * + * * Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Copyright (c) 2017, Bogazici University, Istanbul, Turkey */ @@ -20,31 +20,31 @@ public class PoissonDistr { Poisson poisson; RandomEngine engine; - /** - * Creates a new exponential number generator. - * - * @param mean the mean for the distribution. - */ - public PoissonDistr(double mean) { + /** + * Creates a new exponential number generator. + * + * @param mean the mean for the distribution. + */ + public PoissonDistr(double mean) { engine = new MersenneTwister(new Date()); poisson = new Poisson(mean, engine); - - //always sleep for some milliseconds in order not to have same seed for iterative PoissonDistr contruction + + //always sleep for some milliseconds in order not to have same seed for iterative PoissonDistr construction try { TimeUnit.MILLISECONDS.sleep(10); } catch (InterruptedException e) { - SimLogger.printLine("impossible is occurred! Poisson random number cannot be created!"); + SimLogger.printLine("impossible is occurred! Poisson random number cannot be created!"); e.printStackTrace(); - System.exit(0); + System.exit(1); } - } + } - /** - * Generate a new random number. - * - * @return the next random number in the sequence - */ - public double sample() { - return poisson.nextDouble(); - } + /** + * Generate a new random number. + * + * @return the next random number in the sequence + */ + public double sample() { + return poisson.nextDouble(); + } } diff --git a/src/edu/boun/edgecloudsim/utils/SimLogger.java b/src/edu/boun/edgecloudsim/utils/SimLogger.java index b6563ff..ff5d22a 100644 --- a/src/edu/boun/edgecloudsim/utils/SimLogger.java +++ b/src/edu/boun/edgecloudsim/utils/SimLogger.java @@ -8,6 +8,21 @@ * If you need more results or another file format, you should modify * this class. * + * IMPORTANT NOTES: + * EdgeCloudSim is designed to perform file logging operations with + * a low memory consumption. Deep file logging is performed whenever + * a task is completed. This may cause too many file IO operation and + * increase the time consumption! + * + * The basic results are kept in the memory, and saved to the files + * at the end of the simulation. So, basic file logging does + * bring too much overhead to the time complexity. + * + * In the earlier versions (v3 and older), EdgeCloudSim keeps all the + * task results in the memory and save them to the files when the + * simulation ends. Since this approach increases memory consumption + * too much, we sacrificed the time complexity. + * * Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Copyright (c) 2017, Bogazici University, Istanbul, Turkey */ @@ -31,21 +46,88 @@ import edu.boun.edgecloudsim.utils.SimLogger.NETWORK_ERRORS; public class SimLogger { public static enum TASK_STATUS { - CREATED, UPLOADING, PROCESSING, DOWNLOADING, COMPLETED, REJECTED_DUE_TO_VM_CAPACITY, REJECTED_DUE_TO_BANDWIDTH, UNFINISHED_DUE_TO_BANDWIDTH, UNFINISHED_DUE_TO_MOBILITY + CREATED, UPLOADING, PROCESSING, DOWNLOADING, COMLETED, + REJECTED_DUE_TO_VM_CAPACITY, REJECTED_DUE_TO_BANDWIDTH, + UNFINISHED_DUE_TO_BANDWIDTH, UNFINISHED_DUE_TO_MOBILITY, + REJECTED_DUE_TO_WLAN_COVERAGE } public static enum NETWORK_ERRORS { - LAN_ERROR, MAN_ERROR, WAN_ERROR, NONE + LAN_ERROR, MAN_ERROR, WAN_ERROR, GSM_ERROR, NONE } + private long startTime; + private long endTime; private static boolean fileLogEnabled; private static boolean printLogEnabled; private String filePrefix; private String outputFolder; private Map taskMap; private LinkedList vmLoadList; + private LinkedList apDelayList; private static SimLogger singleton = new SimLogger(); + + private int numOfAppTypes; + + private File successFile = null, failFile = null; + private FileWriter successFW = null, failFW = null; + private BufferedWriter successBW = null, failBW = null; + + // extract following values for each app type. + // last index is average of all app types + private int[] uncompletedTask = null; + private int[] uncompletedTaskOnCloud = null; + private int[] uncompletedTaskOnEdge = null; + private int[] uncompletedTaskOnMobile = null; + + private int[] completedTask = null; + private int[] completedTaskOnCloud = null; + private int[] completedTaskOnEdge = null; + private int[] completedTaskOnMobile = null; + + private int[] failedTask = null; + private int[] failedTaskOnCloud = null; + private int[] failedTaskOnEdge = null; + private int[] failedTaskOnMobile = null; + + private double[] networkDelay = null; + private double[] gsmDelay = null; + private double[] wanDelay = null; + private double[] manDelay = null; + private double[] lanDelay = null; + + private double[] gsmUsage = null; + private double[] wanUsage = null; + private double[] manUsage = null; + private double[] lanUsage = null; + + private double[] serviceTime = null; + private double[] serviceTimeOnCloud = null; + private double[] serviceTimeOnEdge = null; + private double[] serviceTimeOnMobile = null; + + private double[] processingTime = null; + private double[] processingTimeOnCloud = null; + private double[] processingTimeOnEdge = null; + private double[] processingTimeOnMobile = null; + + private int[] failedTaskDueToVmCapacity = null; + private int[] failedTaskDueToVmCapacityOnCloud = null; + private int[] failedTaskDueToVmCapacityOnEdge = null; + private int[] failedTaskDueToVmCapacityOnMobile = null; + + private double[] cost = null; + private double[] QoE = null; + private int[] failedTaskDuetoBw = null; + private int[] failedTaskDuetoLanBw = null; + private int[] failedTaskDuetoManBw = null; + private int[] failedTaskDuetoWanBw = null; + private int[] failedTaskDuetoGsmBw = null; + private int[] failedTaskDuetoMobility = null; + private int[] refectedTaskDuetoWlanRange = null; + + private double[] orchestratorOverhead = null; /* * A private Constructor prevents any other class from instantiating. @@ -72,9 +154,17 @@ public class SimLogger { return fileLogEnabled; } + public static void disableFileLog() { + fileLogEnabled = false; + } + public static void disablePrintLog() { printLogEnabled = false; } + + public String getOutputFolder() { + return outputFolder; + } private void appendToFile(BufferedWriter bw, String line) throws IOException { bw.write(line); @@ -92,16 +182,93 @@ public class SimLogger { } public void simStarted(String outFolder, String fileName) { + startTime = System.currentTimeMillis(); filePrefix = fileName; outputFolder = outFolder; taskMap = new HashMap(); vmLoadList = new LinkedList(); + apDelayList = new LinkedList(); + + numOfAppTypes = SimSettings.getInstance().getTaskLookUpTable().length; + + if (SimSettings.getInstance().getDeepFileLoggingEnabled()) { + try { + successFile = new File(outputFolder, filePrefix + "_SUCCESS.log"); + successFW = new FileWriter(successFile, true); + successBW = new BufferedWriter(successFW); + + failFile = new File(outputFolder, filePrefix + "_FAIL.log"); + failFW = new FileWriter(failFile, true); + failBW = new BufferedWriter(failFW); + + appendToFile(successBW, "#auto generated file!"); + appendToFile(failBW, "#auto generated file!"); + } catch (IOException e) { + e.printStackTrace(); + System.exit(1); + } + } + + // extract following values for each app type. + // last index is average of all app types + uncompletedTask = new int[numOfAppTypes + 1]; + uncompletedTaskOnCloud = new int[numOfAppTypes + 1]; + uncompletedTaskOnEdge = new int[numOfAppTypes + 1]; + uncompletedTaskOnMobile = new int[numOfAppTypes + 1]; + + completedTask = new int[numOfAppTypes + 1]; + completedTaskOnCloud = new int[numOfAppTypes + 1]; + completedTaskOnEdge = new int[numOfAppTypes + 1]; + completedTaskOnMobile = new int[numOfAppTypes + 1]; + + failedTask = new int[numOfAppTypes + 1]; + failedTaskOnCloud = new int[numOfAppTypes + 1]; + failedTaskOnEdge = new int[numOfAppTypes + 1]; + failedTaskOnMobile = new int[numOfAppTypes + 1]; + + networkDelay = new double[numOfAppTypes + 1]; + gsmDelay = new double[numOfAppTypes + 1]; + wanDelay = new double[numOfAppTypes + 1]; + manDelay = new double[numOfAppTypes + 1]; + lanDelay = new double[numOfAppTypes + 1]; + + gsmUsage = new double[numOfAppTypes + 1]; + wanUsage = new double[numOfAppTypes + 1]; + manUsage = new double[numOfAppTypes + 1]; + lanUsage = new double[numOfAppTypes + 1]; + + serviceTime = new double[numOfAppTypes + 1]; + serviceTimeOnCloud = new double[numOfAppTypes + 1]; + serviceTimeOnEdge = new double[numOfAppTypes + 1]; + serviceTimeOnMobile = new double[numOfAppTypes + 1]; + + processingTime = new double[numOfAppTypes + 1]; + processingTimeOnCloud = new double[numOfAppTypes + 1]; + processingTimeOnEdge = new double[numOfAppTypes + 1]; + processingTimeOnMobile = new double[numOfAppTypes + 1]; + + failedTaskDueToVmCapacity = new int[numOfAppTypes + 1]; + failedTaskDueToVmCapacityOnCloud = new int[numOfAppTypes + 1]; + failedTaskDueToVmCapacityOnEdge = new int[numOfAppTypes + 1]; + failedTaskDueToVmCapacityOnMobile = new int[numOfAppTypes + 1]; + + cost = new double[numOfAppTypes + 1]; + QoE = new double[numOfAppTypes + 1]; + failedTaskDuetoBw = new int[numOfAppTypes + 1]; + failedTaskDuetoLanBw = new int[numOfAppTypes + 1]; + failedTaskDuetoManBw = new int[numOfAppTypes + 1]; + failedTaskDuetoWanBw = new int[numOfAppTypes + 1]; + failedTaskDuetoGsmBw = new int[numOfAppTypes + 1]; + failedTaskDuetoMobility = new int[numOfAppTypes + 1]; + refectedTaskDuetoWlanRange = new int[numOfAppTypes + 1]; + + orchestratorOverhead = new double[numOfAppTypes + 1]; } - public void addLog(int taskId, int taskType, int taskLenght, int taskInputType, - int taskOutputSize) { + public void addLog(int deviceId, int taskId, int taskType, + int taskLenght, int taskInputType, int taskOutputSize) { // printLine(taskId+"->"+taskStartTime); - taskMap.put(taskId, new LogItem(taskType, taskLenght, taskInputType, taskOutputSize)); + taskMap.put(taskId, new LogItem(deviceId, taskType, taskLenght, taskInputType, taskOutputSize)); } public void taskStarted(int taskId, double time) { @@ -126,34 +293,57 @@ public class SimLogger { public void taskEnded(int taskId, double time) { taskMap.get(taskId).taskEnded(time); + recordLog(taskId); } public void rejectedDueToVMCapacity(int taskId, double time, int vmType) { taskMap.get(taskId).taskRejectedDueToVMCapacity(time, vmType); + recordLog(taskId); } + public void rejectedDueToWlanCoverage(int taskId, double time, int vmType) { + taskMap.get(taskId).taskRejectedDueToWlanCoverage(time, vmType); + recordLog(taskId); + } + public void rejectedDueToBandwidth(int taskId, double time, int vmType, NETWORK_DELAY_TYPES delayType) { taskMap.get(taskId).taskRejectedDueToBandwidth(time, vmType, delayType); + recordLog(taskId); } public void failedDueToBandwidth(int taskId, double time, NETWORK_DELAY_TYPES delayType) { taskMap.get(taskId).taskFailedDueToBandwidth(time, delayType); + recordLog(taskId); } public void failedDueToMobility(int taskId, double time) { taskMap.get(taskId).taskFailedDueToMobility(time); + recordLog(taskId); + } + + public void setQoE(int taskId, double QoE){ + taskMap.get(taskId).setQoE(QoE); + } + + public void setOrchestratorOverhead(int taskId, double overhead){ + taskMap.get(taskId).setOrchestratorOverhead(overhead); } public void addVmUtilizationLog(double time, double loadOnEdge, double loadOnCloud, double loadOnMobile) { - vmLoadList.add(new VmLoadLogItem(time, loadOnEdge, loadOnCloud, loadOnMobile)); + if(SimSettings.getInstance().getLocationLogInterval() != 0) + vmLoadList.add(new VmLoadLogItem(time, loadOnEdge, loadOnCloud, loadOnMobile)); } + public void addApDelayLog(double time, double[] apUploadDelays, double[] apDownloadDelays) { + if(SimSettings.getInstance().getApDelayLogInterval() != 0) + apDelayList.add(new ApDelayLogItem(time, apUploadDelays, apDownloadDelays)); + } + public void simStopped() throws IOException { - int numOfAppTypes = SimSettings.getInstance().getTaskLookUpTable().length; - - File successFile = null, failFile = null, vmLoadFile = null, locationFile = null; - FileWriter successFW = null, failFW = null, vmLoadFW = null, locationFW = null; - BufferedWriter successBW = null, failBW = null, vmLoadBW = null, locationBW = null; + endTime = System.currentTimeMillis(); + File vmLoadFile = null, locationFile = null, apUploadDelayFile = null, apDownloadDelayFile = null; + FileWriter vmLoadFW = null, locationFW = null, apUploadDelayFW = null, apDownloadDelayFW = null; + BufferedWriter vmLoadBW = null, locationBW = null, apUploadDelayBW = null, apDownloadDelayBW = null; // Save generic results to file for each app type. last index is average // of all app types @@ -161,66 +351,8 @@ public class SimLogger { FileWriter[] genericFWs = new FileWriter[numOfAppTypes + 1]; BufferedWriter[] genericBWs = new BufferedWriter[numOfAppTypes + 1]; - // extract following values for each app type. last index is average of - // all app types - int[] uncompletedTask = new int[numOfAppTypes + 1]; - int[] uncompletedTaskOnCloud = new int[numOfAppTypes + 1]; - int[] uncompletedTaskOnEdge = new int[numOfAppTypes + 1]; - int[] uncompletedTaskOnMobile = new int[numOfAppTypes + 1]; - - int[] completedTask = new int[numOfAppTypes + 1]; - int[] completedTaskOnCloud = new int[numOfAppTypes + 1]; - int[] completedTaskOnEdge = new int[numOfAppTypes + 1]; - int[] completedTaskOnMobile = new int[numOfAppTypes + 1]; - - int[] failedTask = new int[numOfAppTypes + 1]; - int[] failedTaskOnCloud = new int[numOfAppTypes + 1]; - int[] failedTaskOnEdge = new int[numOfAppTypes + 1]; - int[] failedTaskOnMobile = new int[numOfAppTypes + 1]; - - double[] networkDelay = new double[numOfAppTypes + 1]; - double[] wanDelay = new double[numOfAppTypes + 1]; - double[] manDelay = new double[numOfAppTypes + 1]; - double[] lanDelay = new double[numOfAppTypes + 1]; - - double[] wanUsage = new double[numOfAppTypes + 1]; - double[] manUsage = new double[numOfAppTypes + 1]; - double[] lanUsage = new double[numOfAppTypes + 1]; - - double[] serviceTime = new double[numOfAppTypes + 1]; - double[] serviceTimeOnCloud = new double[numOfAppTypes + 1]; - double[] serviceTimeOnEdge = new double[numOfAppTypes + 1]; - double[] serviceTimeOnMobile = new double[numOfAppTypes + 1]; - - double[] processingTime = new double[numOfAppTypes + 1]; - double[] processingTimeOnCloud = new double[numOfAppTypes + 1]; - double[] processingTimeOnEdge = new double[numOfAppTypes + 1]; - double[] processingTimeOnMobile = new double[numOfAppTypes + 1]; - - int[] failedTaskDueToVmCapacity = new int[numOfAppTypes + 1]; - int[] failedTaskDueToVmCapacityOnCloud = new int[numOfAppTypes + 1]; - int[] failedTaskDueToVmCapacityOnEdge = new int[numOfAppTypes + 1]; - int[] failedTaskDueToVmCapacityOnMobile = new int[numOfAppTypes + 1]; - - double[] cost = new double[numOfAppTypes + 1]; - int[] failedTaskDuetoBw = new int[numOfAppTypes + 1]; - int[] failedTaskDuetoLanBw = new int[numOfAppTypes + 1]; - int[] failedTaskDuetoManBw = new int[numOfAppTypes + 1]; - int[] failedTaskDuetoWanBw = new int[numOfAppTypes + 1]; - int[] failedTaskDuetoMobility = new int[numOfAppTypes + 1]; - // open all files and prepare them for write if (fileLogEnabled) { - if (SimSettings.getInstance().getDeepFileLoggingEnabled()) { - successFile = new File(outputFolder, filePrefix + "_SUCCESS.log"); - successFW = new FileWriter(successFile, true); - successBW = new BufferedWriter(successFW); - - failFile = new File(outputFolder, filePrefix + "_FAIL.log"); - failFW = new FileWriter(failFile, true); - failBW = new BufferedWriter(failFW); - } - vmLoadFile = new File(outputFolder, filePrefix + "_VM_LOAD.log"); vmLoadFW = new FileWriter(vmLoadFile, true); vmLoadBW = new BufferedWriter(vmLoadFW); @@ -229,12 +361,19 @@ public class SimLogger { locationFW = new FileWriter(locationFile, true); locationBW = new BufferedWriter(locationFW); + apUploadDelayFile = new File(outputFolder, filePrefix + "_AP_UPLOAD_DELAY.log"); + apUploadDelayFW = new FileWriter(apUploadDelayFile, true); + apUploadDelayBW = new BufferedWriter(apUploadDelayFW); + + apDownloadDelayFile = new File(outputFolder, filePrefix + "_AP_DOWNLOAD_DELAY.log"); + apDownloadDelayFW = new FileWriter(apDownloadDelayFile, true); + apDownloadDelayBW = new BufferedWriter(apDownloadDelayFW); + for (int i = 0; i < numOfAppTypes + 1; i++) { String fileName = "ALL_APPS_GENERIC.log"; if (i < numOfAppTypes) { - // if related app is not used in this simulation, just - // discard it + // if related app is not used in this simulation, just discard it if (SimSettings.getInstance().getTaskLookUpTable()[i][0] == 0) continue; @@ -247,121 +386,23 @@ public class SimLogger { appendToFile(genericBWs[i], "#auto generated file!"); } - if (SimSettings.getInstance().getDeepFileLoggingEnabled()) { - appendToFile(successBW, "#auto generated file!"); - appendToFile(failBW, "#auto generated file!"); - } - appendToFile(vmLoadBW, "#auto generated file!"); appendToFile(locationBW, "#auto generated file!"); + appendToFile(apUploadDelayBW, "#auto generated file!"); + appendToFile(apDownloadDelayBW, "#auto generated file!"); } - // extract the result of each task and write it to the file if required + //the tasks in the map is not completed yet! for (Map.Entry entry : taskMap.entrySet()) { - Integer key = entry.getKey(); LogItem value = entry.getValue(); - if (value.isInWarmUpPeriod()) - continue; - - if (value.getStatus() == SimLogger.TASK_STATUS.COMPLETED) { - completedTask[value.getTaskType()]++; - - if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) - completedTaskOnCloud[value.getTaskType()]++; - else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) - completedTaskOnMobile[value.getTaskType()]++; - else - completedTaskOnEdge[value.getTaskType()]++; - } - else if(value.getStatus() == SimLogger.TASK_STATUS.CREATED || - value.getStatus() == SimLogger.TASK_STATUS.UPLOADING || - value.getStatus() == SimLogger.TASK_STATUS.PROCESSING || - value.getStatus() == SimLogger.TASK_STATUS.DOWNLOADING) - { - uncompletedTask[value.getTaskType()]++; - if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) - uncompletedTaskOnCloud[value.getTaskType()]++; - else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) - uncompletedTaskOnMobile[value.getTaskType()]++; - else - uncompletedTaskOnEdge[value.getTaskType()]++; - } - else { - failedTask[value.getTaskType()]++; - - if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) - failedTaskOnCloud[value.getTaskType()]++; - else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) - failedTaskOnMobile[value.getTaskType()]++; - else - failedTaskOnEdge[value.getTaskType()]++; - } - - if (value.getStatus() == SimLogger.TASK_STATUS.COMPLETED) { - cost[value.getTaskType()] += value.getCost(); - serviceTime[value.getTaskType()] += value.getServiceTime(); - networkDelay[value.getTaskType()] += value.getNetworkDelay(); - processingTime[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay()); - - if(value.getNetworkDelay(NETWORK_DELAY_TYPES.WLAN_DELAY) != 0) { - lanUsage[value.getTaskType()]++; - lanDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.WLAN_DELAY); - } - if(value.getNetworkDelay(NETWORK_DELAY_TYPES.MAN_DELAY) != 0) { - manUsage[value.getTaskType()]++; - manDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.MAN_DELAY); - } - if(value.getNetworkDelay(NETWORK_DELAY_TYPES.WAN_DELAY) != 0) { - wanUsage[value.getTaskType()]++; - wanDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.WAN_DELAY); - } - - - if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) { - serviceTimeOnCloud[value.getTaskType()] += value.getServiceTime(); - processingTimeOnCloud[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay()); - } - else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) { - serviceTimeOnMobile[value.getTaskType()] += value.getServiceTime(); - processingTimeOnMobile[value.getTaskType()] += value.getServiceTime(); - } - else { - serviceTimeOnEdge[value.getTaskType()] += value.getServiceTime(); - processingTimeOnEdge[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay()); - } - - if (fileLogEnabled && SimSettings.getInstance().getDeepFileLoggingEnabled()) - appendToFile(successBW, value.toString(key)); - } else if (value.getStatus() == SimLogger.TASK_STATUS.REJECTED_DUE_TO_VM_CAPACITY) { - failedTaskDueToVmCapacity[value.getTaskType()]++; - - if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) - failedTaskDueToVmCapacityOnCloud[value.getTaskType()]++; - else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) - failedTaskDueToVmCapacityOnMobile[value.getTaskType()]++; - else - failedTaskDueToVmCapacityOnEdge[value.getTaskType()]++; - - if (fileLogEnabled && SimSettings.getInstance().getDeepFileLoggingEnabled()) - appendToFile(failBW, value.toString(key)); - } else if (value.getStatus() == SimLogger.TASK_STATUS.REJECTED_DUE_TO_BANDWIDTH - || value.getStatus() == SimLogger.TASK_STATUS.UNFINISHED_DUE_TO_BANDWIDTH) { - failedTaskDuetoBw[value.getTaskType()]++; - if (value.getNetworkError() == NETWORK_ERRORS.LAN_ERROR) - failedTaskDuetoLanBw[value.getTaskType()]++; - else if (value.getNetworkError() == NETWORK_ERRORS.MAN_ERROR) - failedTaskDuetoManBw[value.getTaskType()]++; - else if (value.getNetworkError() == NETWORK_ERRORS.WAN_ERROR) - failedTaskDuetoWanBw[value.getTaskType()]++; - - if (fileLogEnabled && SimSettings.getInstance().getDeepFileLoggingEnabled()) - appendToFile(failBW, value.toString(key)); - } else if (value.getStatus() == SimLogger.TASK_STATUS.UNFINISHED_DUE_TO_MOBILITY) { - failedTaskDuetoMobility[value.getTaskType()]++; - if (fileLogEnabled && SimSettings.getInstance().getDeepFileLoggingEnabled()) - appendToFile(failBW, value.toString(key)); - } + uncompletedTask[value.getTaskType()]++; + if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) + uncompletedTaskOnCloud[value.getTaskType()]++; + else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) + uncompletedTaskOnMobile[value.getTaskType()]++; + else + uncompletedTaskOnEdge[value.getTaskType()]++; } // calculate total values @@ -384,10 +425,12 @@ public class SimLogger { lanDelay[numOfAppTypes] = DoubleStream.of(lanDelay).sum(); manDelay[numOfAppTypes] = DoubleStream.of(manDelay).sum(); wanDelay[numOfAppTypes] = DoubleStream.of(wanDelay).sum(); + gsmDelay[numOfAppTypes] = DoubleStream.of(gsmDelay).sum(); lanUsage[numOfAppTypes] = DoubleStream.of(lanUsage).sum(); manUsage[numOfAppTypes] = DoubleStream.of(manUsage).sum(); wanUsage[numOfAppTypes] = DoubleStream.of(wanUsage).sum(); + gsmUsage[numOfAppTypes] = DoubleStream.of(gsmUsage).sum(); serviceTime[numOfAppTypes] = DoubleStream.of(serviceTime).sum(); serviceTimeOnCloud[numOfAppTypes] = DoubleStream.of(serviceTimeOnCloud).sum(); @@ -405,12 +448,17 @@ public class SimLogger { failedTaskDueToVmCapacityOnMobile[numOfAppTypes] = IntStream.of(failedTaskDueToVmCapacityOnMobile).sum(); cost[numOfAppTypes] = DoubleStream.of(cost).sum(); + QoE[numOfAppTypes] = DoubleStream.of(QoE).sum(); failedTaskDuetoBw[numOfAppTypes] = IntStream.of(failedTaskDuetoBw).sum(); + failedTaskDuetoGsmBw[numOfAppTypes] = IntStream.of(failedTaskDuetoGsmBw).sum(); failedTaskDuetoWanBw[numOfAppTypes] = IntStream.of(failedTaskDuetoWanBw).sum(); failedTaskDuetoManBw[numOfAppTypes] = IntStream.of(failedTaskDuetoManBw).sum(); failedTaskDuetoLanBw[numOfAppTypes] = IntStream.of(failedTaskDuetoLanBw).sum(); failedTaskDuetoMobility[numOfAppTypes] = IntStream.of(failedTaskDuetoMobility).sum(); + refectedTaskDuetoWlanRange[numOfAppTypes] = IntStream.of(refectedTaskDuetoWlanRange).sum(); + orchestratorOverhead[numOfAppTypes] = DoubleStream.of(orchestratorOverhead).sum(); + // calculate server load double totalVmLoadOnEdge = 0; double totalVmLoadOnCloud = 0; @@ -419,39 +467,47 @@ public class SimLogger { totalVmLoadOnEdge += entry.getEdgeLoad(); totalVmLoadOnCloud += entry.getCloudLoad(); totalVmLoadOnMobile += entry.getMobileLoad(); - if (fileLogEnabled) + if (fileLogEnabled && SimSettings.getInstance().getVmLoadLogInterval() != 0) appendToFile(vmLoadBW, entry.toString()); } if (fileLogEnabled) { - // write location info to file - for (int t = 1; t < (SimSettings.getInstance().getSimulationTime() - / SimSettings.getInstance().getVmLocationLogInterval()); t++) { - int[] locationInfo = new int[SimSettings.getInstance().getNumOfPlaceTypes()]; - Double time = t * SimSettings.getInstance().getVmLocationLogInterval(); + // write location info to file for each location + // assuming each location has only one access point + double locationLogInterval = SimSettings.getInstance().getLocationLogInterval(); + if(locationLogInterval != 0) { + for (int t = 1; t < (SimSettings.getInstance().getSimulationTime() / locationLogInterval); t++) { + int[] locationInfo = new int[SimSettings.getInstance().getNumOfEdgeDatacenters()]; + Double time = t * SimSettings.getInstance().getLocationLogInterval(); + + if (time < SimSettings.CLIENT_ACTIVITY_START_TIME) + continue; - if (time < SimSettings.getInstance().getWarmUpPeriod()) - continue; + for (int i = 0; i < SimManager.getInstance().getNumOfMobileDevice(); i++) { + Location loc = SimManager.getInstance().getMobilityModel().getLocation(i, time); + locationInfo[loc.getServingWlanId()]++; + } - for (int i = 0; i < SimManager.getInstance().getNumOfMobileDevice(); i++) { + locationBW.write(time.toString()); + for (int i = 0; i < locationInfo.length; i++) + locationBW.write(SimSettings.DELIMITER + locationInfo[i]); - Location loc = SimManager.getInstance().getMobilityModel().getLocation(i, time); - int placeTypeIndex = loc.getPlaceTypeIndex(); - locationInfo[placeTypeIndex]++; + locationBW.newLine(); + } + } + + // write delay info to file for each access point + if(SimSettings.getInstance().getApDelayLogInterval() != 0) { + for (ApDelayLogItem entry : apDelayList) { + appendToFile(apUploadDelayBW, entry.getUploadStat()); + appendToFile(apDownloadDelayBW, entry.getDownloadStat()); } - - locationBW.write(time.toString()); - for (int i = 0; i < locationInfo.length; i++) - locationBW.write(SimSettings.DELIMITER + locationInfo[i]); - - locationBW.newLine(); } for (int i = 0; i < numOfAppTypes + 1; i++) { if (i < numOfAppTypes) { - // if related app is not used in this simulation, just - // discard it + // if related app is not used in this simulation, just discard it if (SimSettings.getInstance().getTaskLookUpTable()[i][0] == 0) continue; } @@ -465,6 +521,8 @@ public class SimLogger { double _vmLoadOnClould = (vmLoadList.size() == 0) ? 0.0 : (totalVmLoadOnCloud / (double) vmLoadList.size()); double _vmLoadOnMobile = (vmLoadList.size() == 0) ? 0.0 : (totalVmLoadOnMobile / (double) vmLoadList.size()); double _cost = (completedTask[i] == 0) ? 0.0 : (cost[i] / (double) completedTask[i]); + double _QoE1 = (completedTask[i] == 0) ? 0.0 : (QoE[i] / (double) completedTask[i]); + double _QoE2 = (completedTask[i] == 0) ? 0.0 : (QoE[i] / (double) (failedTask[i] + completedTask[i])); double _lanDelay = (lanUsage[i] == 0) ? 0.0 : (lanDelay[i] / (double) lanUsage[i]); @@ -472,7 +530,9 @@ public class SimLogger { : (manDelay[i] / (double) manUsage[i]); double _wanDelay = (wanUsage[i] == 0) ? 0.0 : (wanDelay[i] / (double) wanUsage[i]); - + double _gsmDelay = (gsmUsage[i] == 0) ? 0.0 + : (gsmDelay[i] / (double) gsmUsage[i]); + // write generic results String genericResult1 = Integer.toString(completedTask[i]) + SimSettings.DELIMITER + Integer.toString(failedTask[i]) + SimSettings.DELIMITER @@ -484,7 +544,10 @@ public class SimLogger { + Double.toString(0) + SimSettings.DELIMITER + Double.toString(_cost) + SimSettings.DELIMITER + Integer.toString(failedTaskDueToVmCapacity[i]) + SimSettings.DELIMITER - + Integer.toString(failedTaskDuetoMobility[i]); + + Integer.toString(failedTaskDuetoMobility[i]) + SimSettings.DELIMITER + + Double.toString(_QoE1) + SimSettings.DELIMITER + + Double.toString(_QoE2) + SimSettings.DELIMITER + + Integer.toString(refectedTaskDuetoWlanRange[i]); // check if the divisor is zero in order to avoid division by zero problem double _serviceTimeOnEdge = (completedTaskOnEdge[i] == 0) ? 0.0 @@ -534,16 +597,48 @@ public class SimLogger { String genericResult5 = Double.toString(_lanDelay) + SimSettings.DELIMITER + Double.toString(_manDelay) + SimSettings.DELIMITER + Double.toString(_wanDelay) + SimSettings.DELIMITER - + 0 + SimSettings.DELIMITER //for future use + + Double.toString(_gsmDelay) + SimSettings.DELIMITER + Integer.toString(failedTaskDuetoLanBw[i]) + SimSettings.DELIMITER + Integer.toString(failedTaskDuetoManBw[i]) + SimSettings.DELIMITER - + Integer.toString(failedTaskDuetoWanBw[i]); + + Integer.toString(failedTaskDuetoWanBw[i]) + SimSettings.DELIMITER + + Integer.toString(failedTaskDuetoGsmBw[i]); + + //performance related values + double _orchestratorOverhead = orchestratorOverhead[i] / (double) (failedTask[i] + completedTask[i]); + + String genericResult6 = Long.toString((endTime-startTime)/60) + SimSettings.DELIMITER + + Double.toString(_orchestratorOverhead); + appendToFile(genericBWs[i], genericResult1); appendToFile(genericBWs[i], genericResult2); appendToFile(genericBWs[i], genericResult3); appendToFile(genericBWs[i], genericResult4); appendToFile(genericBWs[i], genericResult5); + + //append performance related values only to ALL_ALLPS file + if(i == numOfAppTypes) { + appendToFile(genericBWs[i], genericResult6); + } + else { + printLine(SimSettings.getInstance().getTaskName(i)); + printLine("# of tasks (Edge/Cloud): " + + (failedTask[i] + completedTask[i]) + "(" + + (failedTaskOnEdge[i] + completedTaskOnEdge[i]) + "/" + + (failedTaskOnCloud[i]+ completedTaskOnCloud[i]) + ")" ); + + printLine("# of failed tasks (Edge/Cloud): " + + failedTask[i] + "(" + + failedTaskOnEdge[i] + "/" + + failedTaskOnCloud[i] + ")"); + + printLine("# of completed tasks (Edge/Cloud): " + + completedTask[i] + "(" + + completedTaskOnEdge[i] + "/" + + completedTaskOnCloud[i] + ")"); + + printLine("---------------------------------------"); + } } // close open files @@ -553,6 +648,8 @@ public class SimLogger { } vmLoadBW.close(); locationBW.close(); + apUploadDelayBW.close(); + apDownloadDelayBW.close(); for (int i = 0; i < numOfAppTypes + 1; i++) { if (i < numOfAppTypes) { // if related app is not used in this simulation, just @@ -562,6 +659,7 @@ public class SimLogger { } genericBWs[i].close(); } + } // printout important results @@ -595,12 +693,14 @@ public class SimLogger { + failedTaskDueToVmCapacityOnCloud[numOfAppTypes] + "/" + failedTaskDueToVmCapacityOnMobile[numOfAppTypes] + ")"); - printLine("# of failed tasks due to Mobility/Network(WLAN/MAN/WAN): " + printLine("# of failed tasks due to Mobility/WLAN Range/Network(WLAN/MAN/WAN/GSM): " + failedTaskDuetoMobility[numOfAppTypes] + + "/" + refectedTaskDuetoWlanRange[numOfAppTypes] + "/" + failedTaskDuetoBw[numOfAppTypes] + "(" + failedTaskDuetoLanBw[numOfAppTypes] + "/" + failedTaskDuetoManBw[numOfAppTypes] - + "/" + failedTaskDuetoWanBw[numOfAppTypes] + ")"); + + "/" + failedTaskDuetoWanBw[numOfAppTypes] + + "/" + failedTaskDuetoGsmBw[numOfAppTypes] + ")"); printLine("percentage of failed tasks: " + String.format("%.6f", ((double) failedTask[numOfAppTypes] * (double) 100) @@ -634,18 +734,128 @@ public class SimLogger { + ", " + "MAN delay: " + String.format("%.6f", manDelay[numOfAppTypes] / (double) manUsage[numOfAppTypes]) + ", " + "WAN delay: " - + String.format("%.6f", wanDelay[numOfAppTypes] / (double) wanUsage[numOfAppTypes]) + ")"); + + String.format("%.6f", wanDelay[numOfAppTypes] / (double) wanUsage[numOfAppTypes]) + + ", " + "GSM delay: " + + String.format("%.6f", gsmDelay[numOfAppTypes] / (double) gsmUsage[numOfAppTypes]) + ")"); printLine("average server utilization Edge/Cloud/Mobile: " + String.format("%.6f", totalVmLoadOnEdge / (double) vmLoadList.size()) + "/" + String.format("%.6f", totalVmLoadOnCloud / (double) vmLoadList.size()) + "/" + String.format("%.6f", totalVmLoadOnMobile / (double) vmLoadList.size())); - + printLine("average cost: " + cost[numOfAppTypes] / completedTask[numOfAppTypes] + "$"); + printLine("average overhead: " + orchestratorOverhead[numOfAppTypes] / (failedTask[numOfAppTypes] + completedTask[numOfAppTypes]) + " ns"); + printLine("average QoE (for all): " + QoE[numOfAppTypes] / (failedTask[numOfAppTypes] + completedTask[numOfAppTypes]) + "%"); + printLine("average QoE (for executed): " + QoE[numOfAppTypes] / completedTask[numOfAppTypes] + "%"); // clear related collections (map list etc.) taskMap.clear(); vmLoadList.clear(); + apDelayList.clear(); + } + + private void recordLog(int taskId){ + LogItem value = taskMap.remove(taskId); + + if (value.isInWarmUpPeriod()) + return; + + if (value.getStatus() == SimLogger.TASK_STATUS.COMLETED) { + completedTask[value.getTaskType()]++; + + if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) + completedTaskOnCloud[value.getTaskType()]++; + else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) + completedTaskOnMobile[value.getTaskType()]++; + else + completedTaskOnEdge[value.getTaskType()]++; + } + else { + failedTask[value.getTaskType()]++; + + if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) + failedTaskOnCloud[value.getTaskType()]++; + else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) + failedTaskOnMobile[value.getTaskType()]++; + else + failedTaskOnEdge[value.getTaskType()]++; + } + + if (value.getStatus() == SimLogger.TASK_STATUS.COMLETED) { + cost[value.getTaskType()] += value.getCost(); + QoE[value.getTaskType()] += value.getQoE(); + serviceTime[value.getTaskType()] += value.getServiceTime(); + networkDelay[value.getTaskType()] += value.getNetworkDelay(); + processingTime[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay()); + orchestratorOverhead[value.getTaskType()] += value.getOrchestratorOverhead(); + + if(value.getNetworkDelay(NETWORK_DELAY_TYPES.WLAN_DELAY) != 0) { + lanUsage[value.getTaskType()]++; + lanDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.WLAN_DELAY); + } + if(value.getNetworkDelay(NETWORK_DELAY_TYPES.MAN_DELAY) != 0) { + manUsage[value.getTaskType()]++; + manDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.MAN_DELAY); + } + if(value.getNetworkDelay(NETWORK_DELAY_TYPES.WAN_DELAY) != 0) { + wanUsage[value.getTaskType()]++; + wanDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.WAN_DELAY); + } + if(value.getNetworkDelay(NETWORK_DELAY_TYPES.GSM_DELAY) != 0) { + gsmUsage[value.getTaskType()]++; + gsmDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.GSM_DELAY); + } + + if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) { + serviceTimeOnCloud[value.getTaskType()] += value.getServiceTime(); + processingTimeOnCloud[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay()); + } + else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) { + serviceTimeOnMobile[value.getTaskType()] += value.getServiceTime(); + processingTimeOnMobile[value.getTaskType()] += value.getServiceTime(); + } + else { + serviceTimeOnEdge[value.getTaskType()] += value.getServiceTime(); + processingTimeOnEdge[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay()); + } + } else if (value.getStatus() == SimLogger.TASK_STATUS.REJECTED_DUE_TO_VM_CAPACITY) { + failedTaskDueToVmCapacity[value.getTaskType()]++; + + if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) + failedTaskDueToVmCapacityOnCloud[value.getTaskType()]++; + else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) + failedTaskDueToVmCapacityOnMobile[value.getTaskType()]++; + else + failedTaskDueToVmCapacityOnEdge[value.getTaskType()]++; + } else if (value.getStatus() == SimLogger.TASK_STATUS.REJECTED_DUE_TO_BANDWIDTH + || value.getStatus() == SimLogger.TASK_STATUS.UNFINISHED_DUE_TO_BANDWIDTH) { + failedTaskDuetoBw[value.getTaskType()]++; + if (value.getNetworkError() == NETWORK_ERRORS.LAN_ERROR) + failedTaskDuetoLanBw[value.getTaskType()]++; + else if (value.getNetworkError() == NETWORK_ERRORS.MAN_ERROR) + failedTaskDuetoManBw[value.getTaskType()]++; + else if (value.getNetworkError() == NETWORK_ERRORS.WAN_ERROR) + failedTaskDuetoWanBw[value.getTaskType()]++; + else if (value.getNetworkError() == NETWORK_ERRORS.GSM_ERROR) + failedTaskDuetoGsmBw[value.getTaskType()]++; + } else if (value.getStatus() == SimLogger.TASK_STATUS.UNFINISHED_DUE_TO_MOBILITY) { + failedTaskDuetoMobility[value.getTaskType()]++; + } else if (value.getStatus() == SimLogger.TASK_STATUS.REJECTED_DUE_TO_WLAN_COVERAGE) { + refectedTaskDuetoWlanRange[value.getTaskType()]++;; + } + + //if deep file logging is enabled, record every task result + if (SimSettings.getInstance().getDeepFileLoggingEnabled()){ + try { + if (value.getStatus() == SimLogger.TASK_STATUS.COMLETED) + appendToFile(successBW, value.toString(taskId)); + else + appendToFile(failBW, value.toString(taskId)); + } catch (IOException e) { + e.printStackTrace(); + System.exit(1); + } + } } } @@ -682,9 +892,38 @@ class VmLoadLogItem { } } +class ApDelayLogItem { + private double time; + private double apUploadDelays[]; + double[] apDownloadDelays; + + ApDelayLogItem(double _time, double[] _apUploadDelays, double[] _apDownloadDelays){ + time = _time; + apUploadDelays = _apUploadDelays; + apDownloadDelays = _apDownloadDelays; + } + + public String getUploadStat() { + String result = Double.toString(time); + for(int i=0; i0) result += diffInDays + ((diffInDays>1 == true) ? " Days " : " Day "); if(diffInHours>0) @@ -79,7 +82,7 @@ public class SimUtils { result += diffInSeconds % 60 + ((diffInSeconds>1 == true) ? " Seconds" : " Second"); if(diffInMilli>0 && result.isEmpty()) result += diffInMilli + ((diffInMilli>1 == true) ? " Milli Seconds" : " Milli Second"); - + return result; } } diff --git a/src/edu/boun/edgecloudsim/utils/TaskProperty.java b/src/edu/boun/edgecloudsim/utils/TaskProperty.java index fe77a11..e5b9a70 100644 --- a/src/edu/boun/edgecloudsim/utils/TaskProperty.java +++ b/src/edu/boun/edgecloudsim/utils/TaskProperty.java @@ -15,59 +15,69 @@ import org.apache.commons.math3.distribution.ExponentialDistribution; import edu.boun.edgecloudsim.core.SimSettings; public class TaskProperty { - private double startTime; - private long length, inputFileSize, outputFileSize; - private int taskType; - private int pesNumber; - private int mobileDeviceId; - - public TaskProperty(double _startTime, int _mobileDeviceId, int _taskType, int _pesNumber, long _length, long _inputFileSize, long _outputFileSize) { - startTime=_startTime; - mobileDeviceId=_mobileDeviceId; - taskType=_taskType; - pesNumber = _pesNumber; - length = _length; - outputFileSize = _inputFileSize; - inputFileSize = _outputFileSize; - } - - public TaskProperty(int _mobileDeviceId, int _taskType, double _startTime, ExponentialDistribution[][] expRngList) { - mobileDeviceId=_mobileDeviceId; - startTime=_startTime; - taskType=_taskType; - - inputFileSize = (long)expRngList[_taskType][0].sample(); - outputFileSize =(long)expRngList[_taskType][1].sample(); - length = (long)expRngList[_taskType][2].sample(); - - pesNumber = (int)SimSettings.getInstance().getTaskLookUpTable()[_taskType][8]; - } - - public double getStartTime(){ - return startTime; - } - - public long getLength(){ - return length; - } - - public long getInputFileSize(){ - return inputFileSize; - } - - public long getOutputFileSize(){ - return outputFileSize; - } + private double startTime; + private long length, inputFileSize, outputFileSize; + private int taskType; + private int pesNumber; + private int mobileDeviceId; - public int getTaskType(){ - return taskType; - } - - public int getPesNumber(){ - return pesNumber; - } - - public int getMobileDeviceId(){ - return mobileDeviceId; - } + public TaskProperty(double _startTime, int _mobileDeviceId, int _taskType, int _pesNumber, long _length, long _inputFileSize, long _outputFileSize) { + startTime=_startTime; + mobileDeviceId=_mobileDeviceId; + taskType=_taskType; + pesNumber = _pesNumber; + length = _length; + outputFileSize = _inputFileSize; + inputFileSize = _outputFileSize; + } + + public TaskProperty(int _mobileDeviceId, int _taskType, double _startTime, ExponentialDistribution[][] expRngList) { + mobileDeviceId=_mobileDeviceId; + startTime=_startTime; + taskType=_taskType; + + inputFileSize = (long)expRngList[_taskType][0].sample(); + outputFileSize =(long)expRngList[_taskType][1].sample(); + length = (long)expRngList[_taskType][2].sample(); + + pesNumber = (int)SimSettings.getInstance().getTaskLookUpTable()[_taskType][8]; + } + + public TaskProperty(int mobileDeviceId, double startTime, ExponentialDistribution[] expRngList) { + this.mobileDeviceId = mobileDeviceId; + this.startTime = startTime; + taskType = 0; + inputFileSize = (long)expRngList[0].sample(); + outputFileSize = (long)expRngList[1].sample(); + length = (long) expRngList[2].sample(); + pesNumber = (int)SimSettings.getInstance().getTaskLookUpTable()[0][8]; + } + + public double getStartTime(){ + return startTime; + } + + public long getLength(){ + return length; + } + + public long getInputFileSize(){ + return inputFileSize; + } + + public long getOutputFileSize(){ + return outputFileSize; + } + + public int getTaskType(){ + return taskType; + } + + public int getPesNumber(){ + return pesNumber; + } + + public int getMobileDeviceId(){ + return mobileDeviceId; + } }