Hi,

On Fri, Jun 10, 2011 at 7:55 AM, vivek dhiman <[email protected]>wrote:

> What are the commands to see how much long my code is running and how much
> memory it consuming?
>
> For GCC
>
> e.g. I think for time it is ./time .. can someone tell how to check that?
>

It depends in which situations -- and what exactly you want to measure.
For Linux:
 1) if you change the code, you can use the function "clock" or "getrusage".
Clock gives you a number proportional to the used  processor time. Divide it
by CLOCKS_PER_SEC to get seconds :-). getrusage returns also many additional
informations, like the actual used memory, ...
 2) Without changing the code, you can use the PROGRAM "time" (not the
shell-builtin).
   On Debian it's installed as /usr/bin/time. Executing /usr/bin/time -v
./yourprogramm gives you also full statistics, including maximal memory
consumption

HTH,

Axel

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to