示例#1
0
double noise::operator () (double &t) const
{
	while (t >= t_rand) { // time to get a new random sample
		i_old = i_rand;
		q_old = q_rand;
		if (n == 0) {
			double x, y, r;
			do {
				x = (double) rnd_uint32() / 2147483648U - 1;
				y = (double) rnd_uint32() / 2147483648U - 1;
				r = x * x + y * y;
			} while (r > 1 || r == 0);
			r = sqrt(-variance * log(r) / r);
			i_rand = filter1(x * r);
			q_rand = filter2(y * r);
		} else {
			i_rand = filter1(0);
			q_rand = filter2(0);
		}
		if (!(++n % 4)) n = 0;
		t_rand += period;
		// This uses a filter to do a 4x oversampling, and then a linear interpolation.
	}
	double tau = (t_rand - t) / period;
	double i = i_old * tau + i_rand * (1 - tau);
	double q = q_old * tau + q_rand * (1 - tau);
	double y = i * sin(omega * t) + q * cos(omega * t);
	t += t_sine;
	return y;
}
void test_cute_filter_runner_ArgvFilter() {
	char const *argv[] = { "dummy", "testsuite1", "testsuite2#test1",
			"testsuite2#test3", 0 };
	std::vector<std::string> args;
	std::copy(argv + 1, argv + sizeof(argv) / sizeof(*argv) - 1,
			std::back_inserter(args));
	cute::runner_aux::ArgvTestFilter filter1("", args);
	ASSERT(filter1.shouldRun("any"));
	cute::runner_aux::ArgvTestFilter filter2("testsuite1", args);
	ASSERT(filter2.shouldrunsuite);
	ASSERT(filter2.shouldRun("test"));
	ASSERT(filter2.shouldRun("test1"));
	ASSERT(filter2.shouldRun("test2"));
	ASSERT(filter2.shouldRun("test3"));
	ASSERT(filter2.shouldRun("test4"));
	cute::runner_aux::ArgvTestFilter filter3("dummy", args);

	ASSERT(!filter3.shouldrunsuite);
	cute::runner_aux::ArgvTestFilter filter4("testsuite2", args);
	ASSERT(filter4.shouldrunsuite);
	ASSERT(!filter4.shouldRun("test"));
	ASSERT(filter4.shouldRun("test1"));
	ASSERT(!filter4.shouldRun("test2"));
	ASSERT(filter4.shouldRun("test3"));
	ASSERT(!filter4.shouldRun("test4"));

}
示例#3
0
文件: tbl_join.c 项目: ncbi/sra-tools
static rc_t print_fastq_1_read( join_stats * stats,
                                struct join_results * results,
                                const fastq_rec * rec,
                                const join_options * jo,
                                uint32_t dst_id,
                                uint32_t read_id )
{
    rc_t rc = 0;
   
    if ( rec -> read . len != rec -> quality . len )
    {
        ErrMsg( "row #%ld : READ.len(%u) != QUALITY.len(%u)\n", rec -> row_id, rec -> read . len, rec -> quality . len );
        stats -> reads_invalid++;
        if ( jo -> terminate_on_invalid )
            return SILENT_RC( rcApp, rcNoTarg, rcReading, rcItem, rcInvalid );
    }

    if ( filter1( stats, rec, jo ) )
    {
        if ( join_results_match( results, &( rec -> read ) ) )
        {
            
            rc = join_results_print_fastq_v1( results,
                                              rec -> row_id,
                                              dst_id,
                                              read_id,
                                              jo -> rowid_as_name ? NULL : &( rec -> name ),
                                              &( rec -> read ),
                                              &( rec -> quality ) );
            if ( rc == 0 )
                stats -> reads_written++;
        }
    }
    return rc;
}
示例#4
0
    std_msgs::PointCloudFloat32* runFilters(const std_msgs::PointCloudFloat32 &cloud)
    {
	std_msgs::PointCloudFloat32 *cloudF = filter0(cloud, m_retainPointcloudFraction);
	
	if (cloudF)
	{
	    std_msgs::PointCloudFloat32 *temp = filter1(*cloudF);
	    delete cloudF;
	    cloudF = temp;
	}
	
	return cloudF;
    }
