Search
 
SCRIPT & CODE EXAMPLE
 

C

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
", 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
", ((end.tv_sec * 1000000 + end.tv_usec)
		  - (start.tv_sec * 1000000 + start.tv_usec)));

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: C hello workld 
C :: print boolean value in c 
C :: sdl draw Rectf 
C :: nginx reverse proxy nextcloud 
C :: vowel or consonant in c 
C :: get chunks of a mp4 in ffmpeg 
C :: printf fill with 0 
C :: multiplication table using c 
C :: remove element from np array 
C :: for loop c 
C :: fast inverse square root explained 
C :: clrscr in c 
C :: console log observable data 
C :: reverse of a string in c 
C :: Futter Square Button 
C :: mutex c 
C :: uuidv4 javascript 
C :: Syntax To Take Input In C 
C :: gcc options to find out makefiel rules 
C :: c radians 
C :: plt legend top right outside 
C :: c programming language 
C :: Bootstrap textarea from 
C :: pointer to function c 
C :: print to console in c 
C :: create node in c 
C :: iterate through enum in qt 
C :: definir função em c 
C :: binary sorting 
C :: oracle trunc 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =