本文整理汇总了C++中print_stats函数的典型用法代码示例。如果您正苦于以下问题:C++ print_stats函数的具体用法?C++ print_stats怎么用?C++ print_stats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_stats函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: eat
void
eat(void)
{
short ch;
short moves;
object *obj;
char buf[70];
ch = pack_letter(mesg[262], FOOD);
if (ch == CANCEL) {
return;
}
if (!(obj = get_letter_object(ch))) {
message(mesg[263], 0);
return;
}
if (obj->what_is != FOOD) {
message(mesg[264], 0);
return;
}
if ((obj->which_kind == FRUIT) || rand_percent(60)) {
moves = get_rand(900, 1100);
if (obj->which_kind == RATION) {
if (get_rand(1, 10) == 1) {
message(mesg[265], 0);
} else
message(mesg[266], 0);
} else {
sprintf(buf, mesg[267], fruit);
message(buf, 0);
}
} else {
moves = get_rand(700, 900);
message(mesg[268], 0);
add_exp(2, 1);
}
rogue.moves_left /= 3;
rogue.moves_left += moves;
hunger_str[0] = 0;
print_stats(STAT_HUNGER);
vanish(obj, 1, &rogue.pack);
}
开发者ID:masoo,项目名称:rogueclone2s,代码行数:43,代码来源:use.c
示例2: myThread
void ThreadLocalAllocBuffer::accumulate_statistics() {
Thread* thread = myThread();
size_t capacity = Universe::heap()->tlab_capacity(thread);
size_t used = Universe::heap()->tlab_used(thread);
_gc_waste += (unsigned)remaining();
size_t total_allocated = thread->allocated_bytes();
size_t allocated_since_last_gc = total_allocated - _allocated_before_last_gc;
_allocated_before_last_gc = total_allocated;
if (PrintTLAB && (_number_of_refills > 0 || Verbose)) {
print_stats("gc");
}
if (_number_of_refills > 0) {
// Update allocation history if a reasonable amount of eden was allocated.
bool update_allocation_history = used > 0.5 * capacity;
if (update_allocation_history) {
// Average the fraction of eden allocated in a tlab by this
// thread for use in the next resize operation.
// _gc_waste is not subtracted because it's included in
// "used".
// The result can be larger than 1.0 due to direct to old allocations.
// These allocations should ideally not be counted but since it is not possible
// to filter them out here we just cap the fraction to be at most 1.0.
double alloc_frac = MIN2(1.0, (double) allocated_since_last_gc / used);
_allocation_fraction.sample(alloc_frac);
}
global_stats()->update_allocating_threads();
global_stats()->update_number_of_refills(_number_of_refills);
global_stats()->update_allocation(_number_of_refills * desired_size());
global_stats()->update_gc_waste(_gc_waste);
global_stats()->update_slow_refill_waste(_slow_refill_waste);
global_stats()->update_fast_refill_waste(_fast_refill_waste);
} else {
assert(_number_of_refills == 0 && _fast_refill_waste == 0 &&
_slow_refill_waste == 0 && _gc_waste == 0,
"tlab stats == 0");
}
global_stats()->update_slow_allocations(_slow_allocations);
}
开发者ID:gaoxiaojun,项目名称:dync,代码行数:43,代码来源:threadLocalAllocBuffer.cpp
示例3: intHandler
// Signal handler
// HUP print the stats
// INT end server
// TERM end server
void intHandler(int signum) {
log_msg(daemon_mode, "Signal %s (%d) receieved", strsignal(signum), signum);
switch(signum) {
case SIGINT:
running = 0;
break;
case SIGTERM:
running = 0;
break;
case SIGHUP:
loadRobots(jailDir);
loadSitemap(jailDir);
time(&finish);
printTZ();
print_stats(daemon_mode, start, finish, "running for");
break;
default:
break;
}
}
开发者ID:Papafox,项目名称:checkip,代码行数:24,代码来源:checkip.c
示例4: read_chunk
static int
read_chunk(struct rucb_conn *c, int offset, char *to, int maxsize)
{
int size;
size = maxsize;
if(bytecount + maxsize >= FILESIZE) {
size = FILESIZE - bytecount;
}
bytecount += size;
if(bytecount == FILESIZE) {
printf("Completion time %lu / %u\n", (unsigned long)clock_time() - start_time, CLOCK_SECOND);
/* profile_aggregates_print(); */
/* profile_print_stats(); */
print_stats();
}
/* printf("bytecount %lu\n", bytecount);*/
return size;
}
开发者ID:AlphaBetaPhi,项目名称:contiki,代码行数:20,代码来源:example-rucb.c
示例5: diving_stats
/**
* This function loops through the level and does N iterations of
* the stat calling function, assuming diving style.
*/
static void diving_stats(void)
{
int depth;
/* Iterate through levels */
for (depth = 0; depth < MAX_LVL; depth += 5) {
player->depth = depth;
if (player->depth == 0) player->depth = 1;
/* Do many iterations of each level */
for (iter = 0; iter < tries; iter++)
stats_collect_level();
/* Print the output to the file */
print_stats(depth);
/* Show the level to check on status */
do_cmd_redraw();
}
}
开发者ID:NickMcConnell,项目名称:FirstAgeAngband,代码行数:24,代码来源:wiz-stats.c
示例6: msg_add
static void msg_add(struct msg *msg)
{
unsigned int timeout = TX_TIMEOUT;
struct timespec abstime;
int error;
assert(!msg->next);
pthread_mutex_lock(&list_mutex);
if (list_size > MAX_LIST_SIZE) {
pr_debug("Too many bytes in flight, pausing...\n");
if (clock_gettime(CLOCK_REALTIME, &abstime)) {
pr_error("Failed to get clock: %s\n", strerror(errno));
exit(-1);
}
abstime.tv_sec += timeout;
do {
error = pthread_cond_timedwait(&list_full, &list_mutex,
&abstime);
if (error == ETIMEDOUT) {
pr_error("Timeout, aborting\n");
print_stats();
exit(-1);
}
} while (list_size > MAX_LIST_SIZE);
}
if (list_tail)
list_tail->next = msg;
else
list_head = msg;
list_tail = msg;
list_size++;
pthread_mutex_unlock(&list_mutex);
pthread_cond_signal(&list_nonempty);
}
开发者ID:geertu,项目名称:sertest,代码行数:41,代码来源:sertest.c
示例7: eat
void
eat(void)
{
short ch;
short moves;
object *obj;
char buf[70];
ch = pack_letter("eat what?", FOOD);
if (ch == CANCEL) {
return;
}
if (!(obj = get_letter_object(ch))) {
message("no such item.", 0);
return;
}
if (obj->what_is != FOOD) {
message("you can't eat that", 0);
return;
}
if ((obj->which_kind == FRUIT) || rand_percent(60)) {
moves = get_rand(950, 1150);
if (obj->which_kind == RATION) {
message("yum, that tasted good", 0);
} else {
sprintf(buf, "my, that was a yummy %s", fruit);
message(buf, 0);
}
} else {
moves = get_rand(750, 950);
message("yuk, that food tasted awful", 0);
add_exp(2, 1);
}
rogue.moves_left /= 3;
rogue.moves_left += moves;
hunger_str[0] = 0;
print_stats(STAT_HUNGER);
vanish(obj, 1, &rogue.pack);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:41,代码来源:use.c
示例8: print_stats
void ThreadLocalAllocBuffer::accumulate_statistics() {
size_t capacity = Universe::heap()->tlab_capacity(myThread()) / HeapWordSize;
size_t unused = Universe::heap()->unsafe_max_tlab_alloc(myThread()) / HeapWordSize;
size_t used = capacity - unused;
// Update allocation history if a reasonable amount of eden was allocated.
bool update_allocation_history = used > 0.5 * capacity;
_gc_waste += (unsigned)remaining();
if (PrintTLAB && (_number_of_refills > 0 || Verbose)) {
print_stats("gc");
}
if (_number_of_refills > 0) {
if (update_allocation_history) {
// Average the fraction of eden allocated in a tlab by this
// thread for use in the next resize operation.
// _gc_waste is not subtracted because it's included in
// "used".
size_t allocation = _number_of_refills * desired_size();
double alloc_frac = allocation / (double) used;
_allocation_fraction.sample(alloc_frac);
}
global_stats()->update_allocating_threads();
global_stats()->update_number_of_refills(_number_of_refills);
global_stats()->update_allocation(_number_of_refills * desired_size());
global_stats()->update_gc_waste(_gc_waste);
global_stats()->update_slow_refill_waste(_slow_refill_waste);
global_stats()->update_fast_refill_waste(_fast_refill_waste);
} else {
assert(_number_of_refills == 0 && _fast_refill_waste == 0 &&
_slow_refill_waste == 0 && _gc_waste == 0,
"tlab stats == 0");
}
global_stats()->update_slow_allocations(_slow_allocations);
}
开发者ID:GregBowyer,项目名称:Hotspot,代码行数:41,代码来源:threadLocalAllocBuffer.cpp
示例9: famstats_fm_main
int famstats_fm_main(int argc, char *argv[])
{
famstats_t *s;
int c;
famstats_fm_settings_t settings{0};
settings.notification_interval = 1000000;
while ((c = getopt(argc, argv, "m:f:n:Fh?")) >= 0) {
switch (c) {
case 'm':
settings.minmq = atoi(optarg); break;
break;
case 'f':
settings.minFM = atoi(optarg); break;
break;
case 'F':
settings.skip_fp_fail = 1; break;
case 'n': settings.notification_interval = strtoull(optarg, nullptr, 0); break;
case '?': case 'h':
return famstats_fm_usage(EXIT_SUCCESS);
}
}
if (argc != optind+1) {
return famstats_fm_usage((argc == optind) ? EXIT_SUCCESS: EXIT_FAILURE);
}
LOG_INFO("Running famstats fm with minmq %i and minFM %i.\n", settings.minmq, settings.minFM);
for(const char *tag: tags_to_check)
dlib::check_bam_tag_exit(argv[optind], tag);
dlib::BamHandle handle(argv[optind]);
s = famstats_fm_core(handle, &settings);
print_stats(s, stdout, &settings);
kh_destroy(fm, s->fm);
kh_destroy(fm, s->np);
kh_destroy(fm, s->rc);
free(s);
LOG_INFO("Successfully completed bmftools famstats fm.\n");
return EXIT_SUCCESS;
}
开发者ID:ARUP-NGS,项目名称:BMFtools,代码行数:41,代码来源:bmf_famstats.cpp
示例10: sting
void
sting(object *monster)
{
short sting_chance = 35;
char msg[80];
if ((rogue.str_current <= 3) || sustain_strength) {
return;
}
sting_chance += (6 * (6 - get_armor_class(rogue.armor)));
if ((rogue.exp + ring_exp) > 8) {
sting_chance -= (6 * ((rogue.exp + ring_exp) - 8));
}
if (rand_percent(sting_chance)) {
sprintf(msg, mesg[207], mon_name(monster));
message(msg, 0);
rogue.str_current--;
print_stats(STAT_STRENGTH);
}
}
开发者ID:naota,项目名称:rogueclone2s-utf8,代码行数:21,代码来源:spechit.c
示例11: main
int main() {
test_t *tests[TEST_COUNT] = {
test(test_parse_reg),
test(test_parse_reg_without_args),
test(test_parse_error),
test(test_parse_exit),
test(test_parse_exit_with_line_feed),
test(test_parse_exit_with_line_ending),
test(test_parse_pwd),
};
for (int i = 0; i < TEST_COUNT && tests[i] != NULL; ++i)
{
test_t *t = tests[i];
t->t(t);
eval(t);
}
print_stats(tests, TEST_COUNT);
return 0;
}
开发者ID:tmichel,项目名称:chatd,代码行数:21,代码来源:parser_test.c
示例12: defined
~stats (void)
{
if (this->quantify_)
{
#if defined (USING_QUANTIFY)
// Stop recording data here; whatever happens after this is
// not relevant.
QuantifyStopRecordingData ();
#endif /* USING_QUANTIFY */
}
// stop the timer.
this->timer_.stop ();
ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time;
this->timer_.elapsed_time (elapsed_time);
// compute average time.
ACE_DEBUG ((LM_DEBUG, "\n%C stats...\n",
this->test_name_));
print_stats (elapsed_time);
}
开发者ID:CCJY,项目名称:ATCD,代码行数:22,代码来源:registration.cpp
示例13: do_output
static void do_output(int test_type, long long *array, int bins, int show_std_dev, int show_dist) {
int s[10];
long long min, max;
double average, std;
std = do_stats(array, &min, &max, &average);
print_stats(test_type, min, max, average, std);
if (show_std_dev) {
do_std_dev(array, s, std, average);
print_std_dev(s);
}
if (show_dist) {
int *d;
d = malloc(bins*sizeof(int));
do_dist(array, min, max, bins, d);
print_dist(min, max, bins, d);
free(d);
}
}
开发者ID:tcreech,项目名称:papi-4.0.0-64-solaris11.2,代码行数:22,代码来源:cost.c
示例14: main
int main(int argc, char** argv) {
/*
* argv[1] = first run's directory
* argv[2] = second run's directory
*/
if (argc != 4) {
DEBUG(stderr, "argv[1] = first run's directory, argv[2] = second run's directory, argv[3] = input file\n");
}
assert(argc == 4);
DEBUG(stderr, "argv0 = %s, argv1 = %s, argv2 = %s \n", argv[0], argv[1], argv[2]);
first_dir = (struct directory_files*) malloc(sizeof(struct directory_files));
second_dir = (struct directory_files*) malloc(sizeof(struct directory_files));
gettimeofday(&stats.start, NULL);
DEBUG(stderr, "init_filename\n");
if (!init_filenames(argv[1], argv[2], argv[3])) {
fprintf(stderr, "init filenames failed\n");
exit(1);
}
DEBUG(stderr, "build_address_lookup\n");
if (!build_address_lookup(first_dir->snapshot, second_dir->snapshot)) {
fprintf(stderr, "build_dictionary failed\n");
exit(1);
}
build_tables(first_dir, second_dir);
// init_get_input_addrs(second_dir->dataflow_result);
process_outputs(argv[3]);
save_outputs();
gettimeofday(&stats.end, NULL);
print_stats(stats);
return 1;
}
开发者ID:andrewjylee,项目名称:taint_trackers,代码行数:38,代码来源:stitch_working.cpp
示例15: shutdown_power_off
/* Powers down the machine we're running on,
as long as we're running on Bochs or QEMU. */
void
shutdown_power_off (void)
{
switch (shutdown_power_off_recursion ++)
{
case 0:
#ifdef FILESYS
{
enum intr_level old_level = intr_enable ();
filesys_done ();
intr_set_level (old_level);
}
#endif
case 1:
print_stats ();
printf ("Powering off...\n");
serial_flush ();
break;
default:
shutdown_power_off_recursion = 2;
}
for (;;)
{
/* This is a special power-off sequence supported by Bochs and
QEMU, but not by physical hardware. */
const char *p;
for (p = "Shutdown"; *p; ++p)
outb (0x8900, *p);
/* This will power off a VMware VM if "gui.exitOnCLIHLT = TRUE"
is set in its configuration file. (The "pintos" script does
that automatically.) */
asm volatile ("cli; hlt");
printf ("still running...\n");
}
}
开发者ID:cmcgrady,项目名称:Pintos,代码行数:40,代码来源:shutdown.c
示例16: run
static void run (CORBA::ORB_ptr orb,
ACE_TCHAR *IOR)
{
if (IOR != 0)
{
// Get an object reference from the argument string.
CORBA::Object_var object = orb->string_to_object (IOR);
// Try to narrow the object reference to a reference.
T_var test = T::_narrow (object.in ());
ACE_Profile_Timer timer;
ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time;
// We start an ACE_Profile_Timer here...
timer.start ();
CORBA::Long result = 0;
int i = 0;
for (i = 0; i < iterations ; i++)
{
// Invoke the doit() method on the reference.
result = test->doit ();
}
// stop the timer.
timer.stop ();
timer.elapsed_time (elapsed_time);
// compute average time.
print_stats (elapsed_time, i);
// Print the result of doit () method on the reference.
ACE_DEBUG ((LM_DEBUG,
"%d\n",
result));
}
}
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:38,代码来源:client.cpp
示例17: P1H
int wrap_up P1H(void){
#line 1152 "./cwebdir/common.w"
putchar('\n');
if(show_stats)
print_stats();
/*64:*/
#line 1160 "./cwebdir/common.w"
switch(history){
case spotless:if(show_happiness)printf("(No errors were found.)\n");break;
case harmless_message:
printf("(Did you see the warning message above?)\n");break;
case error_message:
printf("(Pardon me, but I think I spotted something wrong.)\n");break;
case fatal_message:printf("(That was a fatal error, my friend.)\n");
}
/*:64*/
#line 1155 "./cwebdir/common.w"
;
if(history> harmless_message)return(1);
else return(0);
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:23,代码来源:cwebboot.c
示例18: prefs_form_save_prefs
static void prefs_form_save_prefs(Short rw, Short ws)
{
Boolean dirty, verydirty;
dirty = prefs_save_lists(rw, ws);
verydirty = prefs_save_checkboxes_1();
dirty = prefs_save_checkboxes_2() || dirty;
writePrefs();
LeaveForm();
if (verydirty) { // clear-and-redraw absolutely everything
clear_visible();
move_visible_window(you.ux, you.uy, true);
show_messages();
refresh();
flags.botl = BOTL_ALL;
print_stats(0);
} else if (dirty) { // don't need to redraw msgs or stats
// ?
move_visible_window(you.ux, you.uy, true);
refresh();
}
}
开发者ID:BackupTheBerlios,项目名称:paleohack,代码行数:23,代码来源:form_prefs.c
示例19: close_streamer
int close_streamer(struct opt_s *opt)
{
D("Closing streamer");
struct stats *stats_full = (struct stats *)malloc(sizeof(struct stats));
init_stats(stats_full);
D("stats ready");
if (opt->streamer_ent != NULL)
opt->streamer_ent->close(opt->streamer_ent, (void *)stats_full);
D("Closed streamer_ent");
#if(!DAEMON)
close_rbufs(opt, stats_full);
close_recp(opt, stats_full);
D("Membranch and diskbranch shut down");
#else
stats_full->total_written = opt->bytes_exchanged;
#endif
D("Printing stats");
print_stats(stats_full, opt);
free(stats_full);
D("Stats over");
return 0;
}
开发者ID:tlsalmin,项目名称:vlbi-streamer,代码行数:23,代码来源:streamer.c
示例20: main
int main (int argc, char **argv) {
char *cmd;
char *fname;
if (argc < 3) {
usage();
return 0;
}
argv++;
cmd = *(argv++);
fname = *(argv++);
switch (*cmd) {
case 'c': // create
if (mw_create(fname, argv, argc)) {
usage();
}
break;
case 's': // stats
print_stats(fname);
break;
case 'f': // fetch
get_data(fname, argv);
break;
case 'd': // dump
dump_data(fname, argv);
break;
case 'u': // update
update_meta(fname, argv);
break;
default:
printf("Error: Unrecognized command: %s\n", cmd);
}
return 0;
}
开发者ID:kulesha,项目名称:mwiggle,代码行数:37,代码来源:mwiggle.c
注:本文中的print_stats函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论