Пример #1
0
void ParseArguments(int argc, char *argv[], configuration &state) {
  // Default Values
  state.operator_type = OPERATOR_TYPE_INVALID;

  state.scale_factor = 100.0;
  state.tuples_per_tilegroup = DEFAULT_TUPLES_PER_TILEGROUP;

  state.transactions = 1;
  state.selectivity = 1.0;
  state.projectivity = 1.0;

  state.layout_mode = LAYOUT_ROW;

  state.experiment_type = EXPERIMENT_TYPE_INVALID;

  state.column_count = 100;
  state.write_ratio = 0.0;

  state.access_num_groups = 1;
  state.subset_ratio = 1.0;
  state.subset_experiment_type = SUBSET_TYPE_INVALID;

  state.adapt = false;
  state.theta = 0.0;
  state.reorg = false;
  state.distribution = false;

  // Parse args
  while (1) {
    int idx = 0;
    int c = getopt_long(argc, argv, "aho:k:s:p:l:t:e:c:w:g:", opts, &idx);

    if (c == -1) break;

    switch (c) {
      case 'o':
        state.operator_type = (OperatorType)atoi(optarg);
        break;
      case 'k':
        state.scale_factor = atoi(optarg);
        break;
      case 's':
        state.selectivity = atof(optarg);
        break;
      case 'p':
        state.projectivity = atof(optarg);
        break;
      case 'l':
        state.layout_mode = (LayoutType)atoi(optarg);
        break;
      case 't':
        state.transactions = atoi(optarg);
        break;
      case 'e':
        state.experiment_type = (ExperimentType)atoi(optarg);
        break;
      case 'c':
        state.column_count = atoi(optarg);
        break;
      case 'w':
        state.write_ratio = atof(optarg);
        break;
      case 'g':
        state.tuples_per_tilegroup = atoi(optarg);
        break;
      case 'h':
        Usage(stderr);
        break;

      default:
        fprintf(stderr, "\nUnknown option: -%c-\n", c);
        Usage(stderr);
    }
  }

  if (state.experiment_type == EXPERIMENT_TYPE_INVALID) {
    // Print configuration
    ValidateOperator(state);
    ValidateLayout(state);
    ValidateSelectivity(state);
    ValidateProjectivity(state);
    ValidateScaleFactor(state);
    ValidateColumnCount(state);
    ValidateWriteRatio(state);
    ValidateTuplesPerTileGroup(state);

    std::cout << std::setw(20) << std::left << "transactions "
              << " : " << state.transactions << std::endl;
  } else {
    ValidateExperiment(state);
  }

  // cache orig scale factor
  orig_scale_factor = state.scale_factor;
}
void ParseArguments(int argc, char *argv[], configuration &state) {
  // Default Values
  state.hybrid_scan_type = HYBRID_SCAN_TYPE_HYBRID;
  state.operator_type = OPERATOR_TYPE_DIRECT;

  state.scale_factor = 100.0;
  state.tuples_per_tilegroup = DEFAULT_TUPLES_PER_TILEGROUP;

  state.transactions = 1;
  state.selectivity = 1.0;
  state.projectivity = 1.0;

  state.layout_mode = LAYOUT_TYPE_ROW;

  state.experiment_type = EXPERIMENT_TYPE_INVALID;

  state.column_count = 500;
  state.write_ratio = 0.0;

  state.index_count = 1;

  state.adapt = false;

  // Parse args
  while (1) {
    int idx = 0;
    int c = getopt_long(argc, argv, "aho:k:s:p:l:t:e:c:w:g:y:i:", opts, &idx);

    if (c == -1) break;

    switch (c) {
      case 'o':
        state.operator_type = (OperatorType)atoi(optarg);
        break;
      case 'k':
        state.scale_factor = atoi(optarg);
        break;
      case 's':
        state.selectivity = atof(optarg);
        break;
      case 'p':
        state.projectivity = atof(optarg);
        break;
      case 'l':
        state.layout_mode = (LayoutType)atoi(optarg);
        break;
      case 't':
        state.transactions = atoi(optarg);
        break;
      case 'e':
        state.experiment_type = (ExperimentType)atoi(optarg);
        break;
      case 'c':
        state.column_count = atoi(optarg);
        break;
      case 'w':
        state.write_ratio = atof(optarg);
        break;
      case 'g':
        state.tuples_per_tilegroup = atoi(optarg);
        break;
      case 'y':
        state.hybrid_scan_type = (HybridScanType)atoi(optarg);
        break;
      case 'i':
        state.index_count = atoi(optarg);
        break;

      case 'h':
        Usage();
        break;

      default:
        LOG_ERROR("Unknown option: -%c-", c);
        Usage();
    }
  }

  if (state.experiment_type == EXPERIMENT_TYPE_INVALID) {
    // Print configuration
    ValidateLayout(state);
    ValidateHybridScanType(state);
    ValidateOperator(state);
    ValidateSelectivity(state);
    ValidateProjectivity(state);
    ValidateScaleFactor(state);
    ValidateColumnCount(state);
    ValidateIndexCount(state);
    ValidateWriteRatio(state);
    ValidateTuplesPerTileGroup(state);

    LOG_INFO("%s : %lu", "transactions", state.transactions);
  } else {
    ValidateExperiment(state);
  }

  // cache orig scale factor
  orig_scale_factor = state.scale_factor;
}
Пример #3
0
void ParseArguments(int argc, char* argv[], configuration& state) {
  // Default Values
  state.logging_type = LOGGING_TYPE_NVM_WAL;

  state.log_file_dir = TMP_DIR;
  state.data_file_size = 512;

  state.experiment_type = EXPERIMENT_TYPE_INVALID;
  state.wait_timeout = 200;

  // Default Values
  // Default Values
  ycsb::state.scale_factor = 1;
  ycsb::state.duration = 10;
  ycsb::state.snapshot_duration = 0.1;
  ycsb::state.column_count = 10;
  ycsb::state.update_ratio = 0.5;
  ycsb::state.backend_count = 2;
  ycsb::state.num_loggers = 0;
  ycsb::state.sync_commit = 0;
  ycsb::state.wait_timeout = 0;
  ycsb::state.file_size = 32;
  ycsb::state.log_buffer_size = 32768;
  ycsb::state.checkpointer = 0;
  ycsb::state.flush_freq = 0;

  // Parse args
  while (1) {
    int idx = 0;
    int c = getopt_long(argc, argv, "ahk:d:s:c:u:b:l:x:w:f:z:p:q:", opts, &idx);

    if (c == -1) break;

    switch (c) {
      case 'k':
        ycsb::state.scale_factor = atoi(optarg);
        break;
      case 'd':
        ycsb::state.duration = atof(optarg);
        break;
      case 's':
        ycsb::state.snapshot_duration = atof(optarg);
        break;
      case 'c':
        ycsb::state.column_count = atoi(optarg);
        break;
      case 'u':
        ycsb::state.update_ratio = atof(optarg);
        break;
      case 'b':
        ycsb::state.backend_count = atoi(optarg);
        break;
      case 'x':
        ycsb::state.sync_commit = atoi(optarg);
        break;
      case 'l':
        ycsb::state.num_loggers = atoi(optarg);
        break;
      case 'w':
        ycsb::state.wait_timeout = atol(optarg);
        break;
      case 'f':
        ycsb::state.file_size = atoi(optarg);
        break;
      case 'z':
        ycsb::state.log_buffer_size = atoi(optarg);
        break;
      case 'p':
        ycsb::state.checkpointer = atoi(optarg);
        break;
      case 'q':
        ycsb::state.flush_freq = atoi(optarg);
        break;
      case 'h':
        Usage(stderr);
        exit(EXIT_FAILURE);
        break;
      default:
        exit(EXIT_FAILURE);
        break;
    }
  }

  // Print configurations
  ValidateLoggingType(state);
  ValidateDataFileSize(state);
  ValidateLogFileDir(state);
  ValidateWaitTimeout(state);
  ValidateExperiment(state);

  // Print configuration
  ycsb::ValidateScaleFactor(ycsb::state);
  ycsb::ValidateColumnCount(ycsb::state);
  ycsb::ValidateUpdateRatio(ycsb::state);
  ycsb::ValidateBackendCount(ycsb::state);
  ycsb::ValidateLogging(ycsb::state);
  ycsb::ValidateDuration(ycsb::state);
  ycsb::ValidateSnapshotDuration(ycsb::state);
  //  ycsb::ValidateFlushFreq(ycsb::state);
}
void ParseArguments(int argc, char* argv[], configuration& state) {
  // Default Values
  state.logging_type = LOGGING_TYPE_DRAM_NVM;

  state.log_file_dir = TMP_DIR;
  state.data_file_size = 512;

  state.experiment_type = EXPERIMENT_TYPE_INVALID;
  state.wait_timeout = 200;

  // Default Values
  ycsb::state.scale_factor = 1;
  ycsb::state.transaction_count = 10000;
  ycsb::state.column_count = 10;
  ycsb::state.update_ratio = 0.5;
  ycsb::state.backend_count = 1;

  // Parse args
  while (1) {
    int idx = 0;
    int c = getopt_long(argc, argv, "ahl:f:e:w:k:t:c:u:b:", opts, &idx);

    if (c == -1) break;

    switch (c) {
      case 'l':
        state.logging_type = (LoggingType)atoi(optarg);
        break;
      case 'f':
        state.data_file_size = atoi(optarg);
        break;
      case 'e':
        state.experiment_type = (ExperimentType)atoi(optarg);
        break;
      case 'w':
        state.wait_timeout = atoi(optarg);
        break;

        // YCSB
      case 'k':
        ycsb::state.scale_factor = atoi(optarg);
        break;
      case 't':
        ycsb::state.transaction_count = atoi(optarg);
        break;
      case 'c':
        ycsb::state.column_count = atoi(optarg);
        break;
      case 'u':
        ycsb::state.update_ratio = atof(optarg);
        break;
      case 'b':
        ycsb::state.backend_count = atoi(optarg);
        break;

      case 'h':
        Usage(stderr);
        break;

      default:
        exit(EXIT_FAILURE);
        break;
    }
  }

  // Print configuration
  ValidateLoggingType(state);
  ValidateDataFileSize(state);
  ValidateLogFileDir(state);
  ValidateWaitTimeout(state);
  ValidateExperiment(state);

  // Print configuration
  ycsb::ValidateScaleFactor(ycsb::state);
  ycsb::ValidateColumnCount(ycsb::state);
  ycsb::ValidateUpdateRatio(ycsb::state);
  ycsb::ValidateBackendCount(ycsb::state);
  //ycsb::ValidateTransactionCount(ycsb::state);

}