Timing Comet

Can you time the time it takes for comet to complete graphing? tic toc times the time it takes for the code to run but I want to time the time it takes to graph the function.
Any help would be appreciated.

 Accepted Answer

Walter Roberson
Walter Roberson on 4 May 2012

0 votes

No. Graphics operations are delegated to graphics drivers which can potentially operate independently of MATLAB (different threads, dedicated graphics cards, graphics might be built into the CPU and might or might not steal cycle time from ordinary operations.) When MATLAB regains control, the graphics is not necessarily completed, or it could be an arbitrary time after the graphics completed (e.g. because the operating system decided to take a coffee break while the disk defragments itself.)

More Answers (1)

Jan
Jan on 4 May 2012
I'm not sure what you are asking for. Perhaps this helps:
tic
...
drawnow
toc

3 Comments

Jack
Jack on 4 May 2012
So as I understand it, tic toc times the amount of time it takes for your computer to process the code. You use this function to try to make your code faster and compare results. Comet graphs a function as a moving point that leaves behind a line. The path comet will take is calculated before it starts to graph. If you have more data points comet will take longer to graph. I want to calculate the amount of time it takes for comet to graph. Walter Roberson's answer makes sense in that all computers have different graphics cards and each time it will be slightly different depending on what the computer is doing. The only thing I don't get about that is that the same argument would seem to be true for timing the time it takes to compute.
drawnow just refreshes the figure? So you can use the same figure again with different info?
I realize now that I can display the amount of points i am graphing as a measuring tool. Its not quite the same as a time but it should be of some use for comparison purposes.
Walter Roberson
Walter Roberson on 4 May 2012
How long does it take you to send a letter across the country? 2 minutes to address the envelope, 7 minutes to figure out where you put the stamps, 8 minutes to drive to a post box, 21 seconds to get out of the car and drop the letter in the postbox? And then since the letter is out of your hands and you can do other things, you consider yourself to be finished sending the letter? Or do you also count the time it between when you drop it in the postbox and it eventually ends up in the letter-box of the recipient?
MATLAB requests that graphics be done -- like dropping the letter in the letter box. But MATLAB has no way of knowing when the graphics is actually finished, just like you don't know when the person opened their letter-box and looked inside.
Jack
Jack on 4 May 2012
Cool, that makes a lot of sense. Thank You.

Sign in to comment.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!