int main(int argc, char **argv) { exitCode = 0; initGtk(&argc, &argv); migrateConfigToXdgDir(); migrateThemesToXdgDir(); initDataDefault(); if (parseCommandline(&argc, &argv)) { if(initLockFile()) { printMessage(MSG_INFO, "Startup %s %s (-h to print usage)\n", OBS_NAME, OBS_VERSION); if (initConfigs()) { initWidgets(); gtk_widget_show_all(winWidget); gtk_main(); } else exitCode = 1; deleteLockFile(); } else exitCode = 1; } else exitCode = 1; freeData(); exit(exitCode); }
int main(int argc, char* argv[]) { ParameterABCrossValidate parameters = parseCommandline(argc, argv); if (parameters.verbose) { std::string boostingTypeName[3] = {"discrete", "real", "gentle"}; std::cerr << std::endl; std::cerr << "Traing data: " << parameters.trainingDataFilename << std::endl; std::cerr << " Type: " << boostingTypeName[parameters.boostingType] << std::endl; std::cerr << " #rounds: " << parameters.roundTotal << std::endl; std::cerr << " #" << parameters.k_cv << " fold cross-valiation" << std::endl; std::cerr << std::endl; } AdaBoost adaBoost; adaBoost.setBoostingType(parameters.boostingType); adaBoost.readAllSamples(parameters.trainingDataFilename, parameters.k_cv); double accuracyAll = 0.0; for (int i = 0; i < parameters.k_cv; i++) { if (parameters.verbose) std::cout << "====== CV Round " << i << " ======" << std::endl; adaBoost.setCrossValidationSampels(i, parameters.k_cv); adaBoost.train(parameters.roundTotal, parameters.verbose); TestResult res = adaBoost.test(false, ""); accuracyAll += res.accuracyAll; if (parameters.verbose) { std::cout << "Accuracy = " << res.accuracyAll << std::endl; std::cout << " precision: " << res.precision << " , negative: " << res.recall << std::endl; } } std::cout << "\nCross Validation Accuracy: " << accuracyAll / parameters.k_cv << std::endl; }
MainWindow::MainWindow(int argc, char *argv[], QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MainWindow) { QCoreApplication::setOrganizationName(PIXYMON_COMPANY); QCoreApplication::setApplicationName(PIXYMON_TITLE); parseCommandline(argc, argv); qRegisterMetaType<Device>("Device"); m_ui->setupUi(this); setWindowTitle(PIXYMON_TITLE); m_interpreter = NULL; m_flash = NULL; m_pixyConnected = false; m_pixyDFUConnected = false; m_configDialog = NULL; m_fwInstructions = NULL; m_fwMessage = NULL; m_versionIncompatibility = false; m_waiting = WAIT_NONE; m_settings = new QSettings(QSettings::NativeFormat, QSettings::UserScope, PIXYMON_COMPANY, PIXYMON_TITLE); m_console = new ConsoleWidget(this); m_video = new VideoWidget(this); m_ui->imageLayout->addWidget(m_video); m_ui->imageLayout->addWidget(m_console); m_ui->toolBar->addAction(m_ui->actionPlay_Pause); m_ui->actionDefault_program->setIcon(QIcon(":/icons/icons/home.png")); m_ui->toolBar->addAction(m_ui->actionDefault_program); m_ui->actionRaw_video->setIcon(QIcon(":/icons/icons/raw.png")); m_ui->toolBar->addAction(m_ui->actionRaw_video); m_ui->actionCooked_video->setIcon(QIcon(":/icons/icons/cooked.png")); m_ui->toolBar->addAction(m_ui->actionCooked_video); m_ui->actionConfigure->setIcon(QIcon(":/icons/icons/config.png")); m_ui->toolBar->addAction(m_ui->actionConfigure); updateButtons(); m_parameters.add("Pixy start command", PT_STRING, "runprogArg 8 1", "The command that is sent to Pixy upon initialization"); // start looking for devices m_connect = new ConnectEvent(this); if (m_connect->getConnected()==NONE) m_console->error("No Pixy devices have been detected.\n"); }
/*@-superuser@*/ int initializeSystem(int argc, char *argv[], struct InterfaceInfoList * ifs, struct ServerInfoList * servers, struct FdInfoList * fds) { struct ConfigInfo cfg; pid_t pid, pidfile_pid; int pidfile_fd; cfg.conffile_name = CFG_FILENAME; cfg.do_fork = true; parseCommandline(argc, argv, &cfg); /*@-boundswrite@*/ getConfig(cfg.conffile_name, &cfg); initFDs(fds, &cfg); /*@=boundswrite@*/ pidfile_fd = Eopen(cfg.pidfile_name, O_WRONLY|O_CREAT, 0444); openMsgfile(cfg.logfile_name); *ifs = cfg.interfaces; *servers = cfg.servers; Eclose(0); if (cfg.do_fork) pid = fork(); else pid = 0; pidfile_pid = 0; switch (pid) { case 0 : pidfile_pid = initializeDaemon(&cfg); break; case -1 : perror("fork()"); break; default : pidfile_pid = pid; break; } if (pidfile_pid!=0) { writeUInt(pidfile_fd, pidfile_pid); (void)write(pidfile_fd, "\n", 1); } freeLimitList(&cfg.ulimits); /* It is too late to handle an error here. So just ignore it... */ (void)close(pidfile_fd); return pid; }
int main(int argc, char *argv[]) { std::vector<Record> records; float *recordDistances; //LatLong locations[REC_WINDOW]; std::vector<LatLong> locations; int i; // args char filename[100]; int resultsCount=10,quiet=0,timing=0,platform=-1,device=-1; float lat=0.0,lng=0.0; // parse command line if (parseCommandline(argc, argv, filename,&resultsCount,&lat,&lng, &quiet, &timing, &platform, &device)) { printUsage(); return 0; } int numRecords = loadData(filename,records,locations); //for(i=0;i<numRecords;i++) // printf("%s, %f, %f\n",(records[i].recString),locations[i].lat,locations[i].lng); if (!quiet) { printf("Number of records: %d\n",numRecords); printf("Finding the %d closest neighbors.\n",resultsCount); } if (resultsCount > numRecords) resultsCount = numRecords; context = cl_init_context(platform,device,quiet); recordDistances = OpenClFindNearestNeighbors(context,numRecords,locations,lat,lng,timing); // find the resultsCount least distances findLowest(records,recordDistances,numRecords,resultsCount); // print out results if (!quiet) for(i=0;i<resultsCount;i++) { printf("%s --> Distance=%f\n",records[i].recString,records[i].distance); } free(recordDistances); return 0; }
extern "C" int main (int argc, char **argv) { ::testing::AddGlobalTestEnvironment(new LocalEnv); //::testing::GTEST_FLAG(throw_on_failure) = true; ::testing::InitGoogleTest(&argc, argv); setDefaultOptions(); parseCommandline(argc, argv); Application& app = Singleton<Application>::getInstance(); const GamePtr& game = Singleton<GameRegistry>::getInstance().getGame(); app.setOrganisation("caveproductions"); app.setName(game->getName()); Log::get().addConsole(&console); Config.init(nullptr, argc, argv); return RUN_ALL_TESTS(); }
bool generateDoc(void) { if (!parseCommandline()) { help(); return false; } // initialize the system - load the dtype scripts according to the config initialize(); // read the additional docs file. This file contains docs for each entity // has a simple format [prop PropName] or [link LinkName] for doc target change. Other lines (after stripping # comments) // are accumulated to the last specified doc target loadAdditionalDocStrings(); // generate the doc doGenerate(); return true; }
int main(int argc,char **argv) { unsigned int ii; /* initialize globals */ g_verbose=0; /* verbose off */ g_quit=0; /* quit for making the ppp connection is established*/ g_quit_time=0; /* stay up forever */ *g_configfile='\0'; /* the config file */ #if 0 *(unsigned int volatile *)(0xfff83050) = 0x15555055; *(unsigned int volatile *)(0xfff83054) = 0x30; *(unsigned int volatile *)(0xfff83058) = 0x00; #endif #if 1 //=============> enable CTS/RTS pins *(unsigned int volatile *)(0xfff83050) &= 0xfffff0ff; *(unsigned int volatile *)(0xfff83050) |= 0xa00; *(unsigned int volatile *)(0xfff80110) = 0xf; //CSR_WRITE(COM_MCR_1, CSR_READ(COM_MCR_1)&0xf); #endif //ii = *(unsigned int volatile *)(0xfff83000); //ii |= 4; // enable modem signal pins //*(unsigned int volatile *)(0xfff83000) = ii; //sleep(1); //printf("GPIO configured as %08x\n", *(unsigned int volatile *)(0xfff83050)); //printf("UART configured as %08x\n", *(unsigned int volatile *)(0xfff80110)); #ifdef HAVE_MOTIF /* create the user interface */ DoMotif(argc,argv); #else parseCommandline(argc,argv); startPPP(); #endif /* HAVE_MOTIF */ exit(0); }
int main(int argc, char **argv) { initPlatform(); initConfig(); std::vector<Common::UString> args; Common::Platform::getParameters(argc, argv, args); Common::UString target; int code; if (!parseCommandline(args, target, code)) return code; // Check the requested target if (target.empty() || !ConfigMan.hasGame(target)) { Common::UString path = ConfigMan.getString("path"); if (path.empty()) { if (ConfigMan.getBool("listdebug", false)) { listDebug(); return 0; } error("Neither an existing target, nor a path specified"); } bool useExisting = false; if (target.empty()) { target = ConfigMan.findGame(path); if (!target.empty()) { warning("No target specified, but found a target with a matching path"); useExisting = true; } } target = ConfigMan.createGame(path, target); if (target.empty()) error("Failed creating a new config target for the game"); if (!useExisting) warning("Creating a new target for this game"); } if (!ConfigMan.setGame(target) || !ConfigMan.isInGame()) error("No target \"%s\" in the config file", target.c_str()); /* Open the log file. * * NOTE: A log is opened by default, unless the logfile config value * is set to an empty string or nologfile is set to true. */ Common::UString logFile = DebugMan.getDefaultLogFile(); if (ConfigMan.hasKey("logfile")) logFile = ConfigMan.getString("logfile"); if (ConfigMan.getBool("nologfile", false)) logFile.clear(); if (!logFile.empty()) if (!DebugMan.openLogFile(logFile)) warning("Failed to open log file \"%s\" for writing", logFile.c_str()); DebugMan.logCommandLine(args); status("Target \"%s\"", target.c_str()); Common::UString dirArg = ConfigMan.getString("path"); if (dirArg.empty()) error("Target \"%s\" is missing a path", target.c_str()); Common::UString baseDir; try { baseDir = Common::FilePath::canonicalize(dirArg); } catch (...) { error("Invalid path \"%s\"", dirArg.c_str()); } if (!Common::FilePath::isDirectory(baseDir) && !Common::FilePath::isRegularFile(baseDir)) error("No such file or directory \"%s\"", baseDir.c_str()); Engines::GameThread *gameThread = new Engines::GameThread; try { // Enable requested debug channels initDebug(); // Initialize all necessary subsystems init(); // Probe and create the game engine gameThread->init(baseDir); if (ConfigMan.getBool("listdebug", false)) { // List debug channels listDebug(); } else { // Run the game gameThread->run(); EventMan.runMainLoop(); } } catch (...) { EventMan.raiseFatalError(); Common::exceptionDispatcherError(); } if (EventMan.fatalErrorRaised()) std::exit(1); status("Shutting down"); try { delete gameThread; } catch (...) { } try { // Configs changed, we should save them if (ConfigMan.changed()) { // But don't clobber a broken save if (!configFileIsBroken) ConfigMan.save(); } } catch (...) { Common::exceptionDispatcherError(); } deinit(); return 0; }
int main(int argc, char* argv[]) { hc_session_t *session = NULL; hc_oid returnedOid; hc_long_t count = 0; int finished = 0; int32_t response_code = RETURN_SUCCESS; hc_query_result_set_t *rset = NULL; hc_nvr_t *nvr = NULL; hc_long_t query_integrity_time; int query_complete; hcerr_t res = HCERR_OK; int parametersUsed = USES_SERVERADDRESS | USES_QUERY | USES_SELECT_METADATA | USES_MAXRESULTS; /* Initialize commandline structure */ cmdLine.storagetekServerAddress = NULL; cmdLine.query = NULL; cmdLine.help = 0; cmdLine.debug_flags = 0; cmdLine.storagetekPort = 0; cmdLine.maxResults = DEFAULT_MAX_RESULTS; /* Initialize metadata map. The metadata map structure is not part of the API but common */ /* code written for the convenience of these examples. See example_metadata.c. */ if (initMetadataMap(&cmdLine.cmdlineMetadata) == 0) { return exitApp(RETURN_MAPINITERROR); } /* if initMetadataMap == 0 */ /* Get commandline (see example_commandline.c) */ if (parseCommandline( argc, argv, parametersUsed) == 0) { printUsage(); return RETURN_COMMANDLINE_ERROR; } /* if parseCommandline failed */ else { if (cmdLine.help == 1) { printUsage(); return RETURN_SUCCESS; } /* if help requested */ } /* else parseCommandline succeeded */ /* Initialize @HoneycombProductName@ API */ res = hc_init(malloc,free,realloc); if (res != HCERR_OK) { printf("An error occurred while initializing the API.\n"); return res; } /* if error */ if (cmdLine.debug_flags) { /* Internal debug flags */ hc_set_global_parameter(HCOPT_DEBUG_FLAGS, cmdLine.debug_flags); } res = hc_session_create_ez(cmdLine.storagetekServerAddress, (cmdLine.storagetekPort > 0 ? cmdLine.storagetekPort : STORAGETEK_PORT), &session); if (res != HCERR_OK) { HandleError(session,res); return RETURN_STORAGETEK_ERROR; } /* if initialization failed */ /* Run queryplus if we have a select clause (-s option on the commandline), otherwise run query */ if (cmdLine.cmdlineMetadata.mapSize > 0) { res = hc_query_ez(session, cmdLine.query, cmdLine.cmdlineMetadata.namePointerArray, cmdLine.cmdlineMetadata.mapSize, 100, &rset); } /* if outputing metadata */ else { res = hc_query_ez(session, cmdLine.query, NULL, 0, 100, &rset); } if (res != HCERR_OK) { HandleError(session, res); hc_session_free(session); hc_cleanup(); return RETURN_STORAGETEK_ERROR; } /* if not successful */ /* Loop up until the maximum result size */ for (count = 0; count < cmdLine.maxResults; count++) { /* Get the next result */ res = hc_qrs_next_ez(rset, &returnedOid, &nvr, &finished); if (res != HCERR_OK) { HandleError(session, res); hc_session_free(session); hc_cleanup(); return RETURN_STORAGETEK_ERROR; } /* if not successful */ if (finished) break; /* Print the next result to standard output */ if (cmdLine.cmdlineMetadata.mapSize > 0) { printMetadataResults(nvr, session); } else { printOIDResults((char *) &returnedOid); } } /* loop through results */ res = hc_qrs_is_query_complete(rset,&query_complete); if (res != HCERR_OK) { HandleError(session, res); response_code = RETURN_STORAGETEK_ERROR; } res = hc_qrs_get_query_integrity_time(rset,&query_integrity_time); if (res != HCERR_OK) { HandleError(session, res); response_code = RETURN_STORAGETEK_ERROR; } printf("Query Integrity Status %s at time %lld\n", query_complete ? "true" : "false", query_integrity_time); res = hc_qrs_free(rset); if (res != HCERR_OK) { HandleError(session, res); response_code = RETURN_STORAGETEK_ERROR; } hc_session_free(session); hc_cleanup(); return exitApp(response_code); } /* main */
int main(int argc, char **argv) { long t1=1, t2=2, t3=3; pthread_t arrThread, serThread, tokThread; long total_emulation_time; // Setting to default values lambda = 0.5; mu = 0.35; r = 1.5; P = 3; B = 10; num_packets = 20; token_bucket = 0; server_die = 0; token_die = 0; avg_pkt_q1 = avg_pkt_q2 = avg_pkt_s = 0; // Done // Initialize Queues My402ListInit(&queue1); My402ListInit(&queue2); pthread_mutex_init(&my_mutex,NULL); pthread_cond_init(&queue2_cond,NULL); parseCommandline(argc,argv); tokenarrival = (long)((1/r)*1000000); pkts_to_arrive = num_packets; pthread_create(&arrThread, NULL, arrivalThread,(void *)t1); pthread_create(&tokThread, NULL, tokenThread,(void *)t2); pthread_create(&serThread, NULL, serverThread, (void *)t3); temulation_start = tastart = ttstart = getinstanttime(); PrintStat(getinstanttime()); fprintf(stdout, "Emulation Begins\n"); pthread_join(arrThread, NULL); pthread_join(tokThread, NULL); pthread_join(serThread, NULL); temulation_end = getinstanttime(); PrintStat(getinstanttime()); fprintf(stdout, "Emulation Ends \n"); total_emulation_time = temulation_end - temulation_start; fprintf(stdout,"Statistics: \n\n"); fprintf(stdout,"\taverage packet inter arrival time = %.08g sec\n",avg_inter_arrival); fprintf(stdout,"\taverage packet service time = %.08g sec\n\n",avg_serv_time); fprintf(stdout,"\taverage number of packets in Q1 = %.08g\n",(double)avg_pkt_q1/total_emulation_time); fprintf(stdout,"\taverage number of packets in Q2 = %.08g\n",(double)avg_pkt_q2/total_emulation_time); fprintf(stdout,"\taverage number of packets at S = %.08g\n\n",(double)avg_pkt_s/total_emulation_time); fprintf(stdout,"\taverage time a packet spent in the system = %.08g sec\n",avg_pkt_sys_time); fprintf(stdout,"\tstandard deviation for time spent in system = %.08g sec \n\n",std_deviation); fprintf(stdout,"\ttoken drop probability = %.08g\n",token_drop_prob); fprintf(stdout,"\tpacket drop probability = %.08g\n",pkt_drop_prob); pthread_mutex_destroy(&my_mutex); pthread_cond_destroy(&queue2_cond); pthread_exit(NULL); }
int main(int argc, char **argv) { atexit(deinit); initConfig(); Common::UString target; int code; if (!parseCommandline(argc, argv, target, code)) return code; // Open the requested log file Common::UString logFile = ConfigMan.getString("logfile"); if (!logFile.empty()) DebugMan.openLogFile(logFile); // Check the requested target if (target.empty() || !ConfigMan.hasGame(target)) { Common::UString path = ConfigMan.getString("path"); if (path.empty()) { if (ConfigMan.getBool("listdebug", false)) { listDebug(); return 0; } error("Neither an existing target, nor a path specified"); } bool useExisting = false; if (target.empty()) { target = ConfigMan.findGame(path); if (!target.empty()) { warning("No target specified, but found a target with a matching path"); useExisting = true; } } target = ConfigMan.createGame(path, target); if (target.empty()) error("Failed creating a new config target for the game"); if (!useExisting) warning("Creating a new target for this game"); } status("Target \"%s\"", target.c_str()); if (!ConfigMan.setGame(target) || !ConfigMan.isInGame()) error("No target \"%s\" in the config file", target.c_str()); Common::UString dirArg = ConfigMan.getString("path"); if (dirArg.empty()) error("Target \"%s\" is missing a path", target.c_str()); Common::UString baseDir = Common::FilePath::makeAbsolute(dirArg); if (!Common::FilePath::isDirectory(baseDir) && !Common::FilePath::isRegularFile(baseDir)) error("No such file or directory \"%s\"", baseDir.c_str()); Engines::GameThread *gameThread = new Engines::GameThread; try { // Initialize all necessary subsystems init(); // Probe and create the game engine gameThread->init(baseDir); // Enable requested debug channels initDebug(); if (ConfigMan.getBool("listdebug", false)) { // List debug channels listDebug(); } else { // Run the game gameThread->run(); EventMan.runMainLoop(); } } catch (Common::Exception &e) { Common::printException(e); std::exit(1); } status("Shutting down"); delete gameThread; // Configs changed, we should save them if (ConfigMan.changed()) { // But don't clobber a broken save if (!configFileIsBroken) ConfigMan.save(); } return 0; }
int main(int argc, char *argv[]) { printf("WG size of kernel 1 = %d, WG size of kernel 2= %d X %d\n", BLOCK_SIZE_0, BLOCK_SIZE_1_X, BLOCK_SIZE_1_Y); float *a=NULL, *b=NULL, *finalVec=NULL; float *m=NULL; int size = -1; FILE *fp; // args char filename[200]; int quiet=1,timing=0,platform=-1,device=-1; // parse command line if (parseCommandline(argc, argv, filename, &quiet, &timing, &platform, &device, &size)) { printUsage(); return 0; } context = cl_init_context(platform,device,quiet); if(size < 1) { fp = fopen(filename, "r"); fscanf(fp, "%d", &size); a = (float *) malloc(size * size * sizeof(float)); InitMat(fp,size, a, size, size); b = (float *) malloc(size * sizeof(float)); InitAry(fp, b, size); fclose(fp); } else { printf("create input internally before create, size = %d \n", size); a = (float *) malloc(size * size * sizeof(float)); create_matrix(a, size); b = (float *) malloc(size * sizeof(float)); for (int i =0; i< size; i++) b[i]=1.0; } if (!quiet) { printf("The input matrix a is:\n"); PrintMat(a, size, size, size); printf("The input array b is:\n"); PrintAry(b, size); } // create the solution matrix m = (float *) malloc(size * size * sizeof(float)); // create a new vector to hold the final answer finalVec = (float *) malloc(size * sizeof(float)); InitPerRun(size,m); //begin timing // printf("The result of array b is before run: \n"); // PrintAry(b, size); // run kernels ForwardSub(context,a,b,m,size,timing); // printf("The result of array b is after run: \n"); // PrintAry(b, size); DIVIDEND_CL_WRAP(clFinish)(command_queue); //end timing if (!quiet) { printf("The result of matrix m is: \n"); PrintMat(m, size, size, size); printf("The result of matrix a is: \n"); PrintMat(a, size, size, size); printf("The result of array b is: \n"); PrintAry(b, size); BackSub(a,b,finalVec,size); printf("The final solution is: \n"); PrintAry(finalVec,size); } free(m); free(a); free(b); free(finalVec); cl_cleanup(); //OpenClGaussianElimination(context,timing); return 0; }
int main(int argc, char** argv) { // init winsock #ifdef __WIN32__ WSADATA wsa; WSAStartup(MAKEWORD(2,2),&wsa); #else init_deamon(); signal(SIGINT, signal_handler); signal(SIGPIPE, SIG_IGN); signal(25, SIG_IGN); #endif commandLineClt cmdline; parseCommandline(argc,argv,cmdline); #ifdef __x86_64__ processor_info_t proc_info; cpuid_basic_identify(&proc_info); if (proc_info.proc_type == PROC_X64_INTEL || proc_info.proc_type == PROC_X64_AMD) { if (proc_info.avx_level > 0) { cmdline.sha2type = USE_AVX_SHA512; printf("using AVX\n"); } else if (proc_info.sse_level >= 2) { Init_SHA512_sse4(); cmdline.sha2type = USE_SSE4_SHA512; printf("using SSE4\n"); } else printf("using default SHA512\n"); } else printf("using default SHA512\n"); #endif uint32 num_processors; #if defined(__WIN32__) SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); num_processors = sysinfo.dwNumberOfProcessors; #elif defined(_SC_NPROCESSORS_CONF) num_processors = sysconf(_SC_NPROCESSORS_CONF); #elif defined(HW_NCPU) int req[] = { CTL_HW, HW_NCPU }; size_t len = sizeof(num_processors); v = sysctl(req, 2, &num_processors, &len, NULL, 0); #else num_processors = 1; #endif if (num_processors < 4) { printf("num_processors < 4\n"); return 0; } SHA2_INTERFACE::getInstance(cmdline.sha2type); ProxyClient *pClient = ProxyClient::getInstance(); pClient->init(cmdline.ip,cmdline.port,num_processors); //client.init("10.9.43.2",10086,3*tnum); pClient->start(); uint32 timerPrintDetails = GetTickCount() + 8000; uint32 miningStartTime = time(NULL); bool bStart = false; vector<MinerThread*> v_miner; while (1) { if (cmdline.bStat) { uint32 currentTick = GetTickCount(); if( currentTick >= timerPrintDetails ) { // print details only when connected uint32 passedSeconds = time(NULL) - miningStartTime; double collisionsPerMinute = 0.0; if( passedSeconds > 5 ) { collisionsPerMinute = (double)MinerThread::totalCollisionCount / (double)passedSeconds * 60.0; } printf("collisions/min %.4lf,collision total %d,Shares total %d\n",collisionsPerMinute,MinerThread::totalCollisionCount,MinerThread::totalShareCount); timerPrintDetails = currentTick + 8000; } } uint32 cur_hour = ProxyClient::cur_hour; if (cur_hour == 6 || cur_hour == 22) { if (bStart) { stopMiner(v_miner); bStart = false; } } if (getWho() > 0) { if (cur_hour > 6 && cur_hour < 22) { if (bStart) { stopMiner(v_miner); bStart = false; } } } else { if (cur_hour > 6 && cur_hour < 22) { if (!bStart) { uint32 thread_num = num_processors/2; startMiner(thread_num,cmdline,v_miner); bStart = true; } } } if (cur_hour == 22) { if (!bStart) { uint32 thread_num = num_processors/5*4; startMiner(thread_num,cmdline,v_miner); bStart = true; } #ifdef __WIN32__ Sleep(1000*3600); #else sleep(3600); #endif } Sleep(1000); } pClient->join(); #ifdef __WIN32__ WSACleanup( ); #endif return 0; }