|
| 1 | +format longG |
| 2 | + |
| 3 | +stringCSV = 'ResponseCodesPerSecond'; |
| 4 | +dataID = '4'; |
| 5 | +data = readtable(strcat('/Users/mymac/Documents/SCRIPTSHEET/SKRIPSI/data_jmeter/4/',strcat(stringCSV,'.csv')), 'ReadVariableNames', false, 'HeaderLines', 1); |
| 6 | + |
| 7 | +% ini untuk format date seperti halnya di jmeter ya |
| 8 | +% x = seconds((datenum(datestr(data.ElapsedTime, 'yyyy-mm-dd hh:MM:ss.fff')) - datenum(datestr(data{1,1}, 'yyyy-mm-dd hh:MM:ss.fff'))) * 100000); |
| 9 | +% x.Format = 'hh:mm:ss'; |
| 10 | + |
| 11 | +markers = {'+','*','.','o','x','v','d','^','s','>','<','v','p','h','p','v','<','>','s','^','d','v','x','o','.','*'}; |
| 12 | +colors = {'r','b','m','k','y','c','g','r','b','m','k','y'}; |
| 13 | +lines = {'-','--',':','-.',':','--'}; |
| 14 | +line_width = 0.9; |
| 15 | +marker_size = 5; |
| 16 | +marker_counter = 1; |
| 17 | +color_counter = 1; |
| 18 | +line_counter = 1; |
| 19 | +ylabels='Response times (ms)'; |
| 20 | +ylabelslat = 'Response latencies (ms)'; |
| 21 | +ylabels1='Number of threads'; |
| 22 | +ylabels2='Mega Bytes (MB)'; |
| 23 | +ylabelstruput='Mega Bytes (MB) per second'; |
| 24 | +ylabels3='TCP connections'; |
| 25 | +ythread='Number of active threads'; |
| 26 | +%legend_base_name = 'Worker-'; |
| 27 | +legend_base_name = 'HTTP Request-'; |
| 28 | + |
| 29 | + |
| 30 | +% kalo ini format number dalam menit elapsed time |
| 31 | +x = (datenum(datestr(data{:,1}, 'yyyy-mm-dd hh:MM:ss.fff')) - datenum(datestr(data{1,1}, 'yyyy-mm-dd hh:MM:ss.fff'))) * 100000/60; |
| 32 | +% ini untuk data x yang pure number aja, bukan elapsed time |
| 33 | +%x = data{:,1}; |
| 34 | + |
| 35 | +hold on |
| 36 | +if(size(data,2) == 2) |
| 37 | + markers = {'.'}; |
| 38 | + colors = {'r'}; |
| 39 | + ylabel(ylabels,'FontSize',14); |
| 40 | +end |
| 41 | + |
| 42 | +for i=1:size(data,2)-1 |
| 43 | + if(size(data,2) <= 2) |
| 44 | + % ini untuk khusus yang 1 kolom saja |
| 45 | + scatter(x,data{:,i+1},strcat(colors{color_counter},markers{marker_counter}),'DisplayName',strcat(legend_base_name,sprintf('%.0f',i))); |
| 46 | + else |
| 47 | + if(strcmp(stringCSV, 'BytesThroughputOverTime') || strcmp(stringCSV,'ResponseCodesPerSecond')) |
| 48 | + markers = {'.'}; |
| 49 | + colors = {'r','b','g','m'}; |
| 50 | + ylabel(ylabels,'FontSize',14); |
| 51 | + scatter(x,data{:,i+1}/1000000,strcat(colors{color_counter},markers{marker_counter})); |
| 52 | + else |
| 53 | + plot(x,data{:,i+1},strcat(lines{line_counter},strcat(colors{color_counter},markers{marker_counter})),'MarkerSize',marker_size,'LineWidth',line_width,'DisplayName',strcat(legend_base_name,sprintf('%.0f',i))); |
| 54 | + end |
| 55 | + end |
| 56 | + |
| 57 | + if mod(i, size(markers,2)) == 0 |
| 58 | + marker_counter = 1; |
| 59 | + else |
| 60 | + marker_counter=marker_counter+1; |
| 61 | + end |
| 62 | + |
| 63 | + if mod(i, size(colors,2)) == 0 |
| 64 | + color_counter = 1; |
| 65 | + else |
| 66 | + color_counter=color_counter+1; |
| 67 | + end |
| 68 | + |
| 69 | + if mod(i,size(lines,2)) == 0 |
| 70 | + line_counter = 1; |
| 71 | + else |
| 72 | + line_counter=line_counter+1; |
| 73 | + end |
| 74 | +end |
| 75 | + |
| 76 | + |
| 77 | +box on; |
| 78 | +grid on; |
| 79 | + |
| 80 | +ax = gca; |
| 81 | +ax.YAxis.Exponent = 0; |
| 82 | +ax.GridLineStyle = ':'; |
| 83 | +ax.GridAlpha = 0.3; |
| 84 | +ax.LineWidth = 0.9; |
| 85 | +set(gca,'FontSize',16) |
| 86 | + |
| 87 | +if(strcmp(stringCSV, 'BytesThroughputOverTime') || strcmp(stringCSV,'ResponseCodesPerSecond')) |
| 88 | + legend('Bytes received per second','Bytes sent per second'); |
| 89 | +end |
| 90 | +legend('show'); |
| 91 | +lgd = legend; |
| 92 | +%lgd.FontSize=7; |
| 93 | +%lgd.Location = 'northWest'; |
| 94 | + |
| 95 | +set(gcf,'Units','Inches'); |
| 96 | + |
| 97 | +%title({'Threads State over Time (50K RPS)','Instance Type (m5.2xlarge/m5a.2xlarge)'},'FontSize',14); |
| 98 | +%title({'HTTP Response Times over Time (50K RPS)','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 99 | +title({'HTTP Latencies over Time (50K RPS)','Instance Type (m5.xlarge/m5a.xlarge)'},'FontSize',14); |
| 100 | +%title({'Bytes Throughput over Time (50K RPS)','Instance Type (m5.2xlarge/m5a.2xlarge)'},'FontSize',15); |
| 101 | + |
| 102 | +xlabel('Elapsed time (minutes), Granulation: 500 ms','FontSize',15); |
| 103 | +ylabel(ylabelslat,'FontSize',15); |
| 104 | +pos = get(gcf,'Position'); |
| 105 | +set(findall(gcf,'-property','FontName'),'FontName','Times New Roman'); |
| 106 | +set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)]); |
| 107 | +print(gcf,'-dpdf',strcat('hasilgrafik/',strcat(dataID,stringCSV)),'-r0'); |
| 108 | +% print -dpdf -painters hasilgrafik/1a |
| 109 | +hold off; |
| 110 | + |
0 commit comments