Ejemplo n.º 1
0
int main()
{
    for (const auto type : CounterTypeEnum::All) {
        do_experiment(type);
    }
    return 0;
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
  parameters.handleArgs(argc,argv,"settings/defaults-swarming.settings");
  parameters.afterSetting();

  rng_t rng;
  rng.seed(parameters.randSeed());
  // rand() used in random_shuffle()
  srand(parameters.randSeed());

  // set up the (initial) swarming pattern and do the experiment
  if (parameters.swarming_pattern() == "NETWORK")
  { graph_swarming_pattern swp;
    swp.inheritParametersFrom(parameters);
    const unsigned nr = swp.n_rooms();
    swp.fixed.set_size(nr);
    swp.n = graph_swarming_pattern::network_t(nr);
    construct_network(swp.n,swp,rng);
    int fixed = (swp.n_individuals() - swp.n_mobile());
    int fpr = fixed / nr;
    for (int i = 0; i < nr; ++i)
    { swp.fixed[i] = fpr;
      fixed -= fpr;
    }
    if (fixed > 0)
      swp.fixed[0] += fixed;
    swarm_selection_indicator<graph_swarming_pattern,rng_t,ParamsClass>
      sind(rng);
    do_experiment(swp,sind,rng);
  }
  else if (parameters.swarming_pattern() == "STATIC_LATTICE")
  { static_lattice_swarming_pattern swp;
    swp.inheritParametersFrom(parameters);
    swp.initialize(rng);
    static_lattice_swarm_selection_indicator<rng_t,ParamsClass>
      sind(rng);
    do_experiment(swp,sind,rng);
  }
  else if (parameters.swarming_pattern() == "DYNAMIC_LATTICE")
  { dynamic_lattice_swarming_pattern dsp;
    dsp.inheritParametersFrom(parameters);
    dynamic_lattice_swarm_selection_indicator<rng_t,ParamsClass>
      sind(rng);
    do_experiment(dsp,sind,rng);
  }
}
Ejemplo n.º 3
0
int main(int argc, char* argv[])
{
  argc -= handleOpts(argc, argv);
  if (argc < 2){
    fprintf(stderr, usage, argv[0]);
    exit(1);
  }
  optClientno = atoi(argv[optind+1]);

  ConfigParser cp(argv[optind]);
  cp.Parse();
  bool load_complete = false;
  for (auto& section : cp._section_names){
    if (section.find("Workload") != std::string::npos){
      std::string workload = section;

      Config cfg(&cp, workload);
      // SYSTEM-SPECIFIC
      std::string system_conf = cfg.get<std::string>("yesql", "");

      std::string dir = cfg.get<std::string>("logdir", ".");
      LOG("Got %s as logdir", dir.c_str());
      if (dir.back() != '/')
        dir.append("/");
      dir.append("client-");
      dir.append(std::to_string(optClientno));
      dir.append("-");
      dir.append(workload);
      dir.append(".txt");
      LOG("Setting log as %s\n", dir.c_str());
      SetLog(dir.c_str());
      LOG("About to initialize\n");
      if (!load_complete){
        sqlite3_initialize();
// FIXME        SetDebugLevel(0);
      } else {
// FIXME        SetDebugLevel(0);
      }
      int nthreads = cfg.get<int>("threads", 1);
      bool do_load = false;
      if (!load_complete)
        do_load = cfg.get<bool>("load", true);
      LOG("About to do a yesql experiment with %d threads\n", nthreads);
      do_experiment(nthreads, system_conf.c_str(), &cfg, do_load);
      load_complete = true;
    }
  }
  return 0;
}
Ejemplo n.º 4
0
int main(int argc, char* argv[])
{
  argc -= handleOpts(argc, argv);
  if (argc < 2){
    fprintf(stderr, "Usage: %s [config.ini]\n", argv[0]);
    exit(1);
  }
  optClientno = atoi(argv[optind+1]);

  ConfigParser cp(argv[optind]);
  cp.Parse();

  for (auto& section : cp._sections){
    if (section.first.find("Workload") != std::string::npos){
      std::string workload = section.first;

      Config cfg(&cp, workload);
      // SYSTEM-SPECIFIC
      std::string system_conf;
      if (!optServerPort) system_conf = cfg.get<std::string>("yesql", "");
      else system_conf = std::string(optServerPort);

      std::string dir = cfg.get<std::string>("logdir", ".");
      if (dir.back() != '/')
        dir.append("/");
      dir.append("client-");
      dir.append(std::to_string(optClientno));
      dir.append("-");
      dir.append(workload);
      dir.append(".txt");
      SetLog(dir.c_str());
      LOG("Starting a YESQL expt.\n");
      int nthreads = cfg.get<int>("threads", 1);
      do_experiment(nthreads, system_conf.c_str(), &cfg, false);
    }
  }
  return 0;
}
Ejemplo n.º 5
0
int main(int argc, char *argv[])
{
	struct list list;
	char *store_name = "kvstore.db";
	unsigned long rec_num, rec_size;
	int rval;
	pthread_t ptid;

	if (argc != 5) {
		printf("Argument error! ./main test_type record_num record_size kv_type\n");
		return 0;
	}
	
	rec_num = (unsigned long)atoi(argv[2]);
	if (rec_num <= 0 ) {
		printf("[POS] record num argument error!\n");
		return 0;
	}
	rec_num *= 10000;
	
	rec_size = atoi(argv[3]);
	if (rec_size <= 0 ) {
		printf("[BDB] record size argument error!\n");
		return 0;
	}

	if (strcmp(argv[4], "btree") == 0) {
		kv_type = BTREE;
	} else if (strcmp(argv[4], "hash") == 0) {
		kv_type = HASH;
	} else {
		printf("[BDB] KV type argument error!\n");
		return 0;
	}

	/*if (strcmp(argv[5], "1") == 0) {
		log_flag = 1;
	} else if (strcmp(argv[5], "0") == 0) {
		log_flag = 0;
	} else {
		printf("[BDB] Log argument error!\n");
		return 0;
	}*/

	if (init_experiment(store_name) != 1) {
		printf("[BDB] init_experiment() fail!\n");
		return 0;
	}
	
	if (strcmp(argv[1], "insert") == 0) {
		rval = list_from_file(&list, rec_num, "workload_insert.txt");
		if (rval != rec_num) {
			printf("list_from_file() error!\n");
			return 0;
		}
		
		printf("[BDB] Insert Experiment\n");
		rval = do_experiment(&list, store_name, rec_num, rec_size, INSERT);

		delete_list(&list);
	} else if (strcmp(argv[1], "lookup") == 0) {
		rval = list_from_file(&list, rec_num, "workload_insert.txt");
		if (rval != rec_num) {
			printf("list_from_file() error!\n");
			return 0;
		}
		
		printf("[BDB] Lookup Experiment\n");
		rval = do_experiment(&list, store_name, rec_num, rec_size, LOOKUP);
		if (rval != rec_num) {
			printf("error!\n");
			return 0;
		}
		
		delete_list(&list);
	} else if (strcmp(argv[1], "delete") == 0) {
		rval = list_from_file(&list, rec_num, "workload_insert.txt");
		if (rval != rec_num) {
			printf("list_from_file() error!\n");
			return 0;
		}
		
		printf("[BDB] Delete Experiment\n");
		rval = do_experiment(&list, store_name, rec_num, rec_size, DELETE);
		if (rval != rec_num) {
			printf("error!\n");
			return 0;
		}
		
		delete_list(&list);
	} else if (strcmp(argv[1], "update") == 0) {
		rec_num += rec_num/FREQ_NUM;
		rval = list_from_file(&list, rec_num, "workload_update.txt");
		if (rval != rec_num) {
			printf("list_from_file() error!\n");
			return 0;
		}
		
		printf("[BDB] Update Experiment\n");
		rval = do_experiment(&list, store_name, rec_num, rec_size, UPDATE);
		if (rval != rec_num) {
			printf("error!\n");
			return 0;
		}
		
		delete_list(&list);
	} else {
		printf("[BDB] type error!\n");
	}

	if (terminate_experiment(store_name) != 1) {
		printf("[BDB] terminate_experiment() fail!\n");
		return 0;
	}

	//system("rm /mnt/kvstore.db");
	
	return 0;
}
Ejemplo n.º 6
0
Archivo: gio.c Proyecto: kento/gio
int main(int argc,char *argv[])
{
  int c;
  int option_index;

  MPI_Init(&argc, &argv); 
  MPI_Comm_rank(MPI_COMM_WORLD, &myrank); 
  MPI_Comm_size (MPI_COMM_WORLD, &world_comm_size); 

  gio_err_init(myrank);

  do {
    c = getopt_long_only(argc, argv, "+", option_table, &option_index);
    switch (c) {
    case '?':
    case ':':
      usage();
      exit(EXIT_FAILURE);
      break;
    case EOF:
      break;
    case 0:
      switch (option_index) {
      case 0:
	strcpy(expr, optarg);
	expr_on = 1;
	break;
      case 1:
	strcpy(scale, optarg);
	scale_on = 1;
	break;
      case 2:
	data_size = atoi(optarg);
	data_size_on = 1;
	break;
      case 3:
	strcpy(target_path, optarg);
	target_path_on = 1;
      case 4:
	m_size = atoi(optarg);
	break;
      default:
	gio_dbg("Unknown option\n");
	usage();
	exit(EXIT_FAILURE);
	break;
      }
      break;
    default:
      gio_dbg("Unknown option\n");
      usage();
      exit(EXIT_FAILURE);
      break;
    }
  } while (c != EOF);

  if (!expr_on || !scale_on || !data_size_on || !target_path_on) {
    usage();
    exit(EXIT_SUCCESS);
  }

  if (strcmp(expr, "pw") == 0) {
    if (m_size == 0) {
      usage();
      exit(EXIT_SUCCESS);
    }
  }

  do_experiment();

  MPI_Finalize(); 
  return 0;
}
Ejemplo n.º 7
0
Archivo: main.c Proyecto: kunulee/f-stm
int main(int argc, char *argv[])
{
	struct list list;
	unsigned long rec_num, rec_size;
	int rval;

	if (argc != 6) {
		printf("Argument error! ./main obj_store record_num record_size kv_type TEST_TYPE\n");
		return 0;
	}
	//store_name = argv[6] ;
	//store_name = argv[6];
	char * store_name ; 	
	store_name = argv[1] ; 	

	printf("===============================\n") ; 	
	printf("store_name : %s\n" , store_name) ;	
	

	rec_num = (unsigned long)atoi(argv[2]);
	printf("rec_num :%d\n" , rec_num) ; 	

	if (rec_num <= 0 ) {
		printf("[POS] record num argument error!\n");
		return 0;
	}
	rec_num *= 10000;
	
	rec_size = atoi(argv[3]);
	printf("rec_size : %d\n" ,rec_size ) ; 	
	printf("==============================\n") ; 	

	if (rec_size <= 0 ) {
		printf("[POS] record size argument error!\n");
		return 0;
	}
	value = (unsigned long *)malloc(rec_size);

	func_ptr = (struct function_ptr *)malloc(sizeof(struct function_ptr));
	if (strcmp(argv[4], "btree") == 0) {
		kv_type = BTREE;
		func_ptr->open_func = stm_pos_btree_open;
		func_ptr->close_func = stm_pos_btree_close;
		func_ptr->insert_func = stm_pos_btree_insert;
		func_ptr->lookup_func = pos_btree_lookup;
		func_ptr->remove_func = stm_pos_btree_remove;
	} else if (strcmp(argv[4], "hash") == 0) {
		kv_type = HASH;
		func_ptr->open_func = stm_pos_hashtable_open;
		func_ptr->close_func = stm_pos_hashtable_close;
		func_ptr->insert_func = stm_pos_hashtable_insert;
		func_ptr->lookup_func = pos_hashtable_search;
		func_ptr->remove_func = stm_pos_hashtable_remove;
	} else if (strcmp(argv[4], "list") == 0) {
		printf("LIST\n") ; 	
		kv_type = LIST;
		func_ptr->open_func = stm_pos_list_open;
		func_ptr->close_func = stm_pos_list_close;
		func_ptr->insert_func = stm_pos_list_insert;
		func_ptr->lookup_func = pos_list_lookup;
		func_ptr->remove_func = stm_pos_list_remove;
	} else {
		printf("[POS] KV type argument error!\n");
		return 0;
	}
	/* pos_stm_init_xxx , pos_stm_open_xxx */ 
	printf("===init===\n") ; 		
	if (init_experiment(store_name, rec_num) != 1) {
		printf("[POS] init_experiment() fail!\n");
		return 0;
	}
	printf("===end===\n\n") ; 	


	//if (func_ptr->open_func(store_name) != 0) {
	//	printf("[POS] pos_open() fail\n");
	//	return 0;
	//}

	if (strcmp(argv[5], "insert") == 0 ){ 
		rval = list_from_file(&list ,rec_num , "workload_insert.txt") ; 	
		if( rval != rec_num ){ 
			printf("list_from_file() error\n"); 
			return 0 ;
		}
		printf("[POS] Insert Experiment\n") ; 	
		rval = do_experiment(&list , store_name , rec_num , rec_size ,INSERT) ; 	
	}else if(strcmp(argv[5], "update") == 0){ 
		rval = list_from_file(&list ,rec_num , "workload_insert.txt") ; 	
		if( rval != rec_num ){ 
			printf("list_from_file() error\n"); 
			return 0 ;
		}
	}else if(strcmp(argv[5] , "delete") == 0){ 
		rval = list_from_file(&list ,rec_num , "workload_insert.txt") ; 	
		if( rval != rec_num ){ 
			printf("list_from_file() error\n"); 
			return 0 ;
		}
		printf("[POS] Delete Experiment\n") ;
		rval = do_experiment(&list , store_name , rec_num , rec_size ,DELETE) ; 	
	}	
	else if (strcmp(argv[5], "separate") == 0) {
	
		rval = list_from_file(&list, rec_num, "workload_insert.txt");
	
		if (rval != rec_num) {
			printf("list_from_file() error!\n");
			return 0;
		}
		
		printf("[POS] Insert Experiment\n");
		rval = do_experiment(&list, store_name, rec_num, rec_size, INSERT);

		printf("[POS] Lookup Experiment\n");
		rval = do_experiment(&list, store_name, rec_num, rec_size, LOOKUP);

		printf("[POS] Delete Experiment\n");
		rval = do_experiment(&list, store_name, rec_num, rec_size, DELETE);
		
		delete_list(&list);
	} else if (strcmp(argv[1], "update") == 0) {
		rec_num += rec_num/FREQ_NUM;
		rval = list_from_file(&list, rec_num, "workload_update.txt");
		if (rval != rec_num) {
			printf("list_from_file() error!\n");
			return 0;
		}
		
		printf("[POS] Update Experiment\n");
		rval = do_experiment(&list, store_name, rec_num, rec_size, UPDATE);
		
		delete_list(&list);
	}
	
	//func_ptr->close_func(store_name);
	free(value);
	free(func_ptr);
	if (terminate_experiment(store_name) != 1) {
		printf("[POS] terminate_experiment() fail!\n");
		return 0;
	}
	return 0;
}