how to get millisecond and print it out?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
rob
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Jun 28, 2011 2:20 am

how to get millisecond and print it out?

Post by rob »

hi,
i am a newby, i am new to c++. i have a very basic question. how do i sandwich a function to see how many millisecond it take to runs?
thanks
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to get millisecond and print it out?

Post by doublemax »

Use the source, Luke!
rob
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Jun 28, 2011 2:20 am

Re: how to get millisecond and print it out?

Post by rob »

thanks doublemax. it will probably takes me couple of days to digest it. i really appreciate it.
rob
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Jun 28, 2011 2:20 am

Re: how to get millisecond and print it out?

Post by rob »

hi doublemax:

i looked at the stopwatch.h and found that Time() is declared but not defined. is that the header file of mine is inadequate? when i called the Time(), the compiler gave me an undefined error. i thought that the include statement in my program <wx/stopwatch.h> is incorrect but it did not generate any error.
please help.
thanks.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to get millisecond and print it out?

Post by doublemax »

Do you get a compiler or linker error?

Also, which platform/IDE/compiler are you using?

If you're totally new to c++ and wxWidgets, you should start by getting the wxWidgets "minimal" sample to compile. That makes sure you have all the include directories and libraries correct.
Use the source, Luke!
rob
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Jun 28, 2011 2:20 am

Re: how to get millisecond and print it out?

Post by rob »

hi,
i got linker errors and i used wxDevc++. i don't know what you mean by minimal sample?
thanks for reply.
rob
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Jun 28, 2011 2:20 am

Re: how to get millisecond and print it out?

Post by rob »

hi,
i did not use wxwidget, i wrote a program basically a procedural oriented C type program. it run just fine. i used time.h's time() to measure a function. but it only returned time in seconds. when it run, i usually got o second. that is why i want to benchmark it with milliseconds.
thanks.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to get millisecond and print it out?

Post by doublemax »

AFAIK there is no easy standard way to get millisecond accuracy.

Maybe this helps:
http://stackoverflow.com/questions/3613 ... ing-ansi-c
Use the source, Luke!
rob
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Jun 28, 2011 2:20 am

Re: how to get millisecond and print it out?

Post by rob »

thank you very much. it helps a lot.
bye.
Sarah Keys
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Jan 02, 2014 3:55 pm

Re: how to get millisecond and print it out?

Post by Sarah Keys »

I was just looking for this and I've found this thread.
www.ipillows.net
When I click the link it says Documentation Not Found :( 21 day fix video
Thanks Best Phone Grip
Days to Fitness Ted Reviews
Sarah Tycoon Addon
Last edited by Sarah Keys on Wed Jul 15, 2015 4:17 pm, edited 3 times in total.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: how to get millisecond and print it out?

Post by PB »

You were just one click away from the page, all you needed was to select the version. Anyway, here it goes

current version: http://docs.wxwidgets.org/trunk/classwx_stop_watch.html
old version 2.8.12: http://docs.wxwidgets.org/2.8.12/wx_wxstopwatch.html
Sarah Keys
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Jan 02, 2014 3:55 pm

Re: how to get millisecond and print it out?

Post by Sarah Keys »

Ah you are right :oops: . Thanks for the help :)

Sarah
Post Reply