void get_statistics(CTXTdecl) { int type; type = 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; // tds.time_count = incr_cpu - time_start; // reset_stat_total(); /* reset 'ttt' struct variable (all 0's) */ 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 statistics_inusememory(CTXTc type); #else xsb_abort("statistics/2 with parameter shared_tables not supported in this configuration\n"); #endif break; } default: { statistics_inusememory(CTXTc type); break; } } }
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; } } }