LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-26-2007, 08:04 PM   #1
kd5pbo
Member
 
Registered: Jun 2006
Location: Washington, DC, USA
Distribution: Slackware
Posts: 41

Rep: Reputation: 15
Determine program's runtime


Is there any way to determine the time it took a program to execute?

I am trying to test a few methods of doing a calculation, and I'd like to find out which is the fastest.
 
Old 02-26-2007, 08:14 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Prefix execution of the program with "time".
 
Old 02-26-2007, 08:26 PM   #3
erklaerbaer
Member
 
Registered: Mar 2006
Posts: 381

Rep: Reputation: 30
time, gprof and gcov.

gprof needs profiling (gcc -pg)

gcov needs "-g -fprofile-arcs -ftest-coverage"

Have fun!
 
Old 03-14-2007, 02:02 AM   #4
daggulasreedhar
LQ Newbie
 
Registered: Mar 2007
Posts: 5

Rep: Reputation: 0
Thumbs up hey did u get the solution

Hi Dear friend...
I want to write a program to find the TOTAL PROGRAM EXECUTION TIME in C.
Note: While executing the program SYSTEM TIME willl change... Even though it has to give the correct out put....
So please send me the way u have done.

Please reply..back.


Thanks & regards
Sreedhar
 
Old 03-14-2007, 10:51 AM   #5
daggulasreedhar
LQ Newbie
 
Registered: Mar 2007
Posts: 5

Rep: Reputation: 0
Question

Quote:
Originally Posted by Matir
Prefix execution of the program with "time".


hi.. friend


can u explain me in detail by taking an example with small C code
 
Old 03-14-2007, 02:42 PM   #6
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
In C ? Well, it's not as easy as you might think. Take a look at the source code for the 'time' program:

ftp://slackware.mirrors.tds.net/pub/...ime-1.7.tar.gz

So, basically you want to re-invent the wheel. 'time' is written in C and it does what you are asking .... what more do you want.

Last edited by H_TeXMeX_H; 03-14-2007 at 02:43 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i determine my IP address? How do i determine my host name? jwymore Linux - Networking 5 02-07-2007 09:57 AM
Looking for a few program's. Budman21901 Linux - Software 8 10-27-2005 03:00 PM
Suse certification program's hansi umayangan SUSE / openSUSE 1 07-01-2005 11:53 AM
C: Getting program's output MylesCLin Programming 4 02-24-2005 05:06 PM
How do I run program's with WINE? kaber Linux - Software 3 09-09-2004 03:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration