#include<sys/time.h>
#include<unistd.h>
int main()
{
struct timeval start_time,end_time;
int i,sumarith=0,sumshift=0;
gettimeofday(&start_time, NULL);
for(i=0;i<1024;i++) {
sumarith = sumarith + 9999;
}
gettimeofday(&end_time, NULL);
printf("----sum= %d %ld.%ld ----\n",sumarith,
(end_time.tv_sec-start_time.tv_sec), (end_time.tv_usec-start_time.tv_usec));
gettimeofday(&start_time, NULL);
sumshift = 9999 << 10;
gettimeofday(&end_time, NULL);
printf("----sum= %d %ld.%ld ----\n",sumshift,
(end_time.tv_sec-start_time.tv_sec), (end_time.tv_usec-start_time.tv_usec));
return 0;
}