~ubuntu-branches/ubuntu/trusty/bmagic/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/perf/perf.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Roberto C. Sanchez
  • Date: 2009-12-09 16:02:55 UTC
  • mfrom: (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20091209160255-hu2bnjrbncl92z5w
Tags: 3.6.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
// No intermix FP with integer SSE in this program
29
29
//#define BM_SET_MMX_GUARD
30
30
//#define BMSSE2OPT
 
31
//#define BMSSE42OPT
31
32
 
32
33
 
33
34
#include "bm.h"
34
35
#include "bmalgo.h"
35
36
#include "bmserial.h"
 
37
//#include "bmdbg.h"
36
38
 
37
39
#include <math.h>
38
40
 
440
442
 
441
443
void EnumeratorTest()
442
444
{
443
 
    bvect*  bv = new bvect();
 
445
    bvect  bv;
444
446
    test_bitset*  bset = new test_bitset();
445
447
    unsigned value = 0;
446
448
 
447
 
    FillSetsIntervals(*bset, *bv, 0, BSIZE, 10);
 
449
    FillSetsIntervals(*bset, bv, 0, BSIZE, 10);
448
450
 
449
 
    unsigned cnt1 = bv->count();
450
 
    unsigned cnt2 = bset->count();
 
451
    unsigned cnt1 = bv.count();
 
452
    //unsigned cnt2 = bset->count();
451
453
 
452
454
    
453
455
    unsigned i;
456
458
    TimeTaker tt("Enumerator. BM.", REPEATS/10);
457
459
    for (i = 0; i < REPEATS/10; ++i)
458
460
    {    
459
 
        bvect::enumerator en = bv->first();
460
 
        bvect::enumerator bend = bv->end();
 
461
        bvect::enumerator en = bv.first();
461
462
 
462
 
        while (en < bend)
 
463
        for (;en.valid();++en)
463
464
        {
464
465
            value = *en;
465
 
            ++en;
466
466
        }
467
467
    }
468
468
    }
473
473
    unsigned cnt = 0;
474
474
    {
475
475
    TimeTaker tt("get_next(). BM.", REPEATS/10);
476
 
    for (i = 0; i < REPEATS/10; ++i)
477
 
    {
478
 
        if (bv->any())
 
476
        for (i = 0; i < REPEATS/10; ++i)
479
477
        {
480
 
            unsigned value = bv->get_first();
481
 
            do
 
478
            if (bv.any())
482
479
            {
483
 
                value = bv->get_next(value);
484
 
                cnt += value;
485
 
            } while ( value );
 
480
                unsigned value = bv.get_first();
 
481
                do
 
482
                {
 
483
                    value = bv.get_next(value);
 
484
                    cnt += value;
 
485
                } while ( value );
 
486
            }
486
487
        }
487
488
    }
488
489
 
489
490
    delete bset;
490
 
    delete bv;
491
 
    }
 
491
//    delete bv;
 
492
 
492
493
    char buf[256];
493
 
    sprintf(buf, "%i %i %i", cnt, cnt1, cnt2);
 
494
    sprintf(buf, "%i %i ", cnt, cnt1);//, cnt2);
494
495
 
495
496
}
496
497
 
601
602
    test_bitset*  bset = new test_bitset();
602
603
    unsigned value = 0;
603
604
 
604
 
    SimpleFillSets(*bset, *bv, 0, BSIZE, 2500);
 
605
    SimpleFillSets(*bset, *bv, 0, BSIZE, 4);
605
606
    
606
607
        cnt = bv->count();
607
608
    bv->calc_stat(&st);
1228
1229
        
1229
1230
    return 0;
1230
1231
}
 
1232
 
 
1233
 
 
1234
 
 
1235
 
 
1236