From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,259e99d494c8e68b X-Google-Attributes: gidf8c9b,public X-Google-Thread: 1014db,259e99d494c8e68b X-Google-Attributes: gid1014db,public X-Google-Thread: fee84,259e99d494c8e68b X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-09-03 17:10:50 PST Newsgroups: comp.unix.osf.osf1,comp.lang.c,comp.unix.questions Path: bga.com!news.sprintlink.net!uunet!MathWorks.Com!udel!princeton!handel!tim From: tim@handel.Princeton.EDU (Tim Hollebeek) Subject: Re: [Q] Accurately measure exec time of a process? Message-ID: <1994Sep3.174554.27974@Princeton.EDU> Originator: news@nimaster Sender: news@Princeton.EDU (USENET News System) Nntp-Posting-Host: handel.princeton.edu Organization: Princeton University References: <349aat$mer@pirates.cs.swt.edu> Date: Sat, 3 Sep 1994 17:45:54 GMT Xref: bga.com comp.unix.osf.osf1:3363 comp.lang.c:23164 comp.unix.questions:12793 In article <349aat$mer@pirates.cs.swt.edu> peng@pirates.cs.swt.edu (Wuxu Peng) writes: >I have a C program (about 2,000 lines) implementing an approximate >algorithm. The program has two phases. My question is: how can I >accurately measure the execution time of each of the two phases? >This measurement is important to demonstrate the usefulness of my >algorithm. > >Thanks in advance. > find and learn how to use a prof or gprof. It will give you execution times for every function in your C program. In your case you would just have to make sure your program looks something like: void main() { doTaskOne(); doTaskTwo(); } i.e. a subroutine for each phase