% This is the plotting script for the figure in the paper
% i.e. wall clock time and LUT changes with the number of threads
% written by Jianyi Cheng, 26112018

[num,txt,benchmark] = xlsread('histogram.xlsx'); % load benchmark data

figure;
hold on;
k = 1;          % for the case of equal number of banks and threads

table_length = 11;
table_width = 13;

% wall clock time 

    yyaxis left;
    threads = cell2mat(benchmark(k*table_length-9, [3:13]));
    wct_before = cell2mat(benchmark(k*table_length-8, [3:13]))./cell2mat(benchmark(k*table_length-5, [3:13]));
    wct_after = cell2mat(benchmark(k*table_length-4, [3:13]))./cell2mat(benchmark(k*table_length-1, [3:13]));

    plot(threads, wct_before, '--*', 'LineWidth', 1.5);
    plot(threads, wct_after, '-*', 'LineWidth', 1.5);

    ylabel('Wall clock time {\it t_w_c} - us','Interpreter','tex');

% LUT count
    
    yyaxis right
    threads = cell2mat(benchmark(k*table_length-9, [3:13]));
    lut_before = cell2mat(benchmark(k*table_length-7, [3:13]));
    lut_after = cell2mat(benchmark(k*table_length-3, [3:13]));

    plot(threads, lut_before, '--*', 'LineWidth', 1.5);
    plot(threads, lut_after, '-*', 'LineWidth', 1.5);

    ylabel('LUT count');
    xlabel('Number of threads');
    legend('t_w_c before', 't_w_c after', 'LUT before', 'LUT after');
