Question: Write a C/C++/UNIX procedure, getTime ( ), that returns the execution time of code segments by calling it before the code segment is executed and

Write a C/C++/UNIX procedure, getTime ( ), that returns the execution time of code segments by calling it before the code segment is executed and again after the code segment is executed; for example:

double getTime(int); 

start = getTime(-3); 

stop = getTime(-3);

elapsedTime = Stop - start; // in milliseconds

Use the UNIX kernel gettimeofday( ) call to read the clock on your host system. The parameter specifies the resolution of the time. If the parameter is i, then the length of time for one time unit is 10i’. (i = 2-3 means return the time in milliseconds and i = 2-6 means return the time in microseconds.) State the smallest clock resolution for which your routine operates properly on your host machine.

Step by Step Solution

3.47 Rating (170 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the CC Program include include double ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

34-E-CE-OS (392).docx

120 KBs Word File

Students Have Also Explored These Related Computer Engineering Questions!