void ParseArguments(int argc, char *argv[], configuration &state) { // Default Values state.scale_factor = 1; state.duration = 1000; state.backend_count = 2; // Parse args while (1) { int idx = 0; int c = getopt_long(argc, argv, "ah:b:d:k:", opts, &idx); if (c == -1) break; switch (c) { case 'b': state.backend_count = atoi(optarg); break; case 'd': state.duration = atoi(optarg); break; case 'k': state.scale_factor = atoi(optarg); break; case 'h': Usage(stderr); exit(EXIT_FAILURE); break; default: fprintf(stderr, "\nUnknown option: -%c-\n", c); Usage(stderr); exit(EXIT_FAILURE); } } // Static TPCC parameters state.warehouse_count = state.scale_factor; // 10 state.item_count = 10000; // 100000 state.districts_per_warehouse = 2; // 10 state.customers_per_district = 3000; // 3000 state.new_orders_per_district = 900; // 900 // Print configuration ValidateBackendCount(state); ValidateScaleFactor(state); ValidateDuration(state); }
void ParseArguments(int argc, char *argv[], configuration &state) { // Default Values state.index = INDEX_TYPE_BWTREE; state.scale_factor = 1; state.duration = 10; state.profile_duration = 1; state.backend_count = 2; state.warehouse_count = 2; state.exp_backoff = false; state.affinity = false; state.gc_mode = false; state.gc_backend_count = 1; // Parse args while (1) { int idx = 0; int c = getopt_long(argc, argv, "heagi:k:d:p:b:w:n:", opts, &idx); if (c == -1) break; switch (c) { case 'i': { char *index = optarg; if (strcmp(index, "btree") == 0) { state.index = INDEX_TYPE_BTREE; } else if (strcmp(index, "bwtree") == 0) { state.index = INDEX_TYPE_BWTREE; } else { LOG_ERROR("Unknown index: %s", index); exit(EXIT_FAILURE); } break; } case 'k': state.scale_factor = atof(optarg); break; case 'd': state.duration = atof(optarg); break; case 'p': state.profile_duration = atof(optarg); break; case 'b': state.backend_count = atoi(optarg); break; case 'w': state.warehouse_count = atoi(optarg); break; case 'e': state.exp_backoff = true; break; case 'a': state.affinity = true; break; case 'g': state.gc_mode = true; break; case 'n': state.gc_backend_count = atof(optarg); break; case 'h': Usage(stderr); exit(EXIT_FAILURE); break; default: LOG_ERROR("Unknown option: -%c-", c); Usage(stderr); exit(EXIT_FAILURE); } } // Static TPCC parameters state.item_count = 100000 * state.scale_factor; state.districts_per_warehouse = 10; state.customers_per_district = 3000 * state.scale_factor; state.new_orders_per_district = 900 * state.scale_factor; // Print configuration ValidateIndex(state); ValidateScaleFactor(state); ValidateDuration(state); ValidateProfileDuration(state); ValidateBackendCount(state); ValidateWarehouseCount(state); ValidateGCBackendCount(state); LOG_TRACE("%s : %d", "Run client affinity", state.run_affinity); LOG_TRACE("%s : %d", "Run exponential backoff", state.run_backoff); LOG_TRACE("%s : %d", "Run garbage collection", state.gc_mode); }
void ParseArguments(int argc, char *argv[], configuration &state) { // Default Values state.index = INDEX_TYPE_BWTREE; state.scale_factor = 1; state.duration = 10; state.profile_duration = 1; state.backend_count = 2; state.column_count = 10; state.operation_count = 10; state.update_ratio = 0.5; state.zipf_theta = 0.0; state.exp_backoff = false; state.string_mode = false; state.gc_mode = false; state.gc_backend_count = 1; // Parse args while (1) { int idx = 0; int c = getopt_long(argc, argv, "hemgi:k:d:p:b:c:o:u:z:n:", opts, &idx); if (c == -1) break; switch (c) { case 'i': { char *index = optarg; if (strcmp(index, "btree") == 0) { state.index = INDEX_TYPE_BTREE; } else if (strcmp(index, "bwtree") == 0) { state.index = INDEX_TYPE_BWTREE; } else { LOG_ERROR("Unknown index: %s", index); exit(EXIT_FAILURE); } break; } case 'k': state.scale_factor = atoi(optarg); break; case 'd': state.duration = atof(optarg); break; case 'p': state.profile_duration = atof(optarg); break; case 'b': state.backend_count = atoi(optarg); break; case 'c': state.column_count = atoi(optarg); break; case 'o': state.operation_count = atoi(optarg); break; case 'u': state.update_ratio = atof(optarg); break; case 'z': state.zipf_theta = atof(optarg); break; case 'e': state.exp_backoff = true; break; case 'm': state.string_mode = true; break; case 'g': state.gc_mode = true; break; case 'n': state.gc_backend_count = atof(optarg); break; case 'h': Usage(stderr); exit(EXIT_FAILURE); break; default: LOG_ERROR("Unknown option: -%c-", c); Usage(stderr); exit(EXIT_FAILURE); break; } } // Print configuration ValidateIndex(state); ValidateScaleFactor(state); ValidateDuration(state); ValidateProfileDuration(state); ValidateBackendCount(state); ValidateColumnCount(state); ValidateOperationCount(state); ValidateUpdateRatio(state); ValidateZipfTheta(state); ValidateGCBackendCount(state); LOG_TRACE("%s : %d", "Run exponential backoff", state.exp_backoff); LOG_TRACE("%s : %d", "Run string mode", state.string_mode); LOG_TRACE("%s : %d", "Run garbage collection", state.gc_mode); }