News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

How to get program run time?

Started by rEgonicS, May 12, 2010, 04:10:53 AM

Previous topic - Next topic

rEgonicS

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

stahta01

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

a14331990

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.

oBFusCATed

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!]