| 21 | } oracleTraceGen_arg_t; |
| 22 | |
| 23 | int main(int argc, char *argv[]) { |
| 24 | oracleTraceGen_arg_t oarg; |
| 25 | |
| 26 | po::options_description desc("oracleTraceGen options"); |
| 27 | desc.add_options() |
| 28 | ("output_trace_type", po::value<std::string>(&(oarg.output_trace_type))->default_value(""), |
| 29 | "output_trace_type [oracleSysTwrNS/oracleAkamai/oracleWiki16u/oracleWiki19u/oracleGeneral]/oracleGeneralOpNS") |
| 30 | ("oracle_type", po::value<std::string>(&(oarg.oracle_type))->default_value("reuse"), "freq/reuse"); |
| 31 | |
| 32 | cli::cli_arg_t cli_arg = cli::Util::parse_cli_arg(argc, argv, desc); |
| 33 | if (cli_arg.opath.empty()) { |
| 34 | cli_arg.opath = cli_arg.ipath + ".oracle"; |
| 35 | } |
| 36 | |
| 37 | std::cout << "input traces " << cli_arg.ipath << ", type " << cli_arg.trace_type |
| 38 | << ", output " << oarg.output_trace_type << std::endl; |
| 39 | |
| 40 | const char *ipath_cstr = cli_arg.ipath.c_str(); |
| 41 | size_t len = strlen(ipath_cstr); |
| 42 | if (strcasecmp(ipath_cstr + len - 4, ".zst") == 0) { |
| 43 | printf("zstd trace is not supported because of reading from the back\n"); |
| 44 | exit(1); |
| 45 | } |
| 46 | |
| 47 | reader_t *reader = cli::Util::create_reader(&cli_arg); |
| 48 | |
| 49 | if (oarg.oracle_type == "freq") { |
| 50 | /* this is no longer used */ |
| 51 | std::vector<uint64_t> time_window{TIME_WINDOW}; |
| 52 | OracleFreqTraceGen trace_gen(reader, cli_arg.opath, time_window, 300); |
| 53 | trace_gen.run(); |
| 54 | } else if (oarg.oracle_type == "reuse") { |
| 55 | if (oarg.output_trace_type == "oracleSysTwrNS") { |
| 56 | OracleReuseTraceGen<struct reqEntryReuseRealSystemTwrNS> trace_gen(reader, cli_arg.opath); |
| 57 | trace_gen.run(false, true, false); |
| 58 | } else if (oarg.output_trace_type == "oracleCF1") { |
| 59 | OracleReuseTraceGen<struct reqEntryReuseCF1> trace_gen(reader, cli_arg.opath); |
| 60 | trace_gen.run(false, false, true); |
| 61 | } else if (oarg.output_trace_type == "oracleAkamai") { |
| 62 | OracleReuseTraceGen<struct reqEntryReuseAkamai> trace_gen(reader, cli_arg.opath); |
| 63 | trace_gen.run(false, false, true); |
| 64 | } else if (oarg.output_trace_type == "oracleWiki16u") { |
| 65 | OracleReuseTraceGen<struct reqEntryReuseWiki16u> trace_gen(reader, cli_arg.opath); |
| 66 | trace_gen.run(false, false, true); |
| 67 | } else if (oarg.output_trace_type == "oracleWiki19u") { |
| 68 | OracleReuseTraceGen<struct reqEntryReuseWiki19u> trace_gen(reader, cli_arg.opath); |
| 69 | trace_gen.run(false, false, true); |
| 70 | } else if (oarg.output_trace_type == "oracleGeneral") { |
| 71 | OracleReuseTraceGen<struct reqEntryReuseGeneral> trace_gen(reader, cli_arg.opath); |
| 72 | trace_gen.run(false, false, true); |
| 73 | } else if (oarg.output_trace_type == "oracleGeneralOpNS") { |
| 74 | OracleReuseTraceGen<struct reqEntryReuseGeneralOpNS> trace_gen(reader, cli_arg.opath); |
| 75 | trace_gen.run(false, false, false); |
| 76 | } else { |
| 77 | std::cerr << "unknown output type " << oarg.output_trace_type << std::endl; |
| 78 | abort(); |
| 79 | } |
| 80 | } else { |
nothing calls this directly
no test coverage detected