Esempio n. 1
0
//------------------------------------------------------------------------------
// Perform testcases for a 1 column table, a 2 column table, etc, up to
// a table having "maxCols" columns.
//------------------------------------------------------------------------------
void testSizes()   
{

	// Prompt for schema.
	cout << "Enter Schema or Enter for " << schema << ":  ";
	string tmpSchema;
	getline(cin, tmpSchema);
	if(tmpSchema.length() > 0)
	{
		schema = tmpSchema;
	}

	// Prompt for table.
	cout << "Enter Table or Enter for " << colstable << ":  ";
	string tmpTable;
	getline(cin, tmpTable);
	if(tmpTable.length() > 0)
	{
		colstable = tmpTable;
	}

	timer.start("Total");
	int maxCols = 9;
	cout << endl;
	for(int i = 7; i <= maxCols; i++) {
		cout << endl << "Running test " << i << " of " << maxCols << endl;
		stringstream ss;
		ss << "Delivery test for " << dataSize << " rows and " << i << " columns";
		timer.start(ss.str());
		deliverTest(i);
		timer.stop(ss.str());
	}
	timer.stop("Total");
	timer.finish();
}
Esempio n. 2
0
	//--------------------------------------------------------------------------
	// ZDL benchmark functions
	//--------------------------------------------------------------------------
 	void ZDL_bench_1set_seq()
	{
		typedef ElementType Element;

		uint i;
		uint numOfProducers = NUM_PRODUCERS;
		uint numOfConsumers = NUM_CONSUMERS;
		ZDL<Element> zdl(numOfConsumers, fRm);
	    zdl.setMultipleProducers(true);		
		zdl.setElementMode(1); // RID_VALUE
		pthread_t producer[numOfProducers];
		pthread_t consumer[numOfConsumers];
		ThreadParms producerThreadParms[NUM_PRODUCERS];
		ThreadParms consumerThreadParms[NUM_CONSUMERS];
		struct timespec ts1, ts2, diff;
        
        timer.start("zdl-produce_1set_seq");
		clock_gettime(CLOCK_REALTIME, &ts1);
		for (i = 0; i < numOfProducers; i++)
		{
			producerThreadParms[i].zdl          = &zdl;
			producerThreadParms[i].threadNumber = i;
            producerThreadParms[i].count        = ::count1Set;
		    pthread_create(&producer[i], NULL,
				ZDL_producer_1set_seq<Element>, &producerThreadParms[i]);
		}
		for (i = 0; i < numOfProducers; i++)
		    pthread_join(producer[i], NULL);
		zdl.endOfInput();
		timer.stop("zdl-produce_1set_seq");
		
		timer.start("zdl-consume_1set_seq");
		for (i = 0; i < numOfConsumers; i++)
		{
			consumerThreadParms[i].zdl          = &zdl;
			consumerThreadParms[i].threadNumber = i;
            consumerThreadParms[i].count        = 0;
		    pthread_create(&consumer[i], NULL,
				ZDL_consumer<Element>, &consumerThreadParms[i]);
		}
		for (i = 0; i < numOfConsumers; i++)
		    pthread_join(consumer[i], NULL);   
		clock_gettime(CLOCK_REALTIME, &ts2);
        timer.stop("zdl-consume_1set_seq");	

        timer.finish();	
		timespec_sub(ts1, ts2, diff);
        cout << "# of Producers: " << numOfProducers << endl;
        cout << "# of Consumers: " << numOfConsumers << endl;
		cout << "ZDL_bench_1set_seq: producer & consumer passed " << 
			zdl.totalSize() << " elements in " << diff.tv_sec << "s " <<
			diff.tv_nsec << "ns" << endl;

		ZDL_printFileStats<Element>(&zdl);
		validateResults(::count1Set*NUM_PRODUCERS);
	}
Esempio n. 3
0
	//--------------------------------------------------------------------------
	// test the saving and loading of a zdl file
	//--------------------------------------------------------------------------
	void load_save(){
	    typedef ElementType Element;

    	vector <Element> v;
    	for (uint i = 0; i < ::count1Set*8; i++)
    	    v.push_back(Element(i,i));
    	
    	vector<Element> v1;
    	vector<Element> v2;
    	vector<Element> v3;
    	
    	// save
    	ofstream f1;
    	ifstream f;
    	string filename = "zdl.txt";
    	uint64_t ctn = v.size();
    	f1.open(filename.c_str(), std::ios::binary);
    	f1.write((char *) &ctn, sizeof(ctn));
    	f1.write((char *) (v.begin().operator->()), sizeof(Element) * ctn);
    	f.close();
    	
    	// load
    	v1.push_back(Element(3,4));
    	f.open(filename.c_str(), std::ios::binary);
    	timer.start("read");
    	v1.resize(v1.size()+::count1Set*8);
    	f.read((char *) ((v1.begin()+1).operator->()), ctn * sizeof(Element));
    	cout << v1.size() << endl;
        timer.stop("read");
        cout << "E1: " << v1[0].first << endl;
        f.close();
        
        f.open(filename.c_str(), std::ios::binary);
        timer.start("assign");
        v2.assign(std::istream_iterator<Element>(f), 
        				std::istream_iterator<Element>());
        cout << v2.size() << endl;    				    
        timer.stop("assign");
        f.close();
        
        f.open(filename.c_str(), std::ios::binary);
        timer.start("insert");
        v3.insert(v3.end(), std::istream_iterator<Element>(f), 
        				std::istream_iterator<Element>());
        cout << v3.size() << endl;    				    
        timer.stop("insert");
        f.close();
        timer.finish();
    }
Esempio n. 4
0
	void SWSDL_bench_mulSet_seq()
	{	   
		typedef ElementType Element;

	    id_sw = 0;
		uint i;
		uint numOfProducers = NUM_PRODUCERS;
		uint numOfConsumers = NUM_CONSUMERS;
		SWSDL<Element> sw(numOfConsumers, fRm);
        sw.setMultipleProducers(true);
		
		pthread_t producer[numOfProducers];
		pthread_t consumer[numOfConsumers];
		struct timespec ts1, ts2, diff;
        
        timer.start("swsdl-produce");
		clock_gettime(CLOCK_REALTIME, &ts1);
		for (i = 0; i < numOfProducers; i++)
		    pthread_create(&producer[i], NULL,
				SWSDL_producer_mulSet_seq<Element>, &sw);
		    
		for (i = 0; i < numOfProducers; i++)
		    pthread_join(producer[i], NULL);
        timer.stop("swsdl-produce");
        timer.start("swsdl-endofinput");
		sw.endOfInput();
		timer.stop("swsdl-endofinput");
		
		//timer.stop("swsdl-produce");
		timer.start("swsdl-consume");
		for (i = 0; i < numOfConsumers; i++)
		    pthread_create(&consumer[i], NULL,
				SWSDL_consumer<Element>, &sw);
		for (i = 0; i < numOfConsumers; i++)
		    pthread_join(consumer[i], NULL);

		clock_gettime(CLOCK_REALTIME, &ts2);
		timer.stop("swsdl-consume");
		timer.finish();
		timespec_sub(ts1, ts2, diff);

        cout << "# of Producers: " << numOfProducers << endl;
        cout << "# of Consumers: " << numOfConsumers << endl;
		cout << "SWSDL_bench_mulSet_seq: producer & consumer passed " << 
			sw.totalSize() << " elements in " << diff.tv_sec << "s " <<
			diff.tv_nsec << "ns" << endl;
	}
Esempio n. 5
0
	//--------------------------------------------------------------------------
	// test the reading of zdl configuration parameters
	//--------------------------------------------------------------------------
    void configure()
    {
        config::Config *config = config::Config::makeConfig();
        std::string strVal;
	    strVal = config->getConfig("ZDL", "MaxMemConsumption");
	    uint64_t maxMemConsumption;
	    timer.start("configure");
	    for (int i = 0; i < 20; i++){	    
    	    if (strVal.size() > 0){
    		    maxMemConsumption = config::Config::uFromText(strVal);
    		    if ((maxMemConsumption - 1) & maxMemConsumption)
       			    throw std::runtime_error("ZDL: maxMemConsumption "
						"should be a power of 2.");
    	    }
    	    else
    		    maxMemConsumption = 1000000;
		}
		timer.stop("configure");
		timer.finish();
    }
Esempio n. 6
0
//------------------------------------------------------------------------------
// Main entry point
//------------------------------------------------------------------------------
int main( int argc, char **argv)
{
  if (argc > 1)
    columns = atoi(argv[1]); // override default number of rows
  else 
	columns = 10;

	while (columns > 0) {

//   testSizes();
		nextBandBenchmark();

		queuedBSBenchmark(10);
		queuedBSBenchmark(9);
		queuedBSBenchmark(8);
		queuedBSBenchmark(5);
		queuedBSBenchmark(4);
		queuedBSBenchmark(1);
		timer.finish();
		columns--;
	}
	return 0;
}
Esempio n. 7
0
	void ZDL_bench_mulSet_seq_ridonly(char* testDesc, bool compress,
		uint32_t size1st)
	{
	    typedef RIDElementType Element;
		uint32_t size2nd = 0;

		string produceTag ("zdl-produce_ridonly");
		string eofInputTag("zdl-endofinput_ridonly");
		string consumeTag ("zdl-consume_ridonly");
		produceTag  += testDesc;
		eofInputTag += testDesc;
		consumeTag  += testDesc;

		uint i;
		uint numOfProducers = NUM_PRODUCERS;
		uint numOfConsumers = NUM_CONSUMERS;
		ZDL<Element> zdl(numOfConsumers, fRm); 
	    zdl.setMultipleProducers(true);		
		if ( compress )
			zdl.setDiskElemSize ( size1st, size2nd );
		pthread_t producer[numOfProducers];
		pthread_t consumer[numOfConsumers];
		ThreadParms producerThreadParms[NUM_PRODUCERS];
		ThreadParms consumerThreadParms[NUM_CONSUMERS];
		struct timespec ts1, ts2, diff;
        
        timer.start(produceTag);
		clock_gettime(CLOCK_REALTIME, &ts1);
		for (i = 0; i < numOfProducers; i++)
		{
			producerThreadParms[i].zdl          = &zdl;
			producerThreadParms[i].threadNumber = i;
            producerThreadParms[i].count        = ::countMulSet;
		    pthread_create(&producer[i], NULL,
				ZDL_producer_mulSet_seq_ridonly<Element>,
					&producerThreadParms[i]);
		}
		for (i = 0; i < numOfConsumers; i++)
		{
			consumerThreadParms[i].zdl          = &zdl;
			consumerThreadParms[i].threadNumber = i;
            consumerThreadParms[i].count        = 0;
		    pthread_create(&consumer[i], NULL,
				ZDL_consumer<Element>, &consumerThreadParms[i]);
		}
		for (i = 0; i < numOfProducers; i++)
		    pthread_join(producer[i], NULL);
        timer.stop(produceTag);

        timer.start(eofInputTag);
		zdl.endOfInput();
		timer.stop(eofInputTag);

		timer.start(consumeTag);
		for (i = 0; i < numOfConsumers; i++)
		    pthread_join(consumer[i], NULL);
		clock_gettime(CLOCK_REALTIME, &ts2);
		timer.stop(consumeTag);

		timer.finish();
		timespec_sub(ts1, ts2, diff);
		cout << "compress state: " << (compress?"on":"off") << endl;
		if (compress)
			cout << "size 1st/2nd:   " << size1st << "/" << size2nd << endl;
        cout << "# of Producers: " << numOfProducers << endl;
        cout << "# of Consumers: " << numOfConsumers << endl;
		cout << "ZDL_bench_mulSet_seq_ridonly_" << testDesc <<
			": producer & consumer passed " << 
			zdl.totalSize() << " elements in " << diff.tv_sec << "s " <<
			diff.tv_nsec << "ns" << endl;

		ZDL_printFileStats<Element>(&zdl);
		validateResults(::countMulSet*NUM_PRODUCERS);
	}