Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATLAB Profiling Lien-Chi Lai, COLA Lab 2010/05/06.

Similar presentations


Presentation on theme: "MATLAB Profiling Lien-Chi Lai, COLA Lab 2010/05/06."— Presentation transcript:

1 MATLAB Profiling Lien-Chi Lai, COLA Lab 2010/05/06

2 Outline  Tic & toc  Clock  Etime  Profile

3 Tic & Toc MATLAB Profiling3  tic – Start a stopwatch timer  toc – Read the stopwatch timer  tic and toc function work together to measure elapsed time between the two  Sample: Tic & Toc >> tic; % Start stopwatch >> inv(rand(500)); % Matrix inverse >> toc; % Stop and measure elapsed time

4 Clock MATLAB Profiling4  Returns current date and time as a vector  The vector is in a decimal form contains six element  [year month day hour minute seconds]  Sample : Clock >> fix(clock); % Rounds to integer display format ans = 2010 5 6 15 53 1

5 Etime MATLAB Profiling5  etime(t1, t0) returns the time in seconds that has elapsed between vectors t1 and t0  t0 and t1 must be the format returned by clock  Sample : Etime >> t0 = clock; % Record initial time >> inv(rand(500)); % Matrix inverse >> t1 = clock; % Record final time >> etime(t1, t0); % Measure elapsed time

6 Profile MATLAB Profiling6  Returns summary of function calls and total time  Sample : profile_test.m Profile % start the profiler and clear previous record profile on for i=1:10 inv(rand(100)); end % stop the profiler profile off % save profile record as html profile report profsave(profile('info'), 'profile_results') profile report % display profile report

7 Profile – GUI MATLAB Profiling7  As an alternative to the profile function  select Desktop > Profiler to open the Profiler  click the “Profiler” button  do not include “.m” in the “Run this code” field Profile - GUI

8 Other Resources MATLAB Profiling8  http://blogs.mathworks.com/videos/2006/10/19/pro filer-to-find-code-bottlenecks/ Profile - GUI


Download ppt "MATLAB Profiling Lien-Chi Lai, COLA Lab 2010/05/06."

Similar presentations


Ads by Google