这篇教程C++ uptime函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uptime函数的典型用法代码示例。如果您正苦于以下问题:C++ uptime函数的具体用法?C++ uptime怎么用?C++ uptime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uptime函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SearchClientCachestruct client_cache_s *SearchClientCache(struct in_addr addr, int quiet){ int i; for (i = 0; i < CLIENT_CACHE_SLOTS; i++) { if (clients[i].addr.s_addr == addr.s_addr) { /* Invalidate this client cache if it's older than 1 hour */ if ((uptime() - clients[i].age) > 3600) { unsigned char mac[6]; if (get_remote_mac(addr, mac) == 0 && memcmp(mac, clients[i].mac, 6) == 0) { /* Same MAC as last time when we were able to identify the client, * so extend the timeout by another hour. */ clients[i].age = uptime(); } else { memset(&clients[i], 0, sizeof(struct client_cache_s)); return NULL; } } if (!quiet) DPRINTF(E_DEBUG, L_HTTP, "Client found in cache. [%s/entry %d]/n", clients[i].type->name, i); return &clients[i]; } } return NULL;}
开发者ID:chazikai24,项目名称:asuswrt,代码行数:35,
示例2: mainintmain(int argc, char *argv[]){ if (argc < 3) { printf(1, "Usage: usage ticks tickets1 [tickets2].../n/n"); printf(1, "Spawns subprocesses, each of which will run for /n" "approximately the given number of ticks. For each ticket/n" "ammount given, a child process will spawn and request that/n" "number of tickets./n"); exit(); } int total = 0; int i; for (i = 0; i < argc - 2; i++) { total += atoi(argv[i+2]); } int ret = settickets(total); if (ret < 0) { printf(1, "settickets failed/n"); exit(); } // pids of children int pids[NPROC]; // spawn children for (i = 0; i < argc - 2; i++) { pids[i] = fork(); if (pids[i] == 0) { int ret = settickets(atoi(argv[i + 2])); if (ret < 0) { printf(1, "settickets failed/n"); exit(); } // spin so we get scheduled while(1) { spin(); } } } // print usage info int ticks = atoi(argv[1]); int start = uptime(); while(uptime() < start + ticks) { sleep(100); printf(1, "time: %d/n", uptime() - start); printinfo(); } // kill children for (i = 0; i < argc - 2; i++) { kill(pids[i]); wait(); } exit();}
开发者ID:vener91,项目名称:cs537,代码行数:60,
示例3: mainintmain(int argc, char *argv[]){ int st = uptime(), k = 0, i = 0; char * buf = malloc(BUFLEN); for (k = 0; k < NFILE; k++) { printf(1, "[%d%%] file %d/n", (int)((float)k / NFILE * 100), k); char path[] = "lfstest0"; path[7] += k; int fd = open(path, O_CREATE | O_RDWR); for (i = 0; i < (20000 / BUFLEN); i++) if (write(fd, buf, BUFLEN) != BUFLEN) { printf(1, "fail"); exit(); } close(fd); } int en = uptime(); printf(1, "time: %d/n", en - st); exit();}
开发者ID:jamorton,项目名称:xv6-lfs,代码行数:25,
示例4: mainint main(int argc, char *argv[]){ int time_init; int time_end; int time_total; int time_avg; int x = 5; int y = 0; time_init = uptime(); signal(SIGFPE, handle_signal); x = x / y; time_end = uptime(); time_total = time_end - time_init; //this is in mticks, where one tick is 10^-6 mticks. time_avg = time_total*10; printf(1, "Traps Performed: %d/n", 100000); printf(1, "Total Elapsed Time: %d/n", time_total); printf(1, "Average Time Per Trap: %d/n", time_avg); exit();}
开发者ID:briansrls,项目名称:xv6,代码行数:25,
示例5: run_rpm// 16MHz clock with 256 prescale = 16uS per count// max period = 16uS * 65535 = 1.05S = 10rpm// min period (assume < 1% error) = 16uS * 100 = 1.6mS = 625Hz = 6250rpm but limited to 1000// cutin for 3m turbine ~= 150rpm (15Hz); expect count ~= 4200voidrun_rpm (void){ uint16_t value; static uint32_t lastmin = 0; if (gPeriod) { // using the number of magnet pole pairs on the rotor // we count at a rate of 16MHz / 256 = 16uS per count // rpm = freq * 60 / numpoles // freq = 10e6/period(uS) // rpm = 1000000/period * 16 * 60 / numpoles value = (1000000L / 16) * (60 / gPoles) / gPeriod; // note order to prevent overflow if (value < 1000) median_add (&RpmMedian, value); median_getAverage (&RpmMedian, &gRPM); } else gRPM = 0; // see if a minute has passed, if so advance the pointer to track the last hour if (uptime() >= lastmin + 60) { lastmin = uptime(); minmax_add(&RpmHourMax); } gMaxRPM = minmax_get(&RpmHourMax, gRPM);}
开发者ID:g8ecj,项目名称:turbine,代码行数:38,
示例6: query_rusage_messagestring query_rusage_message(){ mapping networkstats = network_stats(); return sprintf("已接收 %d 封包(%.2f/sec),已传送 %d 封包(%.2f/sec)", networkstats["incoming packets total"], to_float(networkstats["incoming packets total"])/uptime(), networkstats["outgoing packets total"], to_float(networkstats["outgoing packets total"])/uptime());}
开发者ID:mudchina,项目名称:nitan3,代码行数:9,
示例7: do_infostring do_info(string args) { mapping r; float cpu; string mach, vers, name, up, memory, listing; int obs, i; mixed *info, *services; if(args && args != ""){ args = I3_D->query_network_name(args); if(!args){ return("Could not obtain information about that MUD/n"); } info = I3_D->query_mud(args); services = keys(info[10]); listing = ""; for(i=0;i<sizeof(services);i++) listing += services[i]+", "; listing += "/n"; return ( "" + pad( "MUD NAME: " + args, PAD ) + "MUDLIB: " + info[5] + "/n" + pad( "ADDRESS: " + info[1] + " " + info[2], PAD ) + "DRIVER: " + info[7] + "/n" + pad("MUD TYPE: " + info[8], PAD ) + "CPU USE: " + "Unknown" + " %/n" + pad("CURRENT USERS: " + "Unknown", PAD ) + "MEMORY: " + "Unknown" + "/n" + pad("MUD STATUS: " + info[9], PAD ) + "OBJECTS: " + "Unknown/n" + pad("SERVICES: " + listing, PAD) + "" ); } r = rusage(); obs = sizeof( objects() ); mach = arch(); name = capitalize( mud_name() ); vers = version(); cpu = SCALE * (r["utime"] + r["stime"]) / uptime(); memory = (string) CMD_MEM -> parse_mem( memory_info() ); up = format_time( uptime() ); return ( "" + pad( "MUD NAME: " + name, PAD ) + "MUDLIB: " + MUDLIB_NAME + " (" + MUDLIB_VERSION_NUMBER + ")/n" + pad( "ARCHITECTURE: " + mach, PAD ) + "DRIVER: " + vers + "/n" + pad("DRIVER UPTIME: " + up, PAD ) + "CPU USE: " + cpu + " %/n" + pad("CURRENT USERS: " + sizeof( users() ), PAD ) + "MEMORY: " + memory + "/n" + pad("MUD STATUS: " + STATUS, PAD ) + "OBJECTS: " + obs + " loaded./n" + "" );}
开发者ID:Hobbitron,项目名称:tmi2_fluffos_v3,代码行数:55,
示例8: createvoid create() { mapping r; return; memory = memory_info() / 1000; users = sizeof(users());// rusage() not available everywhere. If you really// really need it, figure it out.#if 0 r = rusage();#endif cpu = (r["utime"] + r["stime"]) / ( uptime() + 1 ) / 10.0; obs = sizeof(objects()); pastobs = allocate(TRACK_NUM); pastusers = allocate(TRACK_NUM); pastmem = allocate(TRACK_NUM); pastcpu = allocate(TRACK_NUM); pastmem[counter] = memory; pastusers[counter] = users; pastobs[counter] = obs; pastcpu[counter] = cpu; lastmem = 0; lastusers = 0; lastcpu = 0.0; lastobs = 0; counter = 0; times = 0.0; call_out("sample", CALL_TIME);}
开发者ID:Hobbitron,项目名称:tmi2_fluffos_v3,代码行数:35,
示例9: mainint main(object me) { float value; mapping r; if (time() - me->query_temp("scan_time") < 10 && ! wizardp(me)) return notify_fail("等等,系统喘气中……/n"); r = rusage(); value = SCALE * (r["utime"] + r["stime"]) / uptime(); write(NOR + WHT "/n/t/t .__________ 系 统 资 讯 __________./n"); write(NOR + WHT "/t/t ─────────────────────────/n"); write(NOR + WHT "/t/t 游戏的识别名称: " + MUD_NAME + "/n"); write(NOR + WHT "/t/t 界面系统的版本: " + __VERSION__ + "/n"); write(NOR + WHT "/t/t 系统函数库版本: Nitan Mudlib Version 2.1/n"); printf(NOR + WHT "/t/t CPU 使用百分比: %f %% 被这个游戏使用中/n", value ); write(NOR + WHT "/t/t CPU 的负担状况: " + query_load_average() + "/n"); printf(NOR + WHT "/t/t 共使用的记忆体: %s bytes/n", memory_expression(memory_info()) ); write(NOR + WHT "/t/t 线上使用者总数: " + sizeof( users() ) + " 个人在线上/n"); write(NOR + WHT "/t/t 注册使用者总数: " + count_ppls() + " 个人在本游戏注册/n"); write(NOR + WHT "/t/t 载入的物件总数: " + sizeof( objects() ) + " 个物件/n"); write(NOR + WHT "/t/t 心跳总数的资讯: " + sizeof(heart_beats()) + " 个/n"); write(NOR + WHT "/t/t 延迟呼叫数资讯: " + sizeof(call_out_info()) + " 个/n"); write(NOR + WHT "/t/t 系统负载的资讯: " + query_load_average() + "/n"); write(NOR + WHT "/t/t 讯息传输的资讯: " + query_rusage_message() + "/n"); write(NOR + WHT "/t/t 连续执行的时间: " + dotime() + "/n"); write(NOR + WHT "/t/t 游戏现在的状态: " + STATUS + "/n" NOR); write(NOR + WHT "/t/t 游戏对 PK 限制: 每天不超过 8 人,每人不超过 2 次/n/n" NOR); me->set_temp("scan_time", time()); return 1;}
开发者ID:mudchina,项目名称:nitan3,代码行数:35,
示例10: main//THIS METHOD USES CMWC Algorithmintmain(void){ //Testing time randomization int t = uptime(); printf(0,"Clks since boot: %d/n",t); //test random number //Using Complementary-Multiply-with-carry method init(33256246); //RUN TESTING TO SEE HOW RANDOMIZED IT IS uint a = rand(); printf(0,"random number: %d/n",a); int j; int RUNTIME = 80000; int results[100]; for(j=0;j<RUNTIME;j++) { int rnd = rand() % 100; results[rnd] = results[rnd] + 1; } int k; printf(0,"Results after %d runs:/n",RUNTIME); for(k=0;k<100;k++) { printf(0,"%d - %d, ",k,results[k]); if ((k%10)==9) printf(0,"/n"); } int avg,i; avg = 0; for(i=0;i<100;i++) avg += results[i]; avg = avg / 100; printf(0,"/nAverage: %d",avg); exit();}
开发者ID:vennard,项目名称:BaconEggs,代码行数:34,
示例11: mainint main(int argc, char *argv[]){ unsigned int d; in_port_t server_port = 21U;#ifdef HAVE_SETLOCALE# ifdef LC_MESSAGES (void) setlocale(LC_MESSAGES, "");# endif# ifdef LC_CTYPE (void) setlocale(LC_CTYPE, "");# endif# ifdef LC_COLLATE (void) setlocale(LC_COLLATE, "");# endif#endif if (argc == 2) { server_port = (in_port_t) strtoul(argv[1], NULL, 10); } d = daemons(server_port); printf("%u/n%u/n%s/n%s/n", d, d, uptime(), name()); return 0;}
开发者ID:Shmuma,项目名称:pureftpd-o_direct,代码行数:25,
示例12: set_keepalive_messagestatic voidset_keepalive_message(){ /* uptime() is an efun that returns # of seconds the driver has been up */ keepalive_message = header("M") + TAB + mudname + TAB + (time() - uptime()) + TAB + GENERATION + TAB + comments;}
开发者ID:nfarrar,项目名称:mudfiles,代码行数:7,
示例13: check_locks_timeout/********************************************************************* FUNCTION check_locks_timeout* * Check if the locks_timeout is active and if it expired yet** INPUTS:* server_cb == server control block to use** RETURNS:* TRUE if locks_timeout expired* FALSE if no timeout has occurred*********************************************************************/boolean check_locks_timeout (server_cb_t *server_cb){ time_t timenow; double timediff;#ifdef DEBUG if (!server_cb) { SET_ERROR(ERR_INTERNAL_PTR); return FALSE; }#endif if (server_cb->locks_timeout) { /* check if there is an overall timeout yet */ (void)uptime(&timenow); timediff = difftime(timenow, server_cb->locks_start_time); if (timediff >= (double)server_cb->locks_timeout) { log_debug("/nlock timeout"); return TRUE; } } return FALSE;} /* check_locks_timeout */
开发者ID:0xDEC0DE8,项目名称:OpenYuma,代码行数:38,
示例14: mainint main(int argc, char **argv){ printf("%s%c%c/n","Content-Type:text/html;charset=iso-8859-1",13,10); printf("<TITLE>Estado de la AWS</TITLE>/n"); printf("<u><H2>ESTADO DE LA AWS /n</H2></u>"); printf("<hr>"); CPU(); printf("<div></div>"); cputimes(); printf("<div></div>"); memmory(); printf("<div></div>"); fecha(); printf("<div></div>"); bootTime(); printf("<div></div>"); uptime(); printf("<div></div>"); load(); printf("<div> </div>"); printf("<hr>"); printf("<a href='javascript:self.close()'>Cerrar</a>"); return 0;}
开发者ID:arielvinas,项目名称:SistemasOperativos2,代码行数:25,
示例15: read_leasesvoid read_leases(char *file){ FILE *fp; unsigned int i = 0; struct dhcpOfferedAddr lease; if (!(fp = fopen(file, "r"))) { LOG(LOG_ERR, "Unable to open %s for reading", file); return; } while (i < server_config.max_leases && (fread(&lease, sizeof lease, 1, fp) == 1)) { /* ADDME: is it a static lease */ if (lease.yiaddr >= server_config.start && lease.yiaddr <= server_config.end) { lease.expires = ntohl(lease.expires); if (!server_config.remaining) lease.expires -= uptime(); if (!(add_lease(lease.chaddr, lease.yiaddr, lease.expires))) { LOG(LOG_WARNING, "Too many leases while loading %s/n", file); break; } i++; } } DEBUG(LOG_INFO, "Read %d leases", i); fclose(fp);}
开发者ID:h0tw1r3,项目名称:asuswrt-merlin,代码行数:26,
示例16: settimegint settime(gpointer data){ char lt[100],lm[100],ltip[200],cr[10],ct[10],crs[10],cts[10],hms[10],cmu[10],cmt[10],cpusage[20]; int rs,ts,memusage=0; uptime(hms); cpustat(cpusage); meminfo(); mu=mt-mf; memusage=mu*100/mt; strcpy(cmt,B2G(mt*1024)); strcpy(cmu,B2G(mu*1024)); netdev(); strcpy(cr,B2G(r1)); strcpy(ct,B2G(t1)); rs=r1-r0; ts=t1-t0; strcpy(crs,B2G(rs)); strcpy(cts,B2G(ts)); sprintf(lt,"D:%s/s/nU:%s/s",crs,cts); sprintf(lm,"<span foreground='white'>D:%s/s/nU:%s/s</span>",crs,cts); sprintf(ltip,"开机: %s/nCPU: %s/n内存: %s/%s=%d%%/n下载: %s , %s/s/n上传: %s , %s/s",hms,cpusage,cmu,cmt,memusage,cr,crs,ct,cts); g_message(lt); //gtk_label_set_text(GTK_LABEL(label),lt); gtk_label_set_markup(GTK_LABEL(label), lm); gtk_tooltips_set_tip(tooltips,label,ltip,NULL); r0=r1; t0=t1; return TRUE;}
开发者ID:sonichy,项目名称:CMDU-Applet,代码行数:29,
示例17: inet_handlerstatic voidinet_handler(int is_ap_mode){ if (!is_ap_mode) { long i_deferred_wanup = nvram_get_int("deferred_wanup_t"); if (i_deferred_wanup > 0 && uptime() >= i_deferred_wanup) { notify_rc("deferred_wan_connect"); return; } if (has_wan_ip4(0) && has_wan_gw4()) { /* sync time to ntp server if necessary */ ntpc_handler(); } } else { if (has_lan_ip4() && has_lan_gw4()) ntpc_handler(); }}
开发者ID:jing-git,项目名称:rt-n56u,代码行数:25,
示例18: wpsfix_checkstatic void wpsfix_check(int sig){ int unit; time_t now = uptime(); if (nvram_match("wps_band", "0")) unit = 0; else unit = 1; if (((now - up) >= 600) && !wl_WscConfigured(unit)) { stop_wsc(); nvram_set("wps_sta_pin", "00000000"); nvram_set("wps_enable", "0"); nvram_set("wl_wps_mode", "disabled"); nvram_set("wl0_wps_mode", "disabled"); nvram_set("wl1_wps_mode", "disabled"); wpsfix_exit(sig); } else alarmtimer(60, 0);}
开发者ID:h0tw1r3,项目名称:asuswrt-merlin,代码行数:25,
示例19: uptimevoid CMonitorService::WatchSystem(){ time_t now; now = uptime(); if ((now-m_tmLastCheck) < 60) {// XDEBUG(ANSI_COLOR_GREEN " #######################################debug sungyeung this is not check time yet : %s : %d /n" ANSI_NORMAL, __FILE__, __LINE__); return; } if (!CheckMemory()) { UpdateLogFile(LOG_DIR, EVENT_LOG_FILE, 0, TRUE, "SYSMON::MEMORY FULL/xd/xa"); RebootSystem(); } if (!CheckFlash()) { XDEBUG(ANSI_COLOR_RED " #######################################debug sungyeung WatchSystem().!CheckFlash() : %s : %d /n", __FILE__, __LINE__); ReduceFileSystem(); UpdateLogFile(LOG_DIR, EVENT_LOG_FILE, 0, TRUE, "SYSMON::FLASH FULL/xd/xa"); RebootSystem(); } if (!CheckLauncher()) { UpdateLogFile(LOG_DIR, EVENT_LOG_FILE, 0, TRUE, "SYSMON::LAUNCHER FAIL/xd/xa"); RebootSystem(); } if (!CheckAgent()) { UpdateLogFile(LOG_DIR, EVENT_LOG_FILE, 0, TRUE, "SYSMON::AGENT FAIL/xd/xa"); RebootSystem(); } if (!CheckTelnet()) { UpdateLogFile(LOG_DIR, EVENT_LOG_FILE, 0, TRUE, "SYSMON::TELNET FAIL/xd/xa"); KillTelnet(); } m_tmLastCheck = uptime();}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:45,
示例20: sfs_readstatic size_t sfs_read(void* dest, size_t size, size_t offset, void* meta) { if(offset) { return 0; } size_t rsize = 0; sysfs_printf("%d %d %d", uptime(), tick, rate); return rsize;}
开发者ID:lutoma,项目名称:xelix,代码行数:9,
示例21: process_age/* process age from jiffies to seconds via uptime */static double process_age(const unsigned long long jf){ double age; double sc_clk_tck = sysconf(_SC_CLK_TCK); assert(sc_clk_tck > 0); age = uptime() - jf / sc_clk_tck; if (age < 0L) return 0L; return age;}
开发者ID:Aspekta,项目名称:psmisc,代码行数:11,
示例22: randuint rand(void) { static uint i = 4095; uint t; i = (i+1) & 4095; //seed is uptime clock ticks since boot t = (uptime() * x[i]) + b; b = t >> 16; x[i] = 0xfffffffe - t; return x[i];}
开发者ID:vennard,项目名称:BaconEggs,代码行数:10,
示例23: mainint main(int argc, char **argv){ struct timeval stvTimeout; char *tp = "udp"; char *host; char opt; host = getenv("BAYONNE_HOST"); if(!host) host = "localhost"; stvTimeout.tv_sec = 23; stvTimeout.tv_usec = 0; while((opt = getopt(argc, argv, "t:h:p:")) != -1) switch(opt) { case 't': stvTimeout.tv_sec = atoi(optarg); break; case 'h': host = optarg; break; case 'p': tp = optarg; break; default: goto use; } rpc = clnt_create(host, BAYONNE_PROGRAM, BAYONNE_VERSION, tp); if (!rpc) { printf( "CLNT_CREATE %s/n", clnt_spcreateerror( "" ) ); exit( 1 ); } if(!clnt_control(rpc, CLSET_TIMEOUT,( char *) &stvTimeout ) ) { printf( "CLNT_CONTROL: %s/n",clnt_sperror(rpc, "" ) ); clnt_destroy(rpc); exit( 1 ); } if(optind >= argc) uptime();use: fprintf(stderr, "use: bts_uptime [-h host] [-p proto] [-t timeout]/n"); exit(-1);}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:54,
示例24: timechar *sprint_uptime(void) { struct utmp *utmpstruct; int upminutes, uphours, updays; int pos; struct tm *realtime; time_t realseconds; int numuser; double uptime_secs, idle_secs;/* first get the current time */ time(&realseconds); realtime = localtime(&realseconds); pos = sprintf(buf, " %02d:%02d:%02d ", realtime->tm_hour, realtime->tm_min, realtime->tm_sec);/* read and calculate the amount of uptime */ uptime(&uptime_secs, &idle_secs); updays = (int) uptime_secs / (60*60*24); strcat (buf, "up "); pos += 3; if (updays) pos += sprintf(buf + pos, "%d day%s, ", updays, (updays != 1) ? "s" : ""); upminutes = (int) uptime_secs / 60; uphours = upminutes / 60; uphours = uphours % 24; upminutes = upminutes % 60; if (uphours) pos += sprintf(buf + pos, "%2d:%02d, ", uphours, upminutes); else pos += sprintf(buf + pos, "%d min, ", upminutes);/* count the number of users */ numuser = 0; setutent(); while ((utmpstruct = getutent())) { if ((utmpstruct->ut_type == USER_PROCESS) && (utmpstruct->ut_name[0] != '/0')) numuser++; } endutent(); pos += sprintf(buf + pos, "%2d user%s, ", numuser, numuser == 1 ? "" : "s"); loadavg(&av[0], &av[1], &av[2]); pos += sprintf(buf + pos, " load average: %.2f, %.2f, %.2f", av[0], av[1], av[2]); return buf;}
开发者ID:andreimironenko,项目名称:ltp-full,代码行数:54,
示例25: idletime/**** stat the device file to get an idle time */static time_t idletime(utmp_t *u, char *tty) { struct stat terminfo; time_t idle_secs; double uptime_secs; if (stat(tty, &terminfo) != 0) return 0; idle_secs = time(NULL) - terminfo.st_atime; uptime (&uptime_secs, NULL); if ((time_t) uptime_secs < idle_secs) idle_secs = (time_t) uptime_secs; return idle_secs;}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:13,
示例26: testcommandHandler::commandHandler(thread_data * my_data){ std::unique_ptr <command> test(new commandTEST("test") ); commandMap.insert( std::make_pair(test->getCommandName(),std::move( test )) ); std::unique_ptr <command> exit(new commandEXIT("exit")); commandMap.insert( std::make_pair(exit->getCommandName(),std::move( exit )) ); std::unique_ptr <command> MPD(new command_mpd("MPD")); commandMap.insert(std::make_pair(MPD->getCommandName(), std::move (MPD))); std::unique_ptr <command> RS232 (new commandRS232("RS232")); commandMap.insert(std::make_pair(RS232->getCommandName(), std::move(RS232))); std::unique_ptr <command> uptime (new command_UPTIME("uptime")); commandMap.insert(std::make_pair(uptime->getCommandName(), std::move(uptime))); std::unique_ptr <command> big (new command_big("big")); commandMap.insert(std::make_pair(big->getCommandName(), std::move(big))); std::unique_ptr <command> clock (new command_clock("clock")); commandMap.insert(std::make_pair(clock->getCommandName(), std::move(clock))); std::unique_ptr <command> cmd (new command_cmd("cmd")); commandMap.insert(std::make_pair(cmd->getCommandName(), std::move(cmd))); std::unique_ptr <command> hello (new command_hello("hello")); commandMap.insert(std::make_pair(hello->getCommandName(), std::move(hello))); std::unique_ptr <command> help (new command_help("help")); commandMap.insert(std::make_pair(help->getCommandName(), std::move(help))); std::unique_ptr <command> ip (new command_ip("ip")); commandMap.insert(std::make_pair(ip->getCommandName(), std::move(ip))); std::unique_ptr <command> ok (new command_ok("ok")); commandMap.insert(std::make_pair(ok->getCommandName(), std::move(ok))); std::unique_ptr <command> show (new command_show("show")); commandMap.insert(std::make_pair(show->getCommandName(), std::move(show))); std::unique_ptr <command> sleep (new command_sleep("sleep")); commandMap.insert(std::make_pair(sleep->getCommandName(), std::move(sleep))); std::unique_ptr <command> put (new command_put("put")); commandMap.insert(std::make_pair(put->getCommandName(), std::move(put))); std::unique_ptr <command> event (new command_event("event")); commandMap.insert(std::make_pair(event->getCommandName(), std::move(event))); this->my_data = my_data; this->my_data->commandMapPtr = &commandMap; }
开发者ID:cyniu88,项目名称:malina,代码行数:53,
示例27: mainintmain(int argc, char *argv[]){ int pid = getpid(); float beta = 1.0f; init(); for (;;) { int start = uptime(); smm(beta); beta = -beta; int end = uptime(); long elapsed = (long) end - (long) start; long ops = 3 * N * N * N; printf(1, "%d %d FrutaFLOPS/n", pid, (int) (ops / elapsed)); } printf(1, "%f/n", c[0][0]); exit();}
开发者ID:MarcoCBA,项目名称:Proyectos,代码行数:21,
示例28: cmd_mudstatusint cmd_mudstatus() { int utime=uptime(), mem=memory_info(), i=0, ct=0; object *o; if(!archp(this_player())) return 0; write("%^BLUE%^+=+=+=+( %^BOLD%^%^WHITE%^Mud Status%^RESET%^%^BLUE%^ )+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=%^RESET%^"); write(" The mud has been online for "+query_time(uptime())+""); write(" The mud will reboot in "+query_time((EVENTS_D->query_next_reboot())-time())+""); write(" Number of Objects Loaded: "+i=sizeof(o=objects())); write(" "+add_commas(mem)+" bytes of memory is loaded."); while(i--) if(query_heart_beat(o[i])) ct++; write(" Number of objects with heartbeats: "+ct+"."); write(" Number of callouts: "+sizeof(call_out_info())+"."); write(" Processing "+query_load_average()+"."); if(find_object("/d/nopk/standard/freezer")) write(" Number of link-dead players: "+ sizeof( all_inventory( find_object( "/d/nopk/standard/freezer" ) ) ) ); write(" Number of players online: "+(string)sizeof(users())); write("%^BLUE%^+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+%^RESET%^/n"); return 1;}
开发者ID:ehershey,项目名称:pd,代码行数:22,
注:本文中的uptime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ urand函数代码示例 C++ upslogx函数代码示例 |