Exemplo n.º 1
0
int main(int argc,char *argv[])
{
    int numCalls,j;
    printf("CLOCKS_PER_SEC=%ld sysconf(_SC_CLK_TCK)=%ld\n\n",(long)CLOCKS_PER_SEC,sysconf(_SC_CLK_TCK));
    displayProcessTimes("At program start:\n");
    numCalls = (argc > 1)?
}
Exemplo n.º 2
0
int
main(int argc, char *argv[])
{
  int numCalls, j;

  printf("CLOCKS_PER_SEC=%ld sysconf(_SC_CLK_TCK)=%ld\n\n",
      (long) CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));
  
  displayProcessTimes("At program start:\n");

  numCalls = (argc > 1) ? getInt(argv[1], GN_GT_0, "num-calls") : 100000000;
  for (j = 0; j < numCalls; j++)
    (void) getppid();

  displayProcessTimes("After getppid() loop:\n");

  exit(EXIT_SUCCESS);
}
Exemplo n.º 3
0
int
main(int argc, char *argv[])
{
    int numCalls, j;

    printf("CLOCKS_PER_SEC=%ld  sysconf(_SC_CLK_TCK)=%ld\n\n",
            (long) CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));

    displayProcessTimes("At program start:\n");

    /* Call getppid() a large number of times, so that
       some user and system CPU time are consumed */

    numCalls = (argc > 1) ? getInt(argv[1], GN_GT_0, "num-calls") : 100000000;
    for (j = 0; j < numCalls; j++)
        (void) getppid();

    displayProcessTimes("After getppid() loop:\n");

    exit(EXIT_SUCCESS);
}