Back to index

glibc  2.9
Defines | Functions | Variables
speeds.c File Reference
#include <signal.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/times.h>

Go to the source code of this file.


#define NO_ITIMER
#define ITIME   10 /* Number of seconds to run test. */


char * crypt ()
char * fcrypt ()
void Stop ()
static void clearmem (char *start, int cnt)
 main ()


static int cnt
char * hz

Define Documentation

#define ITIME   10 /* Number of seconds to run test. */

Definition at line 40 of file speeds.c.

#define NO_ITIMER

Definition at line 25 of file speeds.c.

Function Documentation

static void clearmem ( char *  start,
int  cnt 
) [static]

Definition at line 72 of file speeds.c.

  { while(cnt--)
      *start++ = '\0';

Here is the caller graph for this function:

char* crypt ( )
char * fcrypt ( )
main ( void  )

Definition at line 79 of file speeds.c.

   char *s;
#ifdef NO_ITIMER
    extern char *getenv();
    struct itimerval itv;

#ifdef NO_ITIMER
    if ((hz = getenv("HZ")) == NULL) {
       fprintf(stderr, "HZ environment parameter undefined\n");

#ifdef FCRYPT
    printf("Warning: this version of the speed program may run slower when\n");
    printf("benchmarking UFC-crypt than previous versions. This is because it\n");
    printf("stresses the CPU hardware cache in order to get benchmark figures\n");
    printf("that corresponds closer to the performance that can be expected in\n");
    printf("a password cracker.\n\n");

    printf ("Running %s for %d seconds of virtual time ...\n",
#ifdef FCRYPT

#ifdef FCRYPT
    init_des ();

#ifdef NO_ITIMER
    signal(SIGALRM, Stop);
    switch (fork()) {
    case -1:
       perror("fork failed");
    case 0:
       kill(getppid(), SIGALRM);
       (void) times(&tstart);
    clearmem ((char*)&itv, (int)sizeof (itv));
    signal (SIGVTALRM, Stop);
    itv.it_value.tv_sec = ITIME;
    itv.it_value.tv_usec = 0;
    setitimer (ITIMER_VIRTUAL, &itv, NULL);

    s = "fredred";
    for (cnt = 0;; cnt++)
#ifdef FCRYPT
       s = fcrypt (s, "eek");
       s = crypt (s, "eek");

Here is the call graph for this function:

void Stop ( )

Definition at line 45 of file speeds.c.

    double elapsed;
#ifdef NO_ITIMER
    (void) times(&tfinish);
    elapsed = ((tfinish.tms_utime + tfinish.tms_stime) -
       (tstart.tms_utime + tstart.tms_stime)) / atoi(hz);
    printf("elapsed time = %d sec,  CPU time = %f sec\n", ITIME, elapsed);
    elapsed = ITIME;
    printf ("Did %f %s()s per second.\n", ((float) cnt) / elapsed,
#if defined(FCRYPT)
    exit (0);

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int cnt [static]

Definition at line 35 of file speeds.c.

char* hz

Definition at line 37 of file speeds.c.