% Test time to open figure with qt graphical toolkit
clear all
% Set graphics toolkit to test here:
graphics_toolkit('qt');

nwin=5;
profile on
profile off

for i=1:nwin
  figure('name',sprintf('This is window %d',i));
  t1=tic();
  profile resume
  plot([0,1],[0,1]);
  profile off
  tim(i) = toc(t1);
endfor
pause(1)
close all

printf('Current graphics toolkit is "%s"\n',graphics_toolkit());
printf('Window %d opening time: %.4f s\n',[1:nwin;tim]);

% Get profile information on plot command
t = profile('info');
% Sort profile by run time
[sortedTimes,idx] = sort(t.FunctionTable.TotalTime);
fts = t.FunctionTable(idx);
