view m-toolbox/classes/+utils/@helper/CPUbenchmark.m @ 40:977eb37f31cb database-connection-manager

User friendlier errors from utils.mysql.connect
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 18:04:03 +0100
parents f0afece42f48
children
line wrap: on
line source

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CPU benchmarking for comparing speeds among different
% architectures/computers.
%
% DESCRIPTION: CPUbenchmark provides a benchmark CPU time for comparison
%              among different architectures/computers. It gives the mean
%              CPU time and the mean error.
%
% CALL:        [a, b] = CPUbenchmark;
%
% VERSION:     $Id: CPUbenchmark.m,v 1.1 2011/02/03 13:34:47 congedo Exp $
%
% HISTORY:     02-02-2011 G. Congedo
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [avgT,stdT]=CPUbenchmark

 avgT = zeros(10,1);
 stdT = avgT;

 for jj=1:10
  m = zeros(100,1);
  for kk = 1:100
    tic
    for i = 1:1e4
    a = rand(10,10);
    a = a';
    end
    m(kk)=toc;
  end

  avgT(jj) = mean(m);
  stdT(jj) = std(m)/sqrt(numel(m));
  
 end
 
 avgT = mean(avgT);
 stdT = mean(stdT);

end