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.
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?

Postby rob » Sat Jul 09, 2011 2:12 am

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: 12759
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to get millisecond and print it out?

Postby doublemax » Sat Jul 09, 2011 7:33 am

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?

Postby rob » Sat Jul 09, 2011 3:51 pm

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?

Postby rob » Sat Jul 09, 2011 6:20 pm

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: 12759
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to get millisecond and print it out?

Postby doublemax » Sat Jul 09, 2011 6:48 pm

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?

Postby rob » Sat Jul 09, 2011 11:33 pm

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?

Postby rob » Sun Jul 10, 2011 12:23 am

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: 12759
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to get millisecond and print it out?

Postby doublemax » Sun Jul 10, 2011 10:04 am

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?

Postby rob » Sun Jul 10, 2011 6:08 pm

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?

Postby Sarah Keys » Wed Feb 26, 2014 6:25 pm

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: 1741
Joined: Sun Jan 03, 2010 5:45 pm

Re: how to get millisecond and print it out?

Postby PB » Wed Feb 26, 2014 6:44 pm

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?

Postby Sarah Keys » Fri Mar 07, 2014 2:16 pm

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

Sarah


Return to “C++ Development”

Who is online

Users browsing this forum: No registered users and 21 guests