% make pretty plots

duration = 8765;  % collection time in minutes

load logins.quick
lq = round(logins ./ 60);
nq = 'quickstation-1';

load logins.cmp
lc = round(logins ./ 60);
nc = 'm56-129-2';

fprintf(1, '%-35s %15s %15s\n', '', nq, nc);
fprintf(1, '%-30s %15d %15d\n', 'total logins', max(size(lq)), max(size(lc)));
fprintf(1, '%-33s %15.2f %15.2f\n', 'logins per hour', ...
                       max(size(lq))*60./duration, max(size(lc))*60./duration);
fprintf(1, '%-33s %15.2f %15.2f\n', 'mean login time (minutes)', ...
                       mean(lq), mean(lc));
fprintf(1, '%-30s %15d %15d\n', 'median login time (minutes)', ...
                       median(lq), median(lc));

figure(1);
do_hist(lq, 1, 20);   title(nq);
xlabel('login time (minutes)');
ylabel('number of logins of specified duration');

figure(2);
do_hist(lq, 5, 120);   title(nq);
xlabel('login time (minutes)');
ylabel('number of logins in 5-minute range');

figure(3);
do_hist(lc, 5, 120);   title(nc);
xlabel('login time (minutes)');
ylabel('number of logins in 5-minute range');

figure(4);
do_hist(lq, 1, 20, duration/(60*24));   title(nq);
xlabel('login time (minutes)');
ylabel('number of logins of specified duration, per day');

figure(5);
do_hist(lq, 5, 120, duration/(60*24));   title(nq);
xlabel('login time (minutes)');
ylabel('number of logins in 5-minute range, per day');

figure(6);
do_hist(lc, 5, 120, duration/(60*24));   title(nc);
xlabel('login time (minutes)');
ylabel('number of logins in 5-minute range, per day');
