Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: rEgonicS on May 12, 2010, 04:10:53 am

Title: How to get program run time?
Post by: rEgonicS 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
Title: Re: How to get program run time?
Post by: stahta01 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.
Title: Re: How to get program run time?
Post by: a14331990 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.
Title: Re: How to get program run time?
Post by: oBFusCATed 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.