示例#5
0
int main()
{
  X = 0;
  INIT1 = TRUE;
  INIT2 = TRUE;
  while (TRUE) {
    X = 0.98*X + 85.;
    if (X >= -400. && X <= 400.) {
      filter1();
      X = X + 100.;
      INIT1 = FALSE;
    }
    else if (X >= -800. && X <= 800.) {
      filter2();
      X = X - 50.;
      INIT2 = FALSE;
    }

    __VERIFIER_assert(X >= -1155. && X <= 4251.);
  }
  return 0;
}
void run_function() {
    ASSERT(!filter_node_count, NULL);

    const size_t number_of_filters = 3;

    input_filter<type1> i_filter;
    middle_filter<type1, type2> m_filter;
    output_filter<type2> o_filter;

    unsigned limit = 1;
    // Test pipeline that contains number_of_filters filters
    for( unsigned i=0; i<number_of_filters; ++i)
        limit *= number_of_filter_types;
    // Iterate over possible filter sequences
    for( unsigned numeral=0; numeral<limit; ++numeral ) {
        unsigned temp = numeral;
        tbb::filter::mode filter_type[number_of_filter_types];
        for( unsigned i=0; i<number_of_filters; ++i, temp/=number_of_filter_types ) 
            filter_type[i] = filter_table[temp%number_of_filter_types];

        tbb::filter_t<void, type1> filter1( filter_type[0], i_filter );
        tbb::filter_t<type1, type2> filter2( filter_type[1], m_filter );
        tbb::filter_t<type2, void> filter3( filter_type[2], o_filter );
        ASSERT(filter_node_count==3, "some filter nodes left after previous iteration?");
        // Create filters sequence when parallel_pipeline() is being run
        tbb::parallel_pipeline( n_tokens, filter1 & filter2 & filter3 );
        check_and_reset();

        // Create filters sequence partially outside parallel_pipeline() and also when parallel_pipeline() is being run
        tbb::filter_t<void, type2> filter12;
        filter12 = filter1 & filter2;
        tbb::parallel_pipeline( n_tokens, filter12 & filter3 );
        check_and_reset();

        tbb::filter_t<void, void> filter123 = filter12 & filter3;
        // Run pipeline twice with the same filter sequence
        for( unsigned i = 0; i<2; i++ ) {
            tbb::parallel_pipeline( n_tokens, filter123 );
            check_and_reset();
        }

        // Now copy-construct another filter_t instance, and use it to run pipeline
        {
            tbb::filter_t<void, void> copy123( filter123 );
            tbb::parallel_pipeline( n_tokens, copy123 );
            check_and_reset();
        }

        // Construct filters and create the sequence when parallel_pipeline() is being run
        tbb::parallel_pipeline( n_tokens, 
                   tbb::make_filter<void, type1>(filter_type[0], i_filter) &
                   tbb::make_filter<type1, type2>(filter_type[1], m_filter) &
                   tbb::make_filter<type2, void>(filter_type[2], o_filter) );
        check_and_reset();

        // Construct filters, make a copy, destroy the original filters, and run with the copy
        int cnt = filter_node_count;
        {
            tbb::filter_t<void, void>* p123 = new tbb::filter_t<void,void> (
                   tbb::make_filter<void, type1>(filter_type[0], i_filter) &
                   tbb::make_filter<type1, type2>(filter_type[1], m_filter) &
                   tbb::make_filter<type2, void>(filter_type[2], o_filter) );
            ASSERT(filter_node_count==cnt+5, "filter node accounting error?");
            tbb::filter_t<void, void> copy123( *p123 );
            delete p123;
            ASSERT(filter_node_count==cnt+5, "filter nodes deleted prematurely?");
            tbb::parallel_pipeline( n_tokens, copy123 );
            check_and_reset();
        }
        ASSERT(filter_node_count==cnt, "scope ended but filter nodes not deleted?");

#if __TBB_LAMBDAS_PRESENT
        tbb::atomic<int> counter;
        counter = max_counter;
        // Construct filters using lambda-syntax and create the sequence when parallel_pipeline() is being run;
        tbb::parallel_pipeline( n_tokens, 
            tbb::make_filter<void, type1>(filter_type[0], [&counter]( tbb::flow_control& control ) -> type1 {
                    if( --counter < 0 )
                        control.stop();
                    return type1(); }
            ) &
            tbb::make_filter<type1, type2>(filter_type[1], []( type1 /*my_storage*/ ) -> type2 {
                    return type2(); }
            ) &
            tbb::make_filter<type2, void>(filter_type[2], [] ( type2 ) -> void { 
                    tmp_counter++; }
            ) 
        );
        check_and_reset();
#endif
    }
    ASSERT(!filter_node_count, "filter_node objects leaked");
}
示例#7
0
int main_asdfasdf(){
	Environment::getInstance(true);

	ResourceManagerMaster *rmms=Environment::getInstance()->getResourceManagerMaster();
	Catalog* catalog=Environment::getInstance()->getCatalog();
//	rmms->RegisterNewSlave("192.168.1.1");
//	rmms->RegisterNewSlave("192.168.1.2");
//	rmms->RegisterNewSlave("192.168.1.3");
//	rmms->RegisterNewSlave("192.168.1.4");
//	rmms->RegisterNewSlave("192.168.1.5");
//	rmms->RegisterDiskBuget(0,10000);
//	rmms->RegisterDiskBuget(1,10000);
//	rmms->RegisterDiskBuget(2,10000);
//	rmms->RegisterDiskBuget(3,10000);
//	rmms->RegisterDiskBuget(4,10000);


	/////////////////////////////////////Create table left/////////////////////
	TableDescriptor* table_1=new TableDescriptor("Left",Environment::getInstance()->getCatalog()->allocate_unique_table_id());
	table_1->addAttribute("Name",data_type(t_string),3);
	table_1->addAttribute("Age",data_type(t_int));
	table_1->addAttribute("Gender",data_type(t_int));
	table_1->addAttribute("Score",data_type(t_int));

	vector<ColumnOffset> index_1;
	index_1.push_back(0);
	index_1.push_back(1);
	index_1.push_back(3);
	const int partition_key_index_1=3;
	table_1->createHashPartitionedProjection(index_1,partition_key_index_1,3);
	catalog->add_table(table_1);

	////////////////////////////////////Create table right//////////////////////////
	TableDescriptor* table_2=new TableDescriptor("right",Environment::getInstance()->getCatalog()->allocate_unique_table_id());
	table_2->addAttribute("Name",data_type(t_string),10);
	table_2->addAttribute("Age",data_type(t_int));
	table_2->addAttribute("Gender",data_type(t_int));
	table_2->addAttribute("Score",data_type(t_int));

	vector<ColumnOffset> index_2;
	index_2.push_back(0);
	index_2.push_back(1);
	index_2.push_back(3);
	const int partition_key_index_2=3;
	table_2->createHashPartitionedProjection(index_2,partition_key_index_2,3);
	catalog->add_table(table_2);
	///////////////////////////////////////////////////////////








	///////////////////////////////////////


	////////////////////////////////////////
	/* the following codes should be triggered by Load module*/

	for(unsigned i=0;i<table_1->getProjectoin(0)->getPartitioner()->getNumberOfPartitions();i++){

		catalog->getTable(0)->getProjectoin(0)->getPartitioner()->RegisterPartition(i,5);
	}


	for(unsigned i=0;i<table_2->getProjectoin(0)->getPartitioner()->getNumberOfPartitions();i++){

		catalog->getTable(1)->getProjectoin(0)->getPartitioner()->RegisterPartition(i,4);
	}

	////////////////////////////////////////



	ProjectionBinding *pb=new ProjectionBinding();
	pb->BindingEntireProjection(catalog->getTable(0)->getProjectoin(0)->getPartitioner());
	pb->BindingEntireProjection(catalog->getTable(1)->getProjectoin(0)->getPartitioner());

	////scan////////
	std::vector<unsigned> index_list_1;
	index_list_1.push_back(0);
	index_list_1.push_back(1);
	index_list_1.push_back(3);
	LogicalOperator* scan_1=new LogicalScan(table_1->getAttributes(index_list_1));

	////////filter////////
	int f=0;
	FilterIterator::AttributeComparator filter1(column_type(t_int),Comparator::EQ,2,&f);
	std::vector<FilterIterator::AttributeComparator> ComparatorList;
	ComparatorList.push_back(filter1);
	LogicalOperator* filter=new Filter(ComparatorList,scan_1);

	////scan/////////
	std::vector<unsigned> index_list_2;
	index_list_2.push_back(0);
	index_list_2.push_back(1);
	index_list_2.push_back(3);
	LogicalOperator* scan_2=new LogicalScan(table_2->getAttributes(index_list_2));
	//////////////////


	////Join////////
	EqualJoin::JoinPair joinpair(table_1->getAttribute(3),table_2->getAttribute(3));
	std::vector<EqualJoin::JoinPair> pair_list;
	pair_list.push_back(joinpair);

	LogicalOperator* join=new EqualJoin(pair_list,filter,scan_2);


	Dataflow final_dataflow=join->getDataflow();
	printf("Total communication cost: %d\n",final_dataflow.property_.commnication_cost);





	printf("Waiting~\n");
	while(true){
		sleep(1);

	}


}
示例#8
0
int main(void) {
  loggerInit();
  PortAudioClass pa;
  SignalBlock sb;  
  FilterBlock fb;
  fb.initialize();
  
  // Global setup
  int num_inputs = 2;
  int num_outputs = 2;
  EXEC_MODE mode = SWEEP;

  int num_taps = 4800;
  
  std::vector<float> filter1(num_taps,0.f);
  filter1.at(0) = 1.f;

  std::vector<float> filter2(num_taps,0.f);
  filter2.at(0) = 1.f;

  fb.setFilterLen(num_taps);
  fb.setNumInAndOutputs(num_inputs,num_outputs);
  
  //readFile("responseL.txt", filter1);
  //readFile("responseR.txt", filter2);
  
  for(int i = 0; i < num_taps; i++)
    std::cout<<filter1.at(i)<<std::endl;

  fb.setFilterTaps(0,0, filter1);
  fb.setFilterTaps(0,1, filter2);
  //fb.setFilterTaps(1,1, filter2);
  //fb.setFilterTaps(1,0, filter2);
  fb.setFrameLen(256);
  fb.setMode(mode);

  fb.initialize();
  
  pa.setFramesPerBuffer(256);
  pa.initialize();
  
  //for(int i = 0; i < pa.getNumberOfDevices(); i++)
  //  pa.printDeviceInfo(i);

  // Currently fastrack is at index 3
  // Soundflower 16 is index 5

  // port audio setup
  pa.setCurrentDevice(3);
  pa.setNumInputChannels(num_inputs);
  pa.setNumOutputChannels(num_outputs);

 
  pa.setFs(48e3);
  
  // sweep parameters  
  if(mode == SWEEP) {
    
    
     // this is for the sweep, one pair at a time
    pa.setCurrentOutputChannel(0);
    pa.setCurrentInputChannel(0);
    sb.setFs(48e3);
    sb.setFBegin(1);
    sb.setFEnd(20000);
    sb.setLength(6);
    pa.output_data_ = sb.getSweep();
    CallbackStruct sweep = pa.setupSweepCallbackBlock();
    pa.setCallbackData((void*)&sweep);
    pa.setCallback(playRecCallback);
  }
  if(mode < SWEEP) {
    log_msg<LOG_INFO>(L"main - Convoltuion processing: %s")%mode_texts[(int)mode];
    pa.setCallbackData((void*)(&fb));
    pa.setCallback(convolutionCallback);
  }


  pa.openStream();
  pa.startStream();
  sleep(sb.getLength());
  pa.closeStream();
  pa.terminate();

  if(mode == SWEEP) {
    std::vector<float> ir = sb.getRawIr(pa.getOutputData(),
                                        pa.getInputBuffer());  
    writeFile("response1.txt", pa.getOutputData(), pa.getInputBuffer(), ir);
  }
  return 0;
}
示例#9
0
void run_filter_set(
        input_filter<t1>& i_filter,
        middle_filter<t1,t2>& m_filter,
        output_filter<t2>& o_filter,
        mode_array *filter_type,
        final_assert_type my_t) {
    tbb::filter_t<void, t1> filter1( filter_type[0], i_filter );
    tbb::filter_t<t1, t2> filter2( filter_type[1], m_filter );
    tbb::filter_t<t2, void> filter3( filter_type[2], o_filter );
    ASSERT(filter_node_count==3, "some filter nodes left after previous iteration?");
    resetCounters();
    // Create filters sequence when parallel_pipeline() is being run
    tbb::parallel_pipeline( n_tokens, filter1 & filter2 & filter3 );
    checkCounters(my_t);

    // Create filters sequence partially outside parallel_pipeline() and also when parallel_pipeline() is being run
    tbb::filter_t<void, t2> filter12;
    filter12 = filter1 & filter2;
    resetCounters();
    tbb::parallel_pipeline( n_tokens, filter12 & filter3 );
    checkCounters(my_t);

    tbb::filter_t<void, void> filter123 = filter12 & filter3;
    // Run pipeline twice with the same filter sequence
    for( unsigned i = 0; i<2; i++ ) {
        resetCounters();
        tbb::parallel_pipeline( n_tokens, filter123 );
        checkCounters(my_t);
    }

    // Now copy-construct another filter_t instance, and use it to run pipeline
    {
        tbb::filter_t<void, void> copy123( filter123 );
        resetCounters();
        tbb::parallel_pipeline( n_tokens, copy123 );
        checkCounters(my_t);
    }

    // Construct filters and create the sequence when parallel_pipeline() is being run
    resetCounters();
    tbb::parallel_pipeline( n_tokens,
               tbb::make_filter<void, t1>(filter_type[0], i_filter) &
               tbb::make_filter<t1, t2>(filter_type[1], m_filter) &
               tbb::make_filter<t2, void>(filter_type[2], o_filter) );
    checkCounters(my_t);

    // Construct filters, make a copy, destroy the original filters, and run with the copy
    int cnt = filter_node_count;
    {
        tbb::filter_t<void, void>* p123 = new tbb::filter_t<void,void> (
               tbb::make_filter<void, t1>(filter_type[0], i_filter) &
               tbb::make_filter<t1, t2>(filter_type[1], m_filter) &
               tbb::make_filter<t2, void>(filter_type[2], o_filter) );
        ASSERT(filter_node_count==cnt+5, "filter node accounting error?");
        tbb::filter_t<void, void> copy123( *p123 );
        delete p123;
        ASSERT(filter_node_count==cnt+5, "filter nodes deleted prematurely?");
        resetCounters();
        tbb::parallel_pipeline( n_tokens, copy123 );
        checkCounters(my_t);
    }

    // construct a filter with temporaries
    {
        tbb::filter_t<void, void> my_filter;
        fill_chain<t1,t2>( my_filter, filter_type, i_filter, m_filter, o_filter );
        resetCounters();
        tbb::parallel_pipeline( n_tokens, my_filter );
        checkCounters(my_t);
    }
    ASSERT(filter_node_count==cnt, "scope ended but filter nodes not deleted?");
}
/*
 * the test is like root iterator is PrintIterator, the left child and right child is FilterIterator,
 * between the PrintIterator and FilterIterator is the ExchangeIterator, and the child of FilterIterator
 * is ScanIterator, and Between is the ExchangeIterator.
 * */
int mainasf3234(int argc,char* argv[])
{
	int choice=0;


	int block_size=2048+2*sizeof(unsigned);
	printf("Master(0) or Slave(1) ?\n");
	choice=0;
	scanf("%d",&choice);

	if(choice==0)
	{
		std::cout<<"Environment initializing!"<<std::endl;
		Environment::getInstance(true);

		std::vector<std::string> upper_ip_list;
		std::vector<std::string> lower_ip_list;

		///////////////////////////////////////////Scan////////////////////////////////////////|
		std::vector<column_type> column_list;
		column_list.push_back(column_type(t_int));

		Schema* input=new SchemaFix(column_list);
		Schema* output=new SchemaFix(column_list);
		//SingleColumnScanIterator::State SCstate1("/home/imdb/temp/1_0.column_copy",input, output);
		SingleColumnScanIterator::State SCstate1("/home/imdb/temp/1_0.column.400k",input,output);
//		SingleColumnScanIterator::State SCstate1("/home/imdb/temp/Uniform_0_99.column",input,output);
		Iterator* scs1=new SingleColumnScanIterator(SCstate1);

		///////////////////////////////////////////Exchange////////////////////////////////////|
		upper_ip_list.push_back("10.11.1.204");
		upper_ip_list.push_back("10.11.1.205");
		lower_ip_list.push_back("10.11.1.206");
		lower_ip_list.push_back("10.11.1.207");

		const unsigned long long int exchange_id_1=1;
		ExchangeIteratorEager::State EIstate(input,scs1,block_size,lower_ip_list,upper_ip_list,exchange_id_1);
		Iterator* ei=new ExchangeIteratorEager(EIstate);

		///////////////////////////////////////Filter//////////////////////////////////////////|
		FilterIterator::State FIstate;
		FIstate.child=ei;

		FIstate.input=output;
		FIstate.output=output;
		int f=0;
		FilterIterator::AttributeComparator filter1(column_type(t_int),Comparator::GEQ,0,&f);
		FIstate.ComparatorList.push_back(filter1);
		Iterator* fi=new FilterIterator(FIstate);

		///////////////////////////////////////////Exchange////////////////////////////////////|
		upper_ip_list.clear();
		lower_ip_list.clear();
		upper_ip_list.push_back("10.11.1.208");
		lower_ip_list.push_back("10.11.1.204");
		lower_ip_list.push_back("10.11.1.205");

		const unsigned long long int exchange_id_0=0;
//		ExchangeIteratorEager::State EIstate_(output,fi,block_size,lower_ip_list,upper_ip_list,exchange_id_0);
		ExchangeIteratorEager::State EIstate_(output,scs1,block_size,lower_ip_list,upper_ip_list,exchange_id_0);

		Iterator* ei_=new ExchangeIteratorEager(EIstate_);

		///////////////////////////////////////Print///////////////////////////////////////////|
		PrintIterator::State PIstate(output,ei_);
		Iterator *pi=new PrintIterator(PIstate);

		//-------------------------------------------------------------------------------------|
		//IteratorExecutorMaster IEM;
		int d;
		printf("Enter 1 to continue, other number to stop.\n");
		scanf("%d",&d);

		int printcount=0;
		while(d==1)
		{
			cout<<"in the Exchange test"<<endl;
			pi->open();
			cout<<"in the Exchange test and already pass the open func"<<endl;
			while(pi->next(0))
				printcount++;
			cout<<"total number:"<<printcount<<endl;
			pi->close();
			getchar();
			scanf("%d",&d);
		}
	}
	else
	{
		Environment::getInstance(false);
		//IteratorExecutorSlave IES;
	}

	printf("Go to sleep while!\n");
	while(1)
	{
		sleep(1);
	}
	return 1;
}
int mainasdf(int argc, const char** argv){

	int master;
	printf("Master(0) or Slave(others)?\n");
	scanf("%d",&master);
	if(master==0){






		Environment::getInstance(true);

		const unsigned block_size=atoi(argv[1]);
		const unsigned thread_count=atoi(argv[2]);
		int f=atoi(argv[3]);
		const unsigned expander_buffer=atoi(argv[4]);
		const unsigned lowers_1=atoi(argv[5]);
		const unsigned lowers_2=atoi(argv[6]);
		std::vector<std::string> upper_ip_list;
		upper_ip_list.push_back("10.11.1.211");

		std::vector<std::string> lower_ip_list;

		lower_ip_list.push_back("10.11.1.201");
		lower_ip_list.push_back("10.11.1.202");
		lower_ip_list.push_back("10.11.1.203");
		lower_ip_list.push_back("10.11.1.204");


		lower_ip_list.push_back("10.11.1.209");
//		lower_ip_list.push_back("10.11.1.210");
//		lower_ip_list.push_back("10.11.1.201");
		lower_ip_list.push_back("10.11.1.214");

		lower_ip_list.push_back("10.11.1.207");
		lower_ip_list.push_back("10.11.1.208");
		lower_ip_list.push_back("10.11.1.205");
		lower_ip_list.push_back("10.11.1.206");




		std::vector<std::string> used_lowers_1;
		for(unsigned i=0;i<lowers_1;i++){
			used_lowers_1.push_back(lower_ip_list[i]);
		}

//
		std::vector<std::string> used_lowers_2;

		for(unsigned i=lower_ip_list.size()-1;i>=lower_ip_list.size()-lowers_2;i--){
			used_lowers_2.push_back(lower_ip_list[i]);
		}



		std::vector<column_type> column_list,column_list_;
		column_list.push_back(column_type(t_int));

		Schema* schema=new SchemaFix(column_list);

		/*ColumnScan*/
		ExpandableBlockStreamSingleColumnScan::State ebssc_state("/home/imdb/temp/Uniform_0_999.column",schema,block_size);
		BlockStreamIteratorBase* ebssc=new ExpandableBlockStreamSingleColumnScan(ebssc_state);
//
//		FilterIterator::AttributeComparator filter1(column_type(t_int),Comparator::L,0,&f);
//		std::vector<FilterIterator::AttributeComparator> ComparatorList;
//		ComparatorList.push_back(filter1);
//		ExpandableBlockStreamFilter::State ebsf_state(schema,ebssc,ComparatorList,block_size);
//		BlockStreamIteratorBase* bbsf=new ExpandableBlockStreamFilter(ebsf_state);

		/*Expander*/
		BlockStreamExpander::State bse_state_1(schema,ebssc,thread_count,block_size,expander_buffer);
		BlockStreamIteratorBase* bse_1=new BlockStreamExpander(bse_state_1);

		/* Exchange */
		const int exchange_id_1=1;
		ExpandableBlockStreamExchangeEpoll::State ebse_state_1(schema,bse_1,block_size,used_lowers_2,used_lowers_1,exchange_id_1);
		BlockStreamIteratorBase* ebse_1=new ExpandableBlockStreamExchangeEpoll(ebse_state_1);

		/*Filter*/
		FilterIterator::AttributeComparator filter1(column_type(t_int),Comparator::L,0,&f);
		std::vector<FilterIterator::AttributeComparator> ComparatorList;
		ComparatorList.push_back(filter1);
		ExpandableBlockStreamFilter::State ebsf_state(schema,ebse_1,ComparatorList,block_size);
		BlockStreamIteratorBase* bbsf=new ExpandableBlockStreamFilter(ebsf_state);

		/*Expander*/
		BlockStreamExpander::State bse_state(schema,bbsf,thread_count,block_size,expander_buffer);
		BlockStreamIteratorBase* bse=new BlockStreamExpander(bse_state);


		/* Exchange */
		const int exchange_id=0;
		ExpandableBlockStreamExchangeEpoll::State ebse_state(schema,bse,block_size,used_lowers_1,upper_ip_list,exchange_id);
		BlockStreamIteratorBase* ebse=new ExpandableBlockStreamExchangeEpoll(ebse_state);

		/* Performance Monitor*/
		BlockStreamPerformanceMonitorTop::State bspfm_state(schema,ebse,block_size,1000);
		BlockStreamIteratorBase* bspfm=new BlockStreamPerformanceMonitorTop(bspfm_state);

//		BlockStreamBase *block=new BlockStreamFix(block_size,4);


		volatile int choice;

		printf("Continue(1) or Not(0) ?\n");
		scanf("%d",&choice);
		unsigned tuple_count=0;
		while(choice==1){


	//		bsf->open();

			bspfm->open();
//			unsigned long long int start=curtick();
//			tuple_count=0;
			while(bspfm->next(0)){
//				BlockStreamBase::BlockStreamTraverseIterator *it=block->createIterator();
//				void* tuple;
//				while(tuple=it->nextTuple()){
////					printf("tuple:%d \n",*(int*)tuple);
//					tuple_count++;
//				}
//				block->setEmpty();
			}
//			printf("Total tupls:%d\n",tuple_count);
//			printf("Time=%f Throughput=%f.\n",getSecond(start),1024/getSecond(start));
			bspfm->close();

			printf("Continue(0) or Not(1) ?\n");
//			getchar();
			scanf("%d",&choice);
			printf("you input %d\n",choice);

		}
	}
	else{
		Environment::getInstance(false);
	}

	printf("Waiting~~~~~....\n");
	while(true){
		sleep(1);
	}
}