Code Search for Developers
 
 
  

perf.cpp from Equalizer - Multipipe Rendering at Krugle


Show perf.cpp syntax highlighted


#include <eq/base/barrier.h>
#include <eq/base/clock.h>
#include <eq/base/thread.h>
#include <iostream>

using namespace eqBase;
using namespace std;

#define MAXTHREADS 2048

volatile size_t nThreads;
Barrier*        barrier;
Clock           timer;

class Test : public Thread
{
public:
    virtual void* run()
        {
            int nLoops = MAXTHREADS / nThreads * 100000;
            const bool master = ( barrier->enter( nThreads ) == 0 );
            if( master )
                timer.reset();

            while( nLoops-- )
            {}

            barrier->enter( nThreads );
            if( master )
                cerr << nThreads << " threads, " << timer.getTimef() << "ms"
                     << endl;
            return EXIT_SUCCESS;
        }
};

int main( int argc, char **argv )
{
    barrier = new Barrier;
    Test threads[MAXTHREADS];

    for( nThreads = MAXTHREADS; nThreads>1; nThreads = nThreads>>1 )
    {
        for( size_t i=0; i<nThreads; i++ )
            threads[i].start();
        for( size_t i=0; i<nThreads; i++ )
            threads[i].join();
    }

    delete barrier;
    return EXIT_SUCCESS;
}





See more files for this project here

Equalizer - Multipipe Rendering

Equalizer is a programming interface and resource management system for scalable graphics applications for clusters and shared memory systems. It is build upon a scalable programming interface solving the problems common to any multipipe application.

Project homepage: http://sourceforge.net/projects/equalizer
Programming language(s): C,C++
License: lgpl21

  Makefile
  perf.cpp