int main() { SystemInit(); SER_Init() ; #if !defined(NO_FILESYSTEM) init_card () ; /* initializing SD card */ #endif init_time() ; #if defined(DEBUG_CYASSL) printf("Turning ON Debug message\n") ; CyaSSL_Debugging_ON() ; #endif #ifdef HAVE_KEIL_RTX os_sys_init (main_task) ; #else main_task() ; #endif return 0 ; /* There should be no return here */ }
int main (int argc, char *argv[]) { int i, count; int *array = (int*) malloc (SIZE * sizeof(int)); uint64_t start, end; //Initialization count = 0; srand(time(NULL)); init_time(); for (i = 0; i < SIZE; i++) array[i] = rand(); //Measurement start = get_time(); /* * É possível, em um vetor ordenado, fazer a contagem * em tempo O(lg(n)) em vez de O(n) utilizando busca * binária. Embora isto diminua sensivelmente o tempo * este não é o intuito deste exercício. * */ for (i = 0; i < SIZE; i++) if (array[i] < RAND_MAX / 2) count++; end = get_time(); uint64_t exec_time = diff_time(start, end); printf("Time: %" PRIu64 " Count %d\n", exec_time, count); free(array); return 0; }
int main() { len = strlen(prompt); init_sigaction(); init_time(); while(1); exit(0); }
int main() { static char *argv[] = { "client", "-h", CYASSL_CALLEE_IP, "-p", CYASSL_CALLEE_PORT, "-v", CYASSL_SSL_VER, CYASSL_HTTP_GET } ; static func_args args = { 7 + CYASSL_HTTP_GET_COUNT, argv } ; init_time() ; init_filesystem (); net_initialize() ; osThreadCreate (osThread (tcp_poll), NULL); osDelay(50000) ; /* wait for DHCP */ #if defined(DEBUG_CYASSL) printf("Turning ON Debug message\n") ; CyaSSL_Debugging_ON() ; #endif if(args.argc == 7) printf("Simple SSL/TLS, ") ; else printf("HTTP GET, ") ; printf("Callee IP: %s, Port: %s, Version:%s\n", argv[2], argv[4], argv[6]) ; while(1) { client_test(&args) ; printf("Enter any key to iterate.\n") ; getchar() ; } }
void init_data(t_shared shared) { int k; int i; t_data data[7]; pthread_t philosophe[7]; i = 0; while (i < 7) { data[i].i = i; data[i].shared = &shared; data[i].life = MAX_LIFE; data[i].etat = 0; data[i].prior = 0; data[i].shared->pos = 7; if ((k = pthread_create(&philosophe[i], NULL, thread_1, &data[i])) != 0) { ft_putstr("Thread creation error \n"); exit(1); } i++; } init_time(data); join_thread(philosophe); }
void SetPollingTimer() { #ifndef WIN32 init_sigaction(); init_time(); #endif }
int main() { void * arg = NULL ; init_time() ; init_filesystem (); printf("=== Start: Crypt Benchmark ===\n") ; benchmark_test(arg) ; printf("=== End: Crypt Benchmark ===\n") ; }
void kmain(uint32_t magic, multiboot_info_t *mboot, uintptr_t ebp) { monitor_clear(); printf("Booting Dionysus!\n"); ASSERT(magic == MULTIBOOT_BOOTLOADER_MAGIC && "Not booted with multiboot."); ASSERT(mboot->flags & MULTIBOOT_INFO_MEMORY && "No memory info."); ASSERT(mboot->flags & MULTIBOOT_INFO_MEM_MAP && "No memory map."); printf("Initializing GDT\n"); init_gdt(); printf("Initializing IDT\n"); init_idt(); // Check for modules if (mboot->flags & MULTIBOOT_INFO_MODS && mboot->mods_count) { multiboot_module_t *mods = (multiboot_module_t *)mboot->mods_addr; placement_address = mods[mboot->mods_count - 1].mod_end + KERNEL_BASE; } printf("Setting up paging\n"); init_paging(mboot->mem_lower + mboot->mem_upper, mboot->mmap_addr, mboot->mmap_length); printf("Initializing timers\n"); init_time(); init_timer(); printf("Starting task scheduling\n"); init_tasking(ebp); init_syscalls(); printf("Initializing vfs\n"); init_vfs(); printf("Initializing driver subsystem\n"); init_blockdev(); init_chardev(); init_term(); printf("Enumerating PCI bus(ses)\n"); init_pci(); dump_pci(); init_devfs(); ASSERT(mount(NULL, "/dev", "devfs", 0) == 0); init_ide(); halt(); }
/* * INITIAL C ENTRY POINT. */ void _minios_start_kernel(start_info_t *si) { bmk_printf_init(minios_putc, NULL); bmk_core_init(STACK_SIZE_PAGE_ORDER, PAGE_SHIFT); arch_init(si); trap_init(); bmk_sched_init(); /* print out some useful information */ minios_printk(" start_info: %p(VA)\n", si); minios_printk(" nr_pages: 0x%lx\n", si->nr_pages); minios_printk(" shared_inf: 0x%08lx(MA)\n", si->shared_info); minios_printk(" pt_base: %p(VA)\n", (void *)si->pt_base); minios_printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames); minios_printk(" mfn_list: %p(VA)\n", (void *)si->mfn_list); minios_printk(" mod_start: 0x%lx(VA)\n", si->mod_start); minios_printk(" mod_len: %lu\n", si->mod_len); minios_printk(" flags: 0x%x\n", (unsigned int)si->flags); minios_printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti(); arch_print_info(); setup_xen_features(); /* Init memory management. */ init_mm(); /* Init time and timers. */ init_time(); /* Init the console driver. */ init_console(); /* Init grant tables */ init_gnttab(); /* Init XenBus */ init_xenbus(); /* Init scheduler. */ bmk_sched_startmain(_app_main, &start_info); bmk_platform_halt("unreachable"); }
int main (int argc, char *argv[]) { int i, count; int *array = (int*) malloc (SIZE * sizeof(int)); uint64_t start, end; int events[3] = { PAPI_L1_DCM, PAPI_L2_DCM, PAPI_L3_DCM }; long long misses[3]; int papilevels = 3; if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT) { exit(1); } //Initialization count = 0; srand(time(NULL)); init_time(); for (i = 0; i < SIZE; i++) array[i] = rand(); // Uncomment this line to qsort(array, SIZE, sizeof (int), compare_ints); //Measurement while (PAPI_start_counters(events, papilevels) != PAPI_OK) { papilevels--; } start = get_time(); /* * É possível, em um vetor ordenado, fazer a contagem * em tempo O(lg(n)) em vez de O(n) utilizando busca * binária. Embora isto diminua sensivelmente o tempo * este não é o intuito deste exercício. * */ for (i = 0; i < SIZE; i++) if (array[i] < RAND_MAX / 2) count++; end = get_time(); uint64_t exec_time = diff_time(start, end); if (PAPI_read_counters(misses, papilevels) != PAPI_OK) { fprintf(stderr, "Erro em PAPI_read_counters\n"); exit(1); } printf("Time: %" PRIu64 " Count %d\n", exec_time, count); for (i = 0; i < papilevels; i++) { printf("Cache misses (L%d): %lld\n", i+1, misses[i]); } free(array); return 0; }
CAMLprim value stub_hypervisor_suspend(value unit) { CAMLparam0(); int cancelled; printk("WARNING: stub_hypervisor_suspend not yet implemented\n"); cancelled = 1; #if 0 /* Turn the store and console mfns to pfns - required because xc_domain_restore uses these values */ start_info.store_mfn = mfn_to_pfn(start_info.store_mfn); start_info.console.domU.mfn = mfn_to_pfn(start_info.console.domU.mfn); /* canonicalize_pagetables can't cope with pagetable entries that are outside of the guest's mfns, so we must unmap anything outside of our space */ unmap_shared_info(); /* Actually do the suspend. When this function returns 0, we've been resumed */ cancelled = HYPERVISOR_suspend(virt_to_mfn(&start_info)); if(cancelled) { start_info.store_mfn = pfn_to_mfn(start_info.store_mfn); start_info.console.domU.mfn = pfn_to_mfn(start_info.console.domU.mfn); } /* Reinitialise several things */ trap_init(); init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ local_irq_enable(); setup_xen_features(); HYPERVISOR_shared_info = map_shared_info(start_info.shared_info); /* Set up event and failsafe callback addresses. */ HYPERVISOR_set_callbacks( (unsigned long)hypervisor_callback, (unsigned long)failsafe_callback, 0); init_time(); arch_rebuild_p2m(); unmask_evtchn(start_info.console.domU.evtchn); unmask_evtchn(start_info.store_evtchn); #endif CAMLreturn(Val_int(cancelled)); }
bool IThread::start() { if(is_running() == false) { return true; } LogDebug("thread %s start", _name.c_str()); init_time(); _over = false; _thread = std::thread(std::bind(&IThread::thread_func, this)); return true; }
int main(int argc, const char *argv[]) { #define SLEEP_TIME 1 len = strlen(msg); init_sigaction(); init_time(); while (1) { sleep(SLEEP_TIME); printf("[%ds have elapsed or a signal arrives which is not ignored.]\n", SLEEP_TIME); } exit(0); }
int main() { void *args = NULL ; init_time() ; init_filesystem (); net_initialize() ; osThreadCreate (osThread (tcp_poll), NULL); osDelay(30000) ; /* wait for DHCP */ #if defined(DEBUG_CYASSL) printf("Turning ON Debug message\n") ; CyaSSL_Debugging_ON() ; #endif echoclient_test(args) ; }
int main(int argc, char **argv) { bool recovering = false; int port, control = 0; init_signals(); /** Get the port number. */ port = 7778; if (argc > 1) { if (!is_number(argv[1])) { fprintf(stderr, "Usage: %s [port #]\n", argv[0]); return 0; } else if ((port = atoi(argv[1])) <= 1024) { fprintf(stderr, "Port number must be above 1024.\n"); return 0; } /* Are we recovering from a copyover? */ if ((argv[2] != NULL) && (argv[2][0] != '\0')) { recovering = true; control = atoi(argv[3]); } else { recovering = false; } } init_time(&globalSystemState); boot_db(); /** Run the game. */ if (!recovering) { control = remote_listen(port); } log_string("BT is ready to rock on port %d.", port); if (recovering) { copyover_recover(); } game_loop(port, control); remote_deafen(control); log_string("Normal termination of game."); return 0; }
void start_kernel(void) { printk("Mirage: start_kernel\n"); /* Set up events. */ init_events(); /* Enable event delivery. This is disabled at start of day. */ local_irq_enable(); setup_xen_features(); /* Init memory management. * Needed for malloc. */ init_mm(); /* Init time and timers. Needed for block_domain. */ init_time(); /* Init the console driver. * We probably do need this if we want printk to send notifications correctly. */ init_console(); /* Init grant tables. */ init_gnttab(); #if 1 /* Call our main function directly, without using Mini-OS threads. */ app_main_thread(NULL); #else /* Init scheduler. */ /* Needed if you want to use create_thread, but we can get away without it. */ init_sched(); /* Init XenBus */ /* Using Mini-OS's XenBus support requires threads. */ init_xenbus(); /* Respond to "xl shutdown". Requires XenBus. */ create_thread("shutdown", shutdown_thread, NULL); create_thread("ocaml", app_main_thread, NULL); /* Everything initialised, start idle thread */ run_idle_thread(); #endif }
int main(int argc, char ** argv) { init_signal_handler(); atc_init(); init_UI(); init_time(); create_plane(); state.airports_num = get_airports(state.airports); while(1){ update_state(); draw_UI(); input(wgetch(ui.cmd_log)); } atc_deinit(); dispose_UI(); return 0; }
int main(int argc, char* argv[]){ if(argc < 2){ fprintf(stdout, "%s Version %d.%d\n",argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); fprintf(stdout, "Usage: %s number\n", argv[0]); return 1; } inputValue = atof(argv[1]); init_sigaction(); init_time(); while(true) sleep(1); return 0; }
void init_builtin_commands() { LOG_D("command/init") << "Populating command map"; init_app(); init_audio(); init_automation(); init_edit(); init_grid(); init_help(); init_keyframe(); init_recent(); init_subtitle(); init_time(); init_timecode(); init_tool(); init_video(); init_visual_tools(); }
static void init_env(void) { SCM smob; char *ver; SOURCE_HANDLE *handle; init_log(); init_alsa_module(); ver = scm_to_locale_string(scm_version()); log_msg("Guile version %s\n", ver); free(ver); init_messaging(msg_port); init_time(); init_json(); init_scheduler(); init_audiofile(); if (use_jack) init_jackport(); init_feeds(); init_recorder(); init_stream(); init_source_mod(); init_ladspa(); init_unitgen(); fader = (SOURCE_OBJ *)my_malloc(sizeof(SOURCE_OBJ), "main fader"); handle = (SOURCE_HANDLE *)my_gc_malloc(sizeof(SOURCE_HANDLE), "mains", "mains"); handle->body = (void *)fader; handle->src = fader; init_source(fader); mains_tag = scm_make_smob_type("mains", sizeof(SOURCE_OBJ)); SCM_NEWSMOB(smob, mains_tag, handle); scm_c_define("mains", smob); if (use_jack) { scm_c_define("jack-client-name", scm_from_locale_string(client_name)); scm_c_define_gsubr("patch-out", 2, 0, 0, patch_out); scm_c_define_gsubr("unpatch-out", 2, 0, 0, unpatch_out); } scm_c_define_gsubr("quit", 0, 0, 0, qmx_quit); scm_c_define_gsubr("db", 1, 0, 0, db20); scm_c_define_gsubr("period-duty-cycle", 0, 0, 0, get_duty_cycle); scm_permanent_object(console_display = scm_c_eval_string(console_display_src)); scm_permanent_object(catch_display = scm_c_eval_string(catch_display_src)); return; }
/* ================= engine_start ================= */ erbool engine_start (void) { init_time(); sys_get_time(); INIT(cvar); INIT(cmd); INIT(cmdbuf); cmd_register("quit", NULL, &quit_f, 0); cmd_register("echo", NULL, &echo_f, 0); INIT(fs); INIT(keyboard); cmdbuf_add("exec config.cfg\n", CMD_SRC_ENGINE); cmdbuf_frame(); INIT(mouse); INIT(image); INIT(video); INIT(gl); INIT(r); INIT(snd); INIT(g); cmdbuf_add("exec autoexec.cfg\n", CMD_SRC_ENGINE); cmdbuf_frame(); /* put sys args into cmdbuf (which begin with '+') once again (after all cmds like 'map' were registered) */ sys_arg_to_cmdbuf('+'); cmdbuf_frame(); return true; error: engine_stop(); return false; }
void start_kernel(void) { /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ local_irq_enable(); setup_xen_features(); /* Init memory management. */ init_mm(); /* Init GDT */ init_gdt(); /* Init time and timers. */ init_time(); /* Init the console driver. */ init_console(); /* Init grant tables */ init_gnttab(); /* Init scheduler. */ init_sched(); /* Init XenBus */ init_xenbus(); /* Init futexes */ init_futex(); #ifdef CONFIG_XENBUS create_thread("shutdown", shutdown_thread, NULL); #endif /* Call (possibly overridden) app_main() */ app_main(&start_info); /* Everything initialised, start idle thread */ run_idle_thread(); }
void server(int sock, int gfxsock, t_server *server) { int actual; actual = 0; init_server(server, gfxsock, sock); while (1) { init_time(server, &actual); regen_food(server); do_cmd(server); init_eggs(server); init_fds(server, actual); if (server_select(server, &actual)) continue ; } clear_clients(server->clients, actual); close(server->sock); }
/* * INITIAL C ENTRY POINT. */ void start_kernel(start_info_t *si) { static char hello[] = "Bootstrapping...\n"; (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello); arch_init(si); trap_init(); /* print out some useful information */ printk("Mirage OS!\n"); printk(" start_info: %p(VA)\n", si); printk(" nr_pages: 0x%lx\n", si->nr_pages); printk(" shared_inf: 0x%08lx(MA)\n", si->shared_info); printk(" pt_base: %p(VA)\n", (void *)si->pt_base); printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames); printk(" mfn_list: %p(VA)\n", (void *)si->mfn_list); printk(" mod_start: 0x%lx(VA)\n", si->mod_start); printk(" mod_len: %lu\n", si->mod_len); printk(" flags: 0x%x\n", (unsigned int)si->flags); printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti(); arch_print_info(); setup_xen_features(); /* Init memory management. */ init_mm(); /* Init time and timers. */ init_time(); /* Call (possibly overridden) app_main() */ app_main(&start_info); }
//void Option_Trade::init_characteristics() //{ // this->characteristics.length_of_option_contract= // this->objects_needed.assumptions->length_of_option_contract; // this->characteristics.sell_at_time_to_expiry= // this->objects_needed.assumptions->sell_at_time_to_expiry; // //this->characteristics.shock_size= // // this->objects_needed.assumptions->shock_size; //} void Option_Trade::init_tab_asset_purchase_struct(int i) { /*for(int i=0;i<this->objects_needed.assumptions->model_period;++i) {*/ init_time(i); init_ex_gamma(i); init_gamma_put(i); init_gamma_liability(i); init_net_gamma(i); init_hedging(i); // init_req_net_gamma(i); // init_req_gamma_liability(i); init_new_net_gamma(i); // init_tab(i); init_short_existing_positions(i); init_contracts(i); /*}*/ }
int main(int argc, char *argv[]) { signal(SIGALRM, sig_alarm); if ((argc < 2) || (argc > 2 && argc < 5) || (argc > 5)) { fprintf(stderr, "Error args!\n"); print_usage(); return -1; } strcpy(root_dir, argv[1]); if (root_dir[strlen(root_dir)-1] == '/') { root_dir[strlen(root_dir)-1] = '\0'; } if (argc == 5) { file_size = atol(argv[2])*1024*1024; thread_n = atoi(argv[3]); time_s = atoi(argv[4]); } if ((n = parse_args()) <= 0) { openlog("fs_write", LOG_CONS|LOG_PID, 0); syslog(LOG_USER|LOG_ERR, "parse_args error!\n"); print_usage(); return -1; } strcpy(_dirname, root_dir); strcat(_dirname, "/"); strcat(_dirname, dirs_name[now]); if (init_time(time_s) < 0) { openlog("fs_write", LOG_CONS|LOG_PID, 0); syslog(LOG_USER|LOG_ERR, "init_time error!\n"); return -1; } if (w_thread() < 0) { return -1; } if (dfile() < 0) { return -1; } }
int main(int argc, char **argv) { int i; qthread_t t; signal(SIGINT, handler); init_time(); nforks = 4; qthread_mutex_init(&m, NULL); for (i = 0; i < nforks; i++) qthread_cond_init(&C[i], NULL); for (i = 0; i < nforks; i++) qthread_create(&t, NULL, philosopher_thread, (void*)i); wait_until_done(); return 0; }
FFGLStatic::FFGLStatic() :CFreeFrameGLPlugin(), m_initResources(1) { // Input properties SetMinInputs(1); SetMaxInputs(1); SetTimeSupported(true); init_time(&t0); #ifdef _WIN32 srand(GetTickCount()); #else srand(time(NULL)); #endif // parameters: SetParamInfo(FFPARAM_Mode, "Mode", FF_TYPE_STANDARD, 0.5f); m_mode = 0.5f; }
int world_main_loop(int argc, char **argv, world_t *w){ init_time(); set_fps(90); world_set(w); /*printf("coucou2\n"); */ glutInit(&argc,argv); glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RGB); glEnable(GL_DEPTH_TEST); glutInitWindowPosition(250,250); glutInitWindowSize(600,400); glutCreateWindow("BASTOS 85"); draw_init(); glutDisplayFunc(do_world); glutIdleFunc(do_world); glutReshapeFunc(draw_reshape); /*glutIgnoreKeyRepeat(1);*/ glutKeyboardFunc(keyboard_down_func); glutKeyboardUpFunc(keyboard_up_func); glutMainLoop(); return 0; }
std::string Caffe::time_from_init() { std::ostringstream os; os.unsetf(std::ios_base::floatfield); os.precision(4); double span = std::difftime(std::time(NULL), init_time()); const double mn = 60.; const double hr = 3600.; if (span < mn) { os << span << "s"; } else if (span < hr) { int m = static_cast<int>(span / mn); double s = span - m * mn; os << m << "m " << s << "s"; } else { int h = static_cast<int>(span / hr); int m = static_cast<int>((span - h * hr) / mn); double s = span - h * hr - m * mn; os << h << "h " << m << "m " << s << "s"; } return os.str(); }