Alien-Judy

 view release on metacpan or  search on metacpan

src/judy-1.0.5/test/Judy1LHTime.c  view on Meta::CPAN

        newseed += newseed;
        newseed ^= Magic;
    }
    else
    {
        newseed += newseed;
    }
    newseed &= RandomBit * 2 - 1;
    if (newseed == FirstSeed)
        FAILURE("LFSR failed", newseed);
    return (newseed);
}

_INLINE_ Word_t                         // so INLINING compilers get to look at it.
GetNextIndex(Word_t Index)
{
    if (SkipN)
        Index += SkipN;
    else
        Index = Random(Index);

    return (Index);
}

#undef __FUNCTI0N__
#define __FUNCTI0N__ "main"

struct timeval TVBeg__, TVEnd__;

#ifdef  CPUMHZ
uint32_t  GCBeg__;
#endif // CPUMHZ

int
main(int argc, char *argv[])
{
//  Names of Judy Arrays
    void     *J1 = NULL;                // Judy1
    void     *JL = NULL;                // JudyL
    void     *JH = NULL;                // JudyHS

    Word_t    Count1, CountL;           // , CountHS;
    Word_t    Bytes;

    double    Mult;
    Pms_t     Pms;
    Word_t    Seed;
    Word_t    PtsPdec = 40;             // points per decade
    Word_t    Groups;                   // Number of measurement groups
    Word_t    grp;
    Word_t    Pop1;
    Word_t    Meas;
    int       Col;

    int       c;
    extern char *optarg;

    setbuf(stdout, NULL);               // unbuffer output

//============================================================
// PARSE INPUT PARAMETERS
//============================================================

    while ((c = getopt(argc, argv, "n:S:T:P:b:B:dDcC1LHvIl")) != -1)
    {
        switch (c)
        {
        case 'n':                      // Max population of arrays
            nElms = strtoul(optarg, NULL, 0);   // Size of Linear Array
            if (nElms == 0)
                FAILURE("No tests: -n", nElms);
            break;

        case 'S':                      // Step Size, 0 == Random
            SkipN = strtoul(optarg, NULL, 0);
            break;

        case 'T':                      // Maximum retrieve tests for timing 
            TValues = strtoul(optarg, NULL, 0);
            break;

        case 'P':                      // measurement points per decade
            PtsPdec = strtoul(optarg, NULL, 0);
            break;

        case 'b':                      // May not work past 35 bits if changed
            StartSeed = strtoul(optarg, NULL, 0);
            break;

        case 'B':                      // expanse of data points (random only)
            BValue = strtoul(optarg, NULL, 0);
            if ((BValue > 64)
                || (MagicList[BValue] == 0) || (BValue > (sizeof(Word_t) * 8)))
            {
                ErrorFlag++;
                printf("\nIllegal number of random bits of %lu !!!\n", BValue);
            }
            break;

        case 'v':
            vFlag = 1;                  // time Searching
            break;

        case '1':                      // time Judy1
            J1Flag = 1;
            break;

        case 'L':                      // time JudyL
            JLFlag = 1;
            break;

        case 'H':                      // time JudyHS
            JHFlag = 1;
            break;

        case 'd':                      // time Judy1Unset JudyLDel
            dFlag = 1;
            break;

        case 'D':                      // bit reverse the data stream
            DFlag = 1;



( run in 1.276 second using v1.01-cache-2.11-cpan-13bb782fe5a )