Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- int myfunc1(int in);
- int myfunc2(int in);
- /*
- {
- time_t tv_sec; //seconds
- long tv_nsec; //nanoseconds
- } mytimestamp;
- */
- struct timespec mytimestamp;
- int main ( int argc , char ** argv )
- {
- int i,j;
- time_t t;
- srand((unsigned) time(&t));
- //<place your code here>
- for (i = 0; i < 500000; i++)
- if ((j = rand() ) > 0x3fffffff )
- myfunc1(j-0x3fffffff);
- else
- myfunc2(j);
- //<place your code here>
- return 0;
- }
- int myfunc1 (int in)
- {
- clock_gettime(CLOCK_REALTIME, &mytimestamp);
- printf("full-seconds: %ld, nano-seconds: %ld\n ",
- mytimestamp.tv_sec, mytimestamp.tv_nsec);
- int val1, i;
- float val2, val3;
- for (i =0; i < 4500; i++)
- {
- val1 = in*in*i;
- val2 = (in+i )*( in+i )*( in+i);
- val3 = val2 / val1;
- }
- return val3;
- }
- int myfunc2 (int in)
- {
- int i, j = in;
- for(i=0; i <= 999; i++) j=j+i;
- return j;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement