Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
determine speed bottleneck in code

Subject: determine speed bottleneck in code

From: Richard

Date: 10 Aug, 2010 20:24:04

Message: 1 of 5

Hi, I've a simulation that takes nearly an hour to run for 1 iteration. I've been using tic and toc to determine what sections take longest to run but there are certain sections like function calls that run an unknown number of times. Is there a way to use tic and toc around a section of code and get a 'total' execution time duirng a complete simulation run? i.e. the sum of all times it runs or is called
Thanks!

Richard

Subject: determine speed bottleneck in code

From: Sean

Date: 10 Aug, 2010 20:28:21

Message: 2 of 5

"Richard " <REMOVETHISrcaldwellie@yahoo.com> wrote in message <i3sch4$i3n$1@fred.mathworks.com>...
> Hi, I've a simulation that takes nearly an hour to run for 1 iteration. I've been using tic and toc to determine what sections take longest to run but there are certain sections like function calls that run an unknown number of times. Is there a way to use tic and toc around a section of code and get a 'total' execution time duirng a complete simulation run? i.e. the sum of all times it runs or is called
> Thanks!
>
> Richard

doc profile

Subject: determine speed bottleneck in code

From: Matt Fig

Date: 10 Aug, 2010 20:30:26

Message: 3 of 5

Why not just use the profiler?

Subject: determine speed bottleneck in code

From: Ross W

Date: 10 Aug, 2010 20:31:06

Message: 4 of 5

"Richard " <REMOVETHISrcaldwellie@yahoo.com> wrote in message <i3sch4$i3n$1@fred.mathworks.com>...
> Hi, I've a simulation that takes nearly an hour to run for 1 iteration. I've been using tic and toc to determine what sections take longest to run but there are certain sections like function calls that run an unknown number of times. Is there a way to use tic and toc around a section of code and get a 'total' execution time duirng a complete simulation run? i.e. the sum of all times it runs or is called
> Thanks!
>
> Richard

There's a tool called profile

help profile

This is designed to do the sort of thing you describe

Ross

Subject: determine speed bottleneck in code

From: Richard

Date: 10 Aug, 2010 21:34:06

Message: 5 of 5

"Ross W" <rosswoodskiwi@hotmail.com> wrote in message <i3scua$elk$1@fred.mathworks.com>...
> "Richard " <REMOVETHISrcaldwellie@yahoo.com> wrote in message <i3sch4$i3n$1@fred.mathworks.com>...
> > Hi, I've a simulation that takes nearly an hour to run for 1 iteration. I've been using tic and toc to determine what sections take longest to run but there are certain sections like function calls that run an unknown number of times. Is there a way to use tic and toc around a section of code and get a 'total' execution time duirng a complete simulation run? i.e. the sum of all times it runs or is called
> > Thanks!
> >
> > Richard
>
> There's a tool called profile
>
> help profile
>
> This is designed to do the sort of thing you describe
>
> Ross
delighted I asked. Thanks v. much

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us