×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Help:how to use timers in functions

Help:how to use timers in functions

Help:how to use timers in functions

(OP)
how to use timers to know the execution time of a paticular funtion that  i am calling.

RE: Help:how to use timers in functions

Try looking at the help pages for "tic", "toc" and "profile"

M

--
Dr Michael F Platten

RE: Help:how to use timers in functions

(OP)
thanks for that mike.

RE: Help:how to use timers in functions

(OP)
actually i am calling a function in my main program twice with different inputs each time.

so i want to know the time taken for two calls.

i tried this

tic
[output1]=function[input1]
toc
time1=toc;

tic
[output2]=function[input2]
toc
time2=toc;

but its not giving correct results ,
i am getting time2<time1

but for my input2 when it goes to that called function it usually takes more time than for input1.so i should get time2>time1

so if i want to know the execution time of a function for two different inputs , is this the right way i am doing
or is there any other way to do this.

if so please let me know about that



RE: Help:how to use timers in functions

"tic" and "toc" do not give you a very accurate measurement (although I think you can control the accuracy to a degree). Of course the execution time also varies depending on what else your computer is doing at the time. Maybe have a play with the "cputime" function.

M

--
Dr Michael F Platten

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources