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:
Time difference between tic toc and profile

Subject: Time difference between tic toc and profile

From: julie Wu

Date: 8 Jul, 2011 00:09:25

Message: 1 of 3

Hi,
I am trying to optimize a piece of code and timing it with profile and tic toc as follows:

profile on
tic;
[L,LD,LU,LR,LB,TR,inb,rnb,etr,trt,ru,lvl,swlvl,p]= ...
mfhssr_permA(A,tlvl,swlvl,minsep,profiler,storeL,checkerr,ctype,cpar);
toc
profile viewer

However, tic toc gives me:
Elapsed time is 3303.319000 seconds.
While profile gives:
mfhssr_permA (1 call, 1143.292 sec)

Does anyone have any insight as to why there is such a huge time difference and where the difference of ~2000 seconds could be from? Does this have anything to do with the fact that tic toc measures the elapsed time while profile measures the execution time?

Any help is greatly appreciated!
Thanks,
Julie

Subject: Time difference between tic toc and profile

From: Krishna Kumar

Date: 8 Jul, 2011 05:12:09

Message: 2 of 3

"julie Wu" <cinnawu@math.berkeley.edu> wrote in message <iv5hrl$8nb$1@newscl01ah.mathworks.com>...
> Hi,
> I am trying to optimize a piece of code and timing it with profile and tic toc as follows:
>
> profile on
> tic;
> [L,LD,LU,LR,LB,TR,inb,rnb,etr,trt,ru,lvl,swlvl,p]= ...
> mfhssr_permA(A,tlvl,swlvl,minsep,profiler,storeL,checkerr,ctype,cpar);
> toc
> profile viewer
>
> However, tic toc gives me:
> Elapsed time is 3303.319000 seconds.
> While profile gives:
>(1 call, 1143.292 sec)
>
> Does anyone have any insight as to why there is such a huge time difference and where the difference of ~2000 seconds could be from? Does this have anything to do with the fact that tic toc measures the elapsed time while profile measures the execution time?
>
> Any help is greatly appreciated!
> Thanks,
> Julie

Hi
 I think profiler has shown you time taken by this particular fn. The time taken by functions called by this mfhssr_permA are not included. whereas tic-toc shows the time taken by the fns clubbed together

Subject: Time difference between tic toc and profile

From: Rune Allnor

Date: 8 Jul, 2011 07:33:22

Message: 3 of 3

On Jul 8, 2:09 am, "julie Wu" <cinn...@math.berkeley.edu> wrote:
> Hi,
> I am trying to optimize a piece of code and timing it with profile and tic toc as follows:
>
> profile on
> tic;
> [L,LD,LU,LR,LB,TR,inb,rnb,etr,trt,ru,lvl,swlvl,p]= ...
> mfhssr_permA(A,tlvl,swlvl,minsep,profiler,storeL,checkerr,ctype,cpar);
> toc
> profile viewer
>
> However, tic toc gives me:
> Elapsed time is 3303.319000 seconds.
> While profile gives:
> mfhssr_permA (1 call, 1143.292 sec)
>
> Does anyone have any insight as to why there is such a huge time difference and where the difference of ~2000 seconds could be from? Does this have anything to do with the fact that tic toc measures the elapsed time while profile measures the execution time?

Yes.

Rune

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