

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Quiz; Professor: Gupta; Class: System Programming; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Spring 2006;
Typology: Quizzes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Note: Completion of quiz is an individual effort. The quiz takes 10 minutes. The student gets additional 5 points for taking the quiz. Each question has ONLY ONE ANSWER!!!
clock_gettime(CLOCK_REALTIME, &ovalue); function_to_time(); clock_gettime(CLOCK_REALTIME, &nvalue);
To compute the running time in microseconds the following formula is correct: a. timedif = MILLION(nvalue.tv_sec โ ovalue.tv_sec) + (nvalue.tv_usec โ ovalue.tv_usec)/1000; b. timedif = MILLION(ovalue.tv_sec-nvalue.tv_sec) +(ovalue.tv_nsec โ nvalue.tv_nsec) c. timedif= MILLION(nvalue.tv_sec-ovalue.tv_sec) +(nvalue.tv_nsec โ ovalue.tv_nsec)/ d. timedif = MILLION(ovalue.tv_sec โ nvalue.tv_sec) + (ovalue.tv_usec โ nvalue.tv_usec)
static int functionE(double sec) { timer_t timerid; struct itimerspec tpend;
timer_create(CLOCK_REALTIME, NULL, &timerid); tpend.it_interval.tv_sec = (long) sec; tpend.it_interval.tv_nsec = (sec โ tpend.it_interval.tv_sec)*BILLION; tpend.it_value = tpend.it_interval; return timer_settime(timerid,0,&tpend, NULL); }
a. Set the timer to the current time b. Set the timer to the interval equal to the value stored in CLOCK_REALTIME c. Set the timer to the interval equal to the value of 2. d. Set the timer to the interval equal to the value stored in timerid;