view m-toolbox/classes/+utils/@helper/CPUbenchmark.m @ 51:9d5c88356247 database-connection-manager

Make unit tests database connection parameters configurable
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +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