/* Hash test: buffer of size byte. Run test n times. */ static void run_test(size_t size, unsigned int n, unsigned int l) { uint64_t t; struct statistics stats; TEEC_Operation op; int n0 = n; alloc_shm(size, algo); if (!random_in) memset((uint8_t *)in_shm.buffer + offset, 0, size); memset(&op, 0, sizeof(op)); op.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_PARTIAL_INPUT, TEEC_MEMREF_PARTIAL_OUTPUT, TEEC_VALUE_INPUT, TEEC_NONE); op.params[0].memref.parent = &in_shm; op.params[0].memref.offset = 0; op.params[0].memref.size = size + offset; op.params[1].memref.parent = &out_shm; op.params[1].memref.offset = 0; op.params[1].memref.size = hash_size(algo); op.params[2].value.a = l; op.params[2].value.b = offset; verbose("Starting test: %s, size=%zu bytes, ", algo_str(algo), size); verbose("random=%s, ", yesno(random_in)); verbose("unaligned=%s, ", yesno(offset)); verbose("inner loops=%u, loops=%u, warm-up=%u s\n", l, n, warmup); if (warmup) do_warmup(); memset(&stats, 0, sizeof(stats)); while (n-- > 0) { t = run_test_once((uint8_t *)in_shm.buffer + offset, size, &op, l); update_stats(&stats, t); if (n % (n0/10) == 0) vverbose("#"); } vverbose("\n"); printf("min=%gμs max=%gμs mean=%gμs stddev=%gμs (%gMiB/s)\n", stats.min/1000, stats.max/1000, stats.m/1000, stddev(&stats)/1000, mb_per_sec(size, stats.m)); free_shm(); }
GAMECONTROLLER::GAMECONTROLLER() { gametype = "unknown"; // do_warmup(config.sv_warmup); game_over_tick = -1; sudden_death = 0; round_start_tick = server_tick(); round_count = 0; game_flags = 0; teamscore[0] = 0; teamscore[1] = 0; map_wish[0] = 0; unbalanced_tick = -1; force_balanced = false; num_spawn_points[0] = 0; num_spawn_points[1] = 0; num_spawn_points[2] = 0; }
GAMECONTROLLER::GAMECONTROLLER() { gametype = "unknown"; // do_warmup(config.sv_warmup); game_over_tick = -1; sudden_death = 0; round_start_tick = server_tick(); round_count = 0; game_flags = 0; teamscore[0] = 0; teamscore[1] = 0; map_wish[0] = 0; unbalanced_tick = -1; force_balanced = false; num_spawn_points[0] = 0; num_spawn_points[1] = 0; num_spawn_points[2] = 0; slow_tick = -1; x2_tick = -1; speed_tick = -1; one_hit_tick = -1; web_tick = -1; is_cup = false; jackpot = 0; potcount = 0; do_potcount(35); /* SQL */ // create tables game.sql->create_tables(); }
/* * log_init -- benchmark initialization function */ static int log_init(struct benchmark *bench, struct benchmark_args *args) { int ret = 0; assert(bench); assert(args != NULL); assert(args->opts != NULL); struct benchmark_info *bench_info; struct log_bench *lb = (struct log_bench *)malloc(sizeof(struct log_bench)); if (!lb) { perror("malloc"); return -1; } lb->args = (struct prog_args *)args->opts; lb->args->el_size = args->dsize; if (lb->args->vec_size == 0) lb->args->vec_size = 1; if (lb->args->rand && lb->args->min_size > lb->args->el_size) { errno = EINVAL; ret = -1; goto err_free_lb; } if (lb->args->rand && lb->args->min_size == lb->args->el_size) lb->args->rand = false; /* align pool size to ensure that we have enough usable space */ lb->psize = MMAP_ALIGN_UP(POOL_HDR_SIZE + args->n_ops_per_thread * args->n_threads * lb->args->vec_size * lb->args->el_size); /* calculate a required pool size */ if (lb->psize < PMEMLOG_MIN_POOL) lb->psize = PMEMLOG_MIN_POOL; if (args->is_poolset) { if (lb->psize > args->fsize) { fprintf(stderr, "insufficient size of poolset\n"); ret = -1; goto err_free_lb; } lb->psize = 0; } bench_info = pmembench_get_info(bench); if (!lb->args->fileio) { if ((lb->plp = pmemlog_create(args->fname, lb->psize, args->fmode)) == NULL) { perror("pmemlog_create"); ret = -1; goto err_free_lb; } bench_info->operation = (lb->args->vec_size > 1) ? log_appendv : log_append; } else { int flags = O_CREAT | O_RDWR | O_SYNC; /* Create a file if it does not exist. */ if ((lb->fd = open(args->fname, flags, args->fmode)) < 0) { perror(args->fname); ret = -1; goto err_free_lb; } /* allocate the pmem */ if ((errno = posix_fallocate(lb->fd, 0, lb->psize)) != 0) { perror("posix_fallocate"); ret = -1; goto err_close; } bench_info->operation = (lb->args->vec_size > 1) ? fileio_appendv : fileio_append; } if (!lb->args->no_warmup) { size_t warmup_nops = args->n_threads * args->n_ops_per_thread; if (do_warmup(lb, warmup_nops)) { fprintf(stderr, "warmup failed\n"); ret = -1; goto err_close; } } pmembench_set_priv(bench, lb); return 0; err_close: if (lb->args->fileio) close(lb->fd); else pmemlog_close(lb->plp); err_free_lb: free(lb); return ret; }