From: Richard on
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
From: Sean on
"Richard " <REMOVETHISrcaldwellie(a)yahoo.com> wrote in message <i3sch4$i3n$1(a)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
From: Matt Fig on
Why not just use the profiler?
From: Ross W on
"Richard " <REMOVETHISrcaldwellie(a)yahoo.com> wrote in message <i3sch4$i3n$1(a)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
From: Richard on
"Ross W" <rosswoodskiwi(a)hotmail.com> wrote in message <i3scua$elk$1(a)fred.mathworks.com>...
> "Richard " <REMOVETHISrcaldwellie(a)yahoo.com> wrote in message <i3sch4$i3n$1(a)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