Horje
c gettimeofday example Code Example
c gettimeofday example
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv)
{
  if (argc < 2)
    {
      printf("USAGE: %s loop-iterations\n", argv[0]);
      return 1;
    }

  int iterations = atoi(argv[1]);

  struct timeval start, end;

  gettimeofday(&start, NULL);

  for (int i = 0; i < iterations; i++)
    {
    }

  gettimeofday(&end, NULL);

  printf("%ld\n", ((end.tv_sec * 1000000 + end.tv_usec)
		  - (start.tv_sec * 1000000 + start.tv_usec)));

  return 0;
}




C

Related
series sort Code Example series sort Code Example
find power of a number in c Code Example find power of a number in c Code Example
series sort values Code Example series sort values Code Example
nginx reverse proxy nextcloud Code Example nginx reverse proxy nextcloud Code Example
select first row first column pyspark Code Example select first row first column pyspark Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10