Back to index

glibc  2.9
Functions | Variables
clocktest.c File Reference
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

Go to the source code of this file.

Functions

static void alarm_handler (int signal)
int main (int argc, char **argv)

Variables

volatile int gotit = 0

Function Documentation

static void alarm_handler ( int  signal) [static]

Definition at line 10 of file clocktest.c.

{
    gotit = 1;
}

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 17 of file clocktest.c.

{
  clock_t start, stop;

  if (signal(SIGALRM, alarm_handler) == SIG_ERR)
    {
      perror ("signal");
      exit (1);
    }
  alarm(1);
  start = clock ();
  while (!gotit);
  stop = clock ();

  printf ("%ld clock ticks per second (start=%ld,stop=%ld)\n",
         stop - start, start, stop);
  printf ("CLOCKS_PER_SEC=%ld, sysconf(_SC_CLK_TCK)=%ld\n",
         CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));
  return 0;
}

Here is the call graph for this function:


Variable Documentation

volatile int gotit = 0

Definition at line 7 of file clocktest.c.