Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
stat.c File Reference
#include "nspr.h"
#include "prpriv.h"
#include "prinrval.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Defines

#define DEFAULT_COUNT   100000

Functions

static void statPRStat (void)
static void statStat (void)
static void Measure (void(*func)(void), const char *msg)
void main (int argc, char **argv)
 The Xalan testcases app.

Variables

PRInt32 count
char * filename = "/etc/passwd"

Define Documentation

#define DEFAULT_COUNT   100000

Definition at line 57 of file stat.c.


Function Documentation

void main ( int  argc,
char **  argv 
)

The Xalan testcases app.

Definition at line 104 of file stat.c.

{
    PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
    PR_STDIO_INIT();

    if (argc > 1) {
       count = atoi(argv[1]);
    } else {
       count = DEFAULT_COUNT;
    }

    Measure(statPRStat, "time to call PR_GetFileInfo()");
    Measure(statStat, "time to call stat()");

    PR_Cleanup();
}

Here is the call graph for this function:

static void Measure ( void(*)(void func,
const char *  msg 
) [static]

Definition at line 88 of file stat.c.

{
    PRIntervalTime start, stop;
    double d;
    PRInt32 tot;

    start = PR_IntervalNow();
    (*func)();
    stop = PR_IntervalNow();

    d = (double)PR_IntervalToMicroseconds(stop - start);
    tot = PR_IntervalToMilliseconds(stop-start);

    printf("%40s: %6.2f usec avg, %d msec total\n", msg, d / count, tot);
}

Here is the caller graph for this function:

static void statPRStat ( void  ) [static]

Definition at line 66 of file stat.c.

{
    PRFileInfo finfo;
    PRInt32 index = count;
 
    for (;index--;) {
         PR_GetFileInfo(filename, &finfo);
    }
}

Here is the caller graph for this function:

static void statStat ( void  ) [static]

Definition at line 76 of file stat.c.

{
    struct stat finfo;
    PRInt32 index = count;
 
    for (;index--;) {
        stat(filename, &finfo);
    }
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 58 of file stat.c.

char* filename = "/etc/passwd"

Definition at line 61 of file stat.c.