Z3_stats Z3_API Z3_solver_get_statistics(Z3_context c, Z3_solver s) { Z3_TRY; LOG_Z3_solver_get_statistics(c, s); RESET_ERROR_CODE(); init_solver(c, s); Z3_stats_ref * st = alloc(Z3_stats_ref, *mk_c(c)); to_solver_ref(s)->collect_statistics(st->m_stats); get_memory_statistics(st->m_stats); get_rlimit_statistics(mk_c(c)->m().limit(), st->m_stats); mk_c(c)->save_object(st); Z3_stats r = of_stats(st); RETURN_Z3(r); Z3_CATCH_RETURN(nullptr); }
void get_statistics(CTXTdecl) { int type; type = (int)ptoc_int(CTXTc 3); switch (type) { // runtime [since start of Prolog,since previous statistics] // CPU time used while executing, excluding time spent // garbage collecting, stack shifting, or in system calls. case RUNTIME: { double tot_cpu, incr_cpu; tot_cpu = cpu_time(); incr_cpu = tot_cpu - last_cpu; last_cpu = tot_cpu; ctop_float(CTXTc 4, tot_cpu); ctop_float(CTXTc 5, incr_cpu); break; } case WALLTIME: { double tot_wall,this_wall,incr_wall; this_wall = real_time(); tot_wall = this_wall - realtime_count_gl; if (!last_wall) last_wall = realtime_count_gl; incr_wall = this_wall - last_wall; last_wall = this_wall; ctop_float(CTXTc 4, tot_wall); ctop_float(CTXTc 5, incr_wall); break; } case SHARED_TABLESPACE: { #ifdef MULTI_THREAD get_memory_statistics(CTXTc type); #else xsb_abort("statistics/2 with parameter shared_tables not supported in this configuration\n"); #endif break; } case IDG_COUNTS: { ctop_int(CTXTc 4,current_call_node_count_gl); ctop_int(CTXTc 5,current_call_edge_count_gl); break; } case TABLE_OPS: { UInteger ttl_ops = ans_chk_ins + NumSubOps_AnswerCheckInsert, ttl_ins = ans_inserts + NumSubOps_AnswerInsert; ctop_int(CTXTc 4,NumSubOps_CallCheckInsert); ctop_int(CTXTc 5,NumSubOps_ProducerCall); ctop_int(CTXTc 6,var_subg_chk_ins_gl); ctop_int(CTXTc 7,var_subg_inserts_gl); ctop_int(CTXTc 8,ttl_ops); ctop_int(CTXTc 9,ttl_ins); } default: { get_memory_statistics(CTXTc type); break; } } }