本文整理汇总了C++中print_statistics函数的典型用法代码示例。如果您正苦于以下问题:C++ print_statistics函数的具体用法?C++ print_statistics怎么用?C++ print_statistics使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_statistics函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ill_handler
/** Handler for SIGILL (illegal instruction). */
void ill_handler(int sig, siginfo_t* info, void*) {
#ifdef CVC4_DEBUG
safe_print(STDERR_FILENO,
"CVC4 executed an illegal instruction in DEBUG mode.\n");
if(!segvSpin) {
print_statistics();
abort();
} else {
safe_print(STDERR_FILENO,
"Spinning so that a debugger can be connected.\n");
safe_print(STDERR_FILENO, "Try: gdb ");
safe_print(STDERR_FILENO, *progName);
safe_print(STDERR_FILENO, " ");
safe_print<int64_t>(STDERR_FILENO, getpid());
safe_print(STDERR_FILENO, "\n");
safe_print(STDERR_FILENO, " or: gdb --pid=");
safe_print<int64_t>(STDERR_FILENO, getpid());
safe_print(STDERR_FILENO, " ");
safe_print(STDERR_FILENO, *progName);
safe_print(STDERR_FILENO, "\n");
for(;;) {
sleep(60);
}
}
#else /* CVC4_DEBUG */
safe_print(STDERR_FILENO, "CVC4 executed an illegal instruction.\n");
print_statistics();
abort();
#endif /* CVC4_DEBUG */
}
示例2: main
int main(void)
{
LEDS_CONFIGURE(LEDS_MASK);
LEDS_OFF(LEDS_MASK);
nrf_gpio_cfg_output(WAVE_ON_PIN_NUMBER); // on this pin 2Hz wave will be generated
#ifdef BSP_BUTTON_0
// configure pull-up on first button
nrf_gpio_cfg_input(BSP_BUTTON_0, NRF_GPIO_PIN_PULLUP);
#endif
APP_GPIOTE_INIT(1);
uart_config();
lpcomp_init();
printf("\n\rLPCOMP driver usage example\r\n");
while (true)
{
print_statistics();
LEDS_ON(BSP_LED_1_MASK);
NRF_GPIO->OUTCLR = (1 << WAVE_ON_PIN_NUMBER);
nrf_delay_ms(100); // generate 100 ms pulse on selected pin
print_statistics();
LEDS_OFF(BSP_LED_1_MASK);
NRF_GPIO->OUTSET = (1 << WAVE_ON_PIN_NUMBER);
nrf_delay_ms(400);
}
}
示例3: main
/* The main function */
int
main(int argc, char **argv)
{
/* Generate the grids and populate them with the same set of random values. */
GRID_STRUCT *grid_1 = (GRID_STRUCT *)malloc(sizeof(GRID_STRUCT));
GRID_STRUCT *grid_2 = (GRID_STRUCT *)malloc(sizeof(GRID_STRUCT));
GRID_STRUCT *grid_3 = (GRID_STRUCT *)malloc(sizeof(GRID_STRUCT));
grid_1->dimension = GRID_DIMENSION;
grid_1->num_elements = grid_1->dimension * grid_1->dimension;
grid_2->dimension = GRID_DIMENSION;
grid_2->num_elements = grid_2->dimension * grid_2->dimension;
grid_3->dimension = GRID_DIMENSION;
grid_3->num_elements = grid_3->dimension * grid_3->dimension;
create_grids(grid_1, grid_2, grid_3);
/* Compute the reference solution using the single-threaded version. */
printf("Using the single threaded version to solve the grid. \n");
int num_iter = compute_gold(grid_1);
printf("Convergence achieved after %d iterations. \n", num_iter);
/* Use pthreads to solve the equation uisng the red-black parallelization technique. */
printf("Using pthreads to solve the grid using the red-black parallelization method. \n");
num_iter = compute_using_pthreads_red_black(grid_2);
printf("Convergence achieved after %d iterations. \n", num_iter);
/* Use pthreads to solve the equation using the jacobi method in parallel. */
printf("Using pthreads to solve the grid using the jacobi method. \n");
num_iter = compute_using_pthreads_jacobi(grid_3);
printf("Convergence achieved after %d iterations. \n", num_iter);
/* Print key statistics for the converged values. */
printf("\n");
printf("Reference: \n");
print_statistics(grid_1);
printf("Red-black: \n");
print_statistics(grid_2);
printf("Jacobi: \n");
print_statistics(grid_3);
/* Compute grid differences. */
compute_grid_differences(grid_1, grid_2, grid_3);
/* Free up the grid data structures. */
free((void *)grid_1->element);
free((void *)grid_1);
free((void *)grid_2->element);
free((void *)grid_2);
free((void *)grid_3->element);
free((void *)grid_3);
return 0;
}
示例4: print_detailed
static void print_detailed(const matstat_state_t *states, size_t nelem, unsigned int test_min, const stat_limits_t *limits)
{
if (LOG2_STATS) {
print_str(" interval count sum sum_sq min max mean variance\n");
for (unsigned int k = 0; k < nelem; ++k) {
char buf[20];
unsigned int num = (1 << k);
if (num >= TEST_NUM) {
break;
}
unsigned int start = num + test_min;
if (num == 1) {
/* special case, bitarithm_msb will return 0 for both 0 and 1 */
start = test_min;
}
print(buf, fmt_lpad(buf, fmt_u32_dec(buf, start), 4, ' '));
print_str(" - ");
print(buf, fmt_lpad(buf, fmt_u32_dec(buf, test_min + (num * 2) - 1), 4, ' '));
print_str(": ");
print_statistics(&states[k], limits);
}
print_str(" TOTAL ");
}
else {
print_str("interval count sum sum_sq min max mean variance\n");
for (unsigned int k = 0; k < nelem; ++k) {
char buf[10];
print(buf, fmt_lpad(buf, fmt_u32_dec(buf, k + test_min), 7, ' '));
print_str(": ");
print_statistics(&states[k], limits);
}
print_str(" TOTAL: ");
}
print_totals(states, nelem, limits);
}
示例5: segv_handler
/** Handler for SIGSEGV (segfault). */
void segv_handler(int sig, siginfo_t* info, void* c) {
uintptr_t extent = reinterpret_cast<uintptr_t>(cvc4StackBase) - cvc4StackSize;
uintptr_t addr = reinterpret_cast<uintptr_t>(info->si_addr);
#ifdef CVC4_DEBUG
safe_print(STDERR_FILENO, "CVC4 suffered a segfault in DEBUG mode.\n");
safe_print(STDERR_FILENO, "Offending address is ");
safe_print(STDERR_FILENO, info->si_addr);
safe_print(STDERR_FILENO, "\n");
//cerr << "base is " << (void*)cvc4StackBase << endl;
//cerr << "size is " << cvc4StackSize << endl;
//cerr << "extent is " << (void*)extent << endl;
if(addr >= extent && addr <= extent + 10*1024) {
safe_print(STDERR_FILENO,
"Looks like this is likely due to stack overflow.\n");
safe_print(STDERR_FILENO,
"You might consider increasing the limit with `ulimit -s' or "
"equivalent.\n");
} else if(addr < 10*1024) {
safe_print(STDERR_FILENO, "Looks like a NULL pointer was dereferenced.\n");
}
if(!segvSpin) {
print_statistics();
abort();
} else {
safe_print(STDERR_FILENO,
"Spinning so that a debugger can be connected.\n");
safe_print(STDERR_FILENO, "Try: gdb ");
safe_print(STDERR_FILENO, *progName);
safe_print(STDERR_FILENO, " ");
safe_print<int64_t>(STDERR_FILENO, getpid());
safe_print(STDERR_FILENO, "\n");
safe_print(STDERR_FILENO, " or: gdb --pid=");
safe_print<int64_t>(STDERR_FILENO, getpid());
safe_print(STDERR_FILENO, " ");
safe_print(STDERR_FILENO, *progName);
safe_print(STDERR_FILENO, "\n");
for(;;) {
sleep(60);
}
}
#else /* CVC4_DEBUG */
safe_print(STDERR_FILENO, "CVC4 suffered a segfault.\n");
safe_print(STDERR_FILENO, "Offending address is ");
safe_print(STDERR_FILENO, info->si_addr);
safe_print(STDERR_FILENO, "\n");
if(addr >= extent && addr <= extent + 10*1024) {
safe_print(STDERR_FILENO,
"Looks like this is likely due to stack overflow.\n");
safe_print(STDERR_FILENO,
"You might consider increasing the limit with `ulimit -s' or "
"equivalent.\n");
} else if(addr < 10*1024) {
safe_print(STDERR_FILENO, "Looks like a NULL pointer was dereferenced.\n");
}
print_statistics();
abort();
#endif /* CVC4_DEBUG */
}
示例6: lazy_supervised_classification
int lazy_supervised_classification() {
__START_TIMER__
CACHE.locked=0;
evaluation_t evaluator;
prediction_t prediction;
initialize_evaluation(&evaluator);
int n_tests=1;
list_t* test=TEST;
while(test) {
struct timeval s; gettimeofday(&s, NULL);
prediction=get_THE_prediction(test->instance, test->size, test->label);
struct timeval e; gettimeofday(&e, NULL);
long long tt=(e.tv_sec-s.tv_sec)*1000000+e.tv_usec-s.tv_usec;
printf("time: %d %lf\n", n_tests, tt/(double)1000000);
update_evaluation(&evaluator, prediction.label, test->label);
print_statistics(n_tests, test->label, test->id, prediction, evaluator);
n_tests++;
list_t* x=test->next;
free(test->instance);
free(test);
test=x;
}
printf("\n");
for(int i=0;i<MAX_CLASSES;i++) printf("CLASS(%d)= %d Prec= %f Rec= %f F1= %f ", i, evaluator.true_labels[i], evaluator.precision[i], evaluator.recall[i], evaluator.f1[i]);
printf("Acc= %f MF1= %f * hits= %ld misses= %ld\n", evaluator.acc, evaluator.mf1, CACHE.hits, CACHE.misses);
//finalize_evaluation(&evaluator);
__FINISH_TIMER__
return(0);
}
示例7: print_sysglobal
/*
* Print statistics in global pane.
*/
static void
print_sysglobal(void)
{
void *list;
char header[256];
if (!display_initialized) {
return;
}
(void) werase(sysglobal_window);
(void) wattron(sysglobal_window, A_REVERSE);
(void) snprintf(header, sizeof (header),
"%s", "System wide latencies");
fill_space_right(header, screen_width, sizeof (header));
(void) mvwprintw(sysglobal_window, 0, 0, "%s", header);
(void) wattroff(sysglobal_window, A_REVERSE);
list = lt_stat_list_create(current_list_type,
LT_LEVEL_GLOBAL, 0, 0, 10, sort_type);
print_statistics(sysglobal_window, 1, 10, list);
lt_stat_list_free(list);
(void) wrefresh(sysglobal_window);
}
示例8: clReleaseCommandQueue
cl_int clReleaseCommandQueue (cl_command_queue command_queue) {
#if ENABLE_KERNEL_PROFILING == 1
print_statistics(0);
#endif
#if ENABLE_LEAK_DETECTION == 1
if (IS_MPI_MASTER()) {
int i;
struct ld_program_s *ldprogram;
struct ld_kernel_s *ldkernel;
struct ld_mem_s *ldmem;
//struct ld_mem_offset_s *ldmem_offset;
#define CHECK_ALL_RELEASED(_NAME) \
FOR_ALL_MAP_ELTS(i, ld##_NAME, _NAME) { \
if (!ld##_NAME->released) { \
warning("Memory leak: " # _NAME \
" %p not released. (#%d) %d\n", \
ld##_NAME->handle, ld##_NAME->uid, ld##_NAME->released); \
} \
} \
CHECK_ALL_RELEASED(program);
CHECK_ALL_RELEASED(kernel);
CHECK_ALL_RELEASED(mem);
//CHECK_ALL_RELEASED(mem_offset);
}
#endif
return real_clReleaseCommandQueue (command_queue);
}
示例9: lazy_semisupervised_classification
int lazy_semisupervised_classification() {
__START_TIMER__
CACHE.locked=1;
evaluation_t evaluator;
prediction_t prediction;
initialize_evaluation(&evaluator);
int abstain=0, n_points=1, remaining_points=N_POINTS;
float min_level=MIN_LEVEL;
list_t* unlabeled=UNLABELED;
while(unlabeled) {
reset_rules();
prediction=get_THE_prediction(unlabeled->instance, unlabeled->size, unlabeled->label);
if(prediction.score.points[prediction.score.ordered_labels[0]]>min_level || prediction.score.points[prediction.score.ordered_labels[0]]/(float)prediction.score.points[prediction.score.ordered_labels[1]]>=FACTOR) {
update_evaluation(&evaluator, prediction.label, unlabeled->label);
print_statistics(n_points, unlabeled->label, unlabeled->id, prediction, evaluator);
N_TRANSACTIONS++;
COUNT_TARGET[prediction.label]++;
ITEMSETS[TARGET_ID[prediction.label]].list[ITEMSETS[TARGET_ID[prediction.label]].count]=N_TRANSACTIONS;
ITEMSETS[TARGET_ID[prediction.label]].count++;
for(int j=0;j<unlabeled->size;j++) {
ITEMSETS[unlabeled->instance[j]].list[ITEMSETS[unlabeled->instance[j]].count]=N_TRANSACTIONS;
ITEMSETS[unlabeled->instance[j]].count++;
}
n_points++;
remaining_points--;
abstain=0;
list_t* x=unlabeled->next;
free(unlabeled->instance);
free(unlabeled);
unlabeled=x;
UNLABELED=unlabeled;
}
else if(abstain<remaining_points) {
printf("abstaining %d %d %f %f %f\n", abstain, remaining_points, min_level, prediction.score.points[prediction.score.ordered_labels[0]]/(float)prediction.score.points[prediction.score.ordered_labels[1]], avg_size);
abstain++;
list_t* q=UNLABELED;
while(q->next!=NULL) q=q->next;
list_t* t=(list_t*)malloc(sizeof(list_t));
t->instance=(int*)malloc(sizeof(int)*unlabeled->size);
t->size=0;
for(int i=0;i<unlabeled->size;i++) t->instance[t->size++]=unlabeled->instance[i];
t->label=unlabeled->label;
t->next=NULL;
q->next=t;
list_t* x=unlabeled->next;
free(unlabeled->instance);
free(unlabeled);
unlabeled=x;
UNLABELED=unlabeled;
}
else break;
}
printf("\n");
for(int i=0;i<MAX_CLASSES;i++) printf("CLASS(%d)= %d Prec= %f Rec= %f F1= %f ", i, evaluator.true_labels[i], evaluator.precision[i], evaluator.recall[i], evaluator.f1[i]);
printf("Acc= %f MF1= %f * hits= %ld misses= %ld\n", evaluator.acc, evaluator.mf1, CACHE.hits, CACHE.misses);
//finalize_evaluation(&evaluator);
__FINISH_TIMER__
return(0);
}
示例10: print_thread
/*
* Print per-thread statistics in process pane.
* This is called when mode of operation is thread.
*/
static void
print_thread(pid_t pid, id_t tid)
{
void *list;
char header[256];
char tmp[30];
if (!display_initialized) {
return;
}
list = lt_stat_list_create(current_list_type, LT_LEVEL_THREAD,
pid, tid, 8, sort_type);
(void) werase(process_window);
(void) wattron(process_window, A_REVERSE);
(void) snprintf(header, sizeof (header),
"Process %s (%i), LWP %d",
lt_stat_proc_get_name(pid), pid, tid);
fill_space_right(header, screen_width, sizeof (header));
(void) mvwprintw(process_window, 0, 0, "%s", header);
if (current_list_type != LT_LIST_SPECIALS) {
(void) mvwprintw(process_window, 0, 48, "Total: %s",
get_time_string(
(double)lt_stat_list_get_gtotal(list),
tmp, sizeof (tmp), 12));
}
print_current_mode();
(void) wattroff(process_window, A_REVERSE);
print_statistics(process_window, 1, 8, list);
lt_stat_list_free(list);
(void) wrefresh(process_window);
}
示例11: main
/**
* Ask for 20 numbers in a loop. When 20 valid numbers are entered, calculate
* the average and report out the largest, smallest and average numbers.
*
* Control the loop by controlling the counter alone, letting the loop worry
* about itself.
*/
int main()
{
int i = 1, quantity = 20;
double number = 0, running_sum = 0, largest_number = 0, smallest_number = 0;
print_greeting(quantity);
for (i = 1; i <= quantity; i += 1)
{
printf("Enter number %d: ", i);
if (scanf("%lf", &number))
{
running_sum += number;
smallest_number = compute_smallest_number(number, smallest_number, i);
largest_number = compute_largest_number(number, largest_number);
}
else
{
printf("Please only enter numbers! Let's try again...\n");
i -= 1;
number = 0.00;
}
clear_buffer();
}
print_statistics(running_sum, quantity, smallest_number, largest_number);
return 0;
}
示例12: ping
void ping(int signal)
{
int ret;
struct in_addr from;
float rtt;
cmd.args.ping.ip_addr = addr.s_addr;
sent++;
ret = ioctl(f, IOC_RT_PING, &cmd);
if (ret < 0) {
if (errno == ETIME)
goto done;
perror("ioctl");
exit(1);
}
received++;
from.s_addr = cmd.args.ping.ip_addr;
rtt = (float)cmd.args.ping.rtt / (float)1000;
if (rtt > wc_rtt)
wc_rtt = rtt;
printf("%d bytes from %s: icmp_seq=%d time=%.1f us\n",
ret, inet_ntoa(from), cmd.args.ping.sequence, rtt);
done:
if (cmd.args.ping.sequence++ == count)
print_statistics();
}
示例13: execute
virtual void execute(cmd_context& ctx) {
if (m_target == 0) {
throw cmd_exception("invalid query command, argument expected");
}
datalog::context& dlctx = m_dl_ctx->get_dl_context();
set_background(ctx);
dlctx.updt_params(m_params);
unsigned timeout = m_params.get_uint(":timeout", UINT_MAX);
cancel_eh<datalog::context> eh(dlctx);
lbool status = l_undef;
{
scoped_ctrl_c ctrlc(eh);
scoped_timer timer(timeout, &eh);
cmd_context::scoped_watch sw(ctx);
try {
status = dlctx.query(m_target);
}
catch (z3_error & ex) {
throw ex;
}
catch (z3_exception& ex) {
ctx.regular_stream() << "(error \"query failed: " << ex.msg() << "\")" << std::endl;
}
dlctx.cleanup();
}
switch (status) {
case l_false:
ctx.regular_stream() << "unsat\n";
print_certificate(ctx);
break;
case l_true:
ctx.regular_stream() << "sat\n";
print_answer(ctx);
print_certificate(ctx);
break;
case l_undef:
ctx.regular_stream() << "unknown\n";
switch(dlctx.get_status()) {
case datalog::INPUT_ERROR:
break;
case datalog::MEMOUT:
ctx.regular_stream() << "memory bounds exceeded\n";
break;
case datalog::TIMEOUT:
ctx.regular_stream() << "timeout\n";
break;
case datalog::OK:
break;
default:
UNREACHABLE();
}
break;
}
print_statistics(ctx);
m_target = 0;
}
示例14: statistics_connected_layer
void statistics_connected_layer(layer l)
{
if(l.batch_normalize){
printf("Scales ");
print_statistics(l.scales, l.outputs);
/*
printf("Rolling Mean ");
print_statistics(l.rolling_mean, l.outputs);
printf("Rolling Variance ");
print_statistics(l.rolling_variance, l.outputs);
*/
}
printf("Biases ");
print_statistics(l.biases, l.outputs);
printf("Weights ");
print_statistics(l.weights, l.outputs);
}
示例15: print_statistics
void print_statistics( const std::string& filename, const circuit& circ, double runtime, const print_statistics_settings& settings )
{
std::filebuf fb;
fb.open( filename.c_str(), std::ios::out );
std::ostream os( &fb );
print_statistics( os, circ, runtime, settings );
fb.close();
}