Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Execution time calculation in C (not Cpp)

Status
Not open for further replies.

dvtruongson

Member level 1
Joined
Oct 3, 2006
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,456
time calculation in c

Hi all,

Currently, I need to do a project which involved determining execution times of different algorithm. So, I want a code which can help to compute execution time of the codes.
Anyone has any ideas on this matter.

Your help is greatly appreciated.
Thank you very much
 

vinseth

Member level 2
Joined
Jul 6, 2007
Messages
42
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,286
Activity points
1,463
execution time in c

Check this Pseudo code...

function executiontime()
{
clock_t start;
clock_t diff;
clock_t end;

start= clock();
various algorithm;
end = clock();

diff = end - start;
print diff;

}
 

dvtruongson

Member level 1
Joined
Oct 3, 2006
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,456
execution time c

Hi Vinseth, what header file I should input for clock() function? Can you give me more details...Thanks
 

vinseth

Member level 2
Joined
Jul 6, 2007
Messages
42
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,286
Activity points
1,463
time calculations c

For clock() and clock_t

you need

#include <time.h>
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top