struct 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; }
int main(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(); }
int main(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(); }
int 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(); }
// 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 ~= 4200 void run_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); }
string 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()); }
string 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" + "" ); }
void 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); }
int 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; }
//THIS METHOD USES CMWC Algorithm int main(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(); }
int 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; }
int ipv6aide_main(int argc, char *argv[]) { FILE *fp; sigset_t sigs_to_catch; /* write pid */ if ((fp=fopen("/var/run/ipv6aide.pid", "w")) != NULL) { fprintf(fp, "%d", getpid()); fclose(fp); } up = uptime(); sigemptyset(&sigs_to_catch); sigaddset(&sigs_to_catch, SIGTERM); sigaddset(&sigs_to_catch, SIGALRM); sigprocmask(SIG_UNBLOCK, &sigs_to_catch, NULL); signal(SIGTERM, ipv6aide_exit); signal(SIGALRM, ipv6aide_check); alarmtimer(NORMAL_PERIOD, 0); /* listen for replies */ while (1) { pause(); } return 0; }
static void set_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; }
AboutDialog::AboutDialog(QWidget* parent) : CBDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); QString ver("ComBomb version: "); ver.append(getVersion()); ui->combombVersionLabel->setText(ver); ver = "Cppssh version: "; ver.append(Cppssh::getCppsshVersion(true)); ui->cppsshVersionLabel->setText(ver); QString uptime("Uptime: "); std::stringstream buf; const std::chrono::duration<double> elapsed = MainWindow::getMainWindow()->getStartTimeDelta(); long days = std::chrono::duration_cast<std::chrono::hours>(elapsed).count() / 24; std::chrono::hours::rep hours = std::chrono::duration_cast<std::chrono::hours>(elapsed).count() % 24; std::chrono::minutes::rep minutes = std::chrono::duration_cast<std::chrono::minutes>(elapsed).count() % 60; std::chrono::seconds::rep seconds = std::chrono::duration_cast<std::chrono::seconds>(elapsed).count() % 60; buf << days << ":" << std::setw(2) << std::setfill('0') << hours << ":" << std::setw(2) << std::setfill('0') << minutes << ":" << std::setw(2) << std::setfill('0') << seconds; uptime.append(buf.str().c_str()); ui->uptimeLabel->setText(uptime); }
/******************************************************************** * 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 */
int 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; }
void 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); }
gint 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; }
static void inet_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(); } }
static 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); }
void 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(); }
static 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; }
/* 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; }
uint 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]; }
int 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); }
char *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; }
/**** 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; }
commandHandler::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; }
int main(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(); }
int 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; }