void IoThreadPool::start(size_t count, bool withCurrent) { MLOG_MESSAGE(Notice, "start(" << count << ", " << withCurrent << ")"); if(withCurrent) --count; impl_->threads.reserve(count); while(impl_->threads.size() != count) impl_->threads.push_back(new boost::thread(tracer(logger, Runner(impl_->ioService)))); if(withCurrent) tracer(logger, Runner(impl_->ioService), true)(); }
void TupleAnnexStep::run() { if (fInputJobStepAssociation.outSize() == 0) throw logic_error("No input data list for annex step."); fInputDL = fInputJobStepAssociation.outAt(0)->rowGroupDL(); if (fInputDL == NULL) throw logic_error("Input is not a RowGroup data list."); fInputIterator = fInputDL->getIterator(); if (fOutputJobStepAssociation.outSize() == 0) throw logic_error("No output data list for annex step."); fOutputDL = fOutputJobStepAssociation.outAt(0)->rowGroupDL(); if (fOutputDL == NULL) throw logic_error("Output is not a RowGroup data list."); if (fDelivery == true) { fOutputIterator = fOutputDL->getIterator(); } fRunner.reset(new boost::thread(Runner(this))); }
int main(int argc, const char *argv[]) { ohmu::lsa::StandaloneRunner<ohmu::lsa::OhmuComputation> Runner(argc, argv); Runner.readCallGraph(); Runner.runComputation(); Runner.printComputationResult(); return 0; }
void SubAdapterStep::run() { if (fInputJobStepAssociation.outSize() == 0) throw logic_error("No input data list for subquery adapter step."); fInputDL = fInputJobStepAssociation.outAt(0)->rowGroupDL(); if (fInputDL == NULL) throw logic_error("Input is not a RowGroup data list."); fInputIterator = fInputDL->getIterator(); if (fOutputJobStepAssociation.outSize() == 0) throw logic_error("No output data list for non-delivery subquery adapter step."); fOutputDL = fOutputJobStepAssociation.outAt(0)->rowGroupDL(); if (fOutputDL == NULL) throw logic_error("Output is not a RowGroup data list."); if (fDelivery) fOutputIterator = fOutputDL->getIterator(); fRunner.reset(new boost::thread(Runner(this))); }
int main(int argc, const char* argv[]) { try { TCLAP::CmdLine cmd("Xylene", ' ', "pre-release"); TCLAP::SwitchArg asXML("", "xml", "Read file using the XML parser", cmd); TCLAP::SwitchArg printTokens("", "tokens", "Print token list", cmd); TCLAP::SwitchArg printAST("", "ast", "Print AST (if applicable)", cmd); TCLAP::SwitchArg printIR("", "ir", "Print LLVM IR (if applicable)", cmd); TCLAP::SwitchArg doNotParse("", "no-parse", "Don't parse the token list", cmd); TCLAP::SwitchArg doNotRun("", "no-run", "Don't execute the AST", cmd); std::vector<std::string> runnerValues {"llvm-lli", "llvm-llc"}; TCLAP::ValuesConstraint<std::string> runnerConstraint(runnerValues); TCLAP::ValueArg<std::string> runner("r", "runner", "How to run this code", false, "llvm-lli", &runnerConstraint, cmd, nullptr); TCLAP::ValueArg<std::string> code("e", "eval", "Code to evaluate", false, std::string(), "string", cmd, nullptr); TCLAP::ValueArg<std::string> filePath("f", "file", "Load code from this file", false, std::string(), "path", cmd, nullptr); cmd.parse(argc, argv); if (code.getValue().empty() && filePath.getValue().empty()) { TCLAP::ArgException arg("Must specify either option -e or -f"); cmd.getOutput()->failure(cmd, arg); } std::unique_ptr<AST> ast; if (asXML.getValue()) { if (doNotParse.getValue()) return NORMAL_EXIT; if (filePath.getValue().empty()) { TCLAP::ArgException arg("XML option only works with files"); cmd.getOutput()->failure(cmd, arg); } ast = std::make_unique<AST>(XMLParser().parse(rapidxml::file<>(filePath.getValue().c_str())).getTree()); } else { std::string input; if (!filePath.getValue().empty()) { std::ifstream file(filePath.getValue()); std::stringstream buffer; buffer << file.rdbuf(); input = buffer.str(); } else { input = code.getValue(); } auto lx = Lexer(); lx.tokenize(input, filePath.getValue().empty() ? "<cli-eval>" : filePath.getValue()); if (printTokens.getValue()) for (auto tok : lx.getTokens()) println(tok); if (doNotParse.getValue()) return NORMAL_EXIT; ast = std::make_unique<AST>(TokenParser().parse(lx.getTokens()).getTree()); } if (printAST.getValue()) ast->print(); if (doNotRun.getValue()) return NORMAL_EXIT; CompileVisitor::Link v = CompileVisitor::create("Command Line Module", *ast); v->visit(); if (printIR.getValue()) v->getModule()->dump(); if (runner.getValue() == "llvm-lli") { return Runner(v).run(); } else if (runner.getValue() == "llvm-llc") { println("Not yet implemented!"); // TODO } } catch (const TCLAP::ExitException& arg) { return CLI_ERROR; } catch (const TCLAP::ArgException& arg) { println("TCLAP error", arg.error(), "for", arg.argId()); return TCLAP_ERROR; } catch (const Error& err) { println(err.what()); return USER_PROGRAM_ERROR; } // If we're debugging, crash the program on InternalError #ifndef CRASH_ON_INTERNAL_ERROR catch (const InternalError& err) { println(err.what()); return INTERNAL_ERROR; } #endif return 0; }
Status* CodeImpl::execute(vector<Var*>& vars) { return Runner(this).execute(vars); }
void Updater::Start(){ boost::thread startthread(Runner(this)); }
int main(int argc, char* argv[]) { Options options; options.freshnessPeriod = getMinimumFreshnessPeriod(); options.shouldLimitSatisfied = false; options.nMaxPings = 0; options.shouldPrintTimestamp = false; options.payloadSize = 0; namespace po = boost::program_options; po::options_description visibleOptDesc("Allowed options"); visibleOptDesc.add_options() ("help,h", "print this message and exit") ("version,V", "display version and exit") ("freshness,x", po::value<int>(), ("set freshness period in milliseconds (minimum " + std::to_string(getMinimumFreshnessPeriod().count()) + " ms)").c_str()) ("satisfy,p", po::value<int>(&options.nMaxPings), "set maximum number of pings to be satisfied") ("timestamp,t", "log timestamp with responses") ("size,s", po::value<int>(&options.payloadSize), "specify size of response payload") ; po::options_description hiddenOptDesc("Hidden options"); hiddenOptDesc.add_options() ("prefix", po::value<std::string>(), "prefix to register") ; po::options_description optDesc("Allowed options"); optDesc.add(visibleOptDesc).add(hiddenOptDesc); try { po::positional_options_description optPos; optPos.add("prefix", -1); po::variables_map optVm; po::store(po::command_line_parser(argc, argv).options(optDesc).positional(optPos).run(), optVm); po::notify(optVm); if (optVm.count("help") > 0) { usage(visibleOptDesc); } if (optVm.count("version") > 0) { std::cout << "ndnpingserver " << tools::VERSION << std::endl; exit(0); } if (optVm.count("prefix") > 0) { options.prefix = Name(optVm["prefix"].as<std::string>()); } else { std::cerr << "ERROR: No prefix specified" << std::endl; usage(visibleOptDesc); } if (optVm.count("freshness") > 0) { options.freshnessPeriod = time::milliseconds(optVm["freshness"].as<int>()); if (options.freshnessPeriod.count() < getMinimumFreshnessPeriod().count()) { std::cerr << "ERROR: Specified FreshnessPeriod is less than the minimum " << getMinimumFreshnessPeriod() << std::endl; usage(visibleOptDesc); } } if (optVm.count("satisfy") > 0) { options.shouldLimitSatisfied = true; if (options.nMaxPings < 1) { std::cerr << "ERROR: Maximum number of pings to satisfy must be greater than 0" << std::endl; usage(visibleOptDesc); } } if (optVm.count("timestamp") > 0) { options.shouldPrintTimestamp = true; } if (optVm.count("size") > 0) { if (options.payloadSize < 0) { std::cerr << "ERROR: Payload size must be greater than or equal to 0" << std::endl; usage(visibleOptDesc); } } } catch (const po::error& e) { std::cerr << "ERROR: " << e.what() << std::endl; usage(visibleOptDesc); } std::cout << "PING SERVER " << options.prefix << std::endl; return Runner(options).run(); }
/// @brief This is the entry point for the unit test executable. /// @details This will contruct an AllUnitTestGroups with the listing of unit tests /// available from autodetect.h. It will then interpret any command line arguments /// and direct the created AllUnitTestGroups about which tests to run and how to run /// them. In addition to sending the results to the standard output a copy of the /// test results will be written to TestResults.txt, if not configure not to. /// @n @n /// If no arguments are passed this will add all the tests to the AllUnitTestGroups /// and execute all tests that are not interactive. Print out a default report of them. /// @return This will return EXIT_SUCCESS if the tests ran, even if some or all failed, /// even if a child process segfaulted, but will return other statuses only if the main /// process fails. If the main process cannot create child processes it will return EXIT_FAILURE. /// @param argc Is interpretted as the amount of passed arguments /// @param argv Is interpretted as the arguments passed in from the launching shell. int main (int argc, char** argv) { ArgC = argc; ArgV = argv; GlobalCoreTestGroup TestGroups; bool WriteFile = true; if( !system( NULL ) ) // If this is not being run from a shell somehow, then using system() to run this task in a new process is not really possible. { std::cerr << "system() call not supported, missing command processor." << std::endl; return EXIT_FAILURE; } // Display everything, or just a Summary or neither? Should this process do the work, or should we spawn a new process. bool FullDisplay = true, SummaryDisplay = true; if (argc > 0) //Not really sure how this would happen, but I would rather test for it than have it fail { CommandName=argv[0]; } else { return Usage("UnitTestGroups", TestGroups); } AllUnitTestGroups Runner(TestGroups); for (int c=1; c<argc; ++c) // Check Command line for keywords and get all the test names { String ThisArg(AllLower(argv[c])); if(ThisArg=="help") { return Usage(CommandName, TestGroups); } else if(ThisArg==MemSpaceArg) // Check to see if we do the work now or later { Runner.ExecuteInThisMemorySpace = true; } else if(ThisArg=="testlist") { return PrintList(TestGroups); } else if(ThisArg=="interactive") { Runner.RunInteractiveTests=true; Runner.RunAll=false; } else if(ThisArg=="automatic") { Runner.RunAutomaticTests=true; Runner.RunAll=false; } else if(ThisArg=="all") { Runner.RunAll=true; } else if(ThisArg=="summary") { FullDisplay = false, SummaryDisplay = true; } else if(ThisArg=="skipfile") { WriteFile = false; } else // Wasn't a command so it is either gibberish or a test group { try { TestGroups.at(ThisArg.c_str()); Runner.RunAll=false; Runner.TestGroupsToRun.push_back(AllLower(argv[c])); } catch ( const std::out_of_range&) { std::cerr << ThisArg << " is not a valid testgroup or parameter." << std::endl; Usage(CommandName, TestGroups); return ExitInvalidArguments; } } } Runner.RunTests(); if(WriteFile) { String FileName("TestResults.txt"); std::ofstream OutFile(FileName.c_str()); Runner.DisplayResults(OutFile, OutFile, SummaryDisplay, FullDisplay); OutFile.close(); } Runner.DisplayResults(cout, cerr, SummaryDisplay, FullDisplay); for(AllUnitTestGroups::iterator Iter = Runner.begin(); Iter!=Runner.end(); Iter++) { if(Iter->Results>Skipped) { return ExitFailure; } } return ExitSuccess; }