Author Topic: How to get program run time?  (Read 9922 times)

rEgonicS

  • Guest
How to get program run time?
« on: May 12, 2010, 04:10:53 am »
Sorry for the bad wording in the title because I wasn't sure as towards how to phrase it.
I was wondering if there's an option/setting/plugin that will return the length of time the program has been running for. I know that the IDE outputs the length of time the program has been running but it only tells me how long the program has been running until I actually close the window. Preferably, this feature would return the length of time the program has been running until it terminates and is accurate to the millisecond.

Note* I make console applications.

Thanks

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: How to get program run time?
« Reply #1 on: May 12, 2010, 04:25:37 am »
Research your operating system and you might find the right command.

I do not know of an part of Code::Blocks that does this; you might look at the profiling plug-in it would be my best guess of which plug-in might support your request.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline a14331990

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: How to get program run time?
« Reply #2 on: May 19, 2010, 10:46:20 am »
Windows Server 2003 Resource Kit Tools contains a useful tool called "timeit"
http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
For Linux, the built-in command "time" maybe enough, for example
$ time ./a.out
Hello!

real   0m0.003s
user   0m0.001s
sys   0m0.002s

You can also integrate  these two handy tools in the Tools menu, like this
Name: Timeit
Executable: timeit
Parameters: ${TARGET_OUTPUT_FILE}
Working Directory: ${PROJECT_DIR}
Hope this help.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to get program run time?
« Reply #3 on: May 23, 2010, 01:11:04 am »
rEgonicS: if you're on linux you can see the code of the time command
and then you can modify the console_runner application (part of C::B, you can find it in svn)
to show the information you need.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]