Continue to Site

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.

time of execution of a C program

Status
Not open for further replies.

cedance

Advanced Member level 2
Joined
Oct 24, 2003
Messages
551
Helped
30
Reputation
60
Reaction score
7
Trophy points
1,298
Location
Germany
Activity points
4,622
how to find the time taken by the c program

hi,

i have managed to write a C code for finding the inverse of a matrix, using a partitioned approach, which helps in running the code relatively parallely. I hav planned to compare the results by running it on a single PC and then on 2 or 3 computers, LAN connected, Linux MPI environment. now i have these difficulties, I came to know the way of calculating the time required for running the program, using <time.h> and the syntaxes, clock_t declaration and stuffs.. but, when i tried the inverse of a 64*64 even matrix, it shows the time taken to execute is "0" seconds.... So, i tried a 256*256 matrix, it says " stack overflow, exception"!!!! :( then how do i find the time required for running the program? for a relatively larger size matrix... obviousl its also one of the results of my simulation!!! pls help me... it only shows the time required to print things on screen... i mean, when i print all the results like, A matrix, Ainverse matrix etc... it takes long time to print them and so, it tellls.. time taken is "6 seconds" or so.... if i amnt clear enough, i wud explain it further... thk u.

/cedance
 

seems like a problem with your algorithm. try looking at your Ainverse matrix for simple cases to see if the inversion is correct.
 

cedance,
Write a loop that executes the matrix inverse function 10,000 (for example) times.
Calculate the time required to execute the loop control and function calling overhead.
Multiply this value by 10,000.
Subtract this product from the total measured execution time.
Divide the result by 10,000 to get the execution time of the matrix inverse function.
Regards,
Kral
 

kienhuy said:
try looking at your Ainverse matrix for simple cases to see if the inversion is correct.

probably i shud hav mentioned "i hav managed to write a correct C code for inversion! :)

@kral,

thks for the procedure, i ll tyr it out. but cud u explain what this does and how this is different from the normal procedure of calculatin the time it takes to run a loop?

do u mean to say this way? suppose i want to find the total time of execution of a program, say matrix multiplication, then i run the whole program 10000 times(say) and find the time taken for 1 loop by finding the total time and then /10000? this seems to be logical.. but i ll verify it... if not, pls explain what u told. thk u.


/cedance
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top