void print_NodeStats(NodeStats node,char * nodeName) { printf(" %s (%"UIntfmt" blocks)\n" " Allocated: %10"UIntfmt" (%8"UIntfmt" bytes)\n" " Used: %10"UIntfmt" (%8"UIntfmt" bytes)\n" " Free: %10"UIntfmt" (%8"UIntfmt" bytes)\n", nodeName,NodeStats_NumBlocks(node), NodeStats_NumAllocNodes(node), NodeStats_SizeAllocNodes(node), NodeStats_NumUsedNodes(node), NodeStats_SizeUsedNodes(node), NodeStats_NumFreeNodes(node), NodeStats_SizeFreeNodes(node)); }
void print_detailed_tablespace_stats(CTXTdecl) { NodeStats abtn, /* Asserted Basic Trie Nodes */ btn, /* Basic Trie Nodes */ aln, /* Answer List Nodes */ varsf, /* Variant Subgoal Frames */ asi; /* Answer Subgoal Information */ HashStats abtht, /* Asserted Basic Trie Hash Tables */ btht; /* Basic Trie Hash Tables */ NodeStats pri_tstn, /* Private Time Stamp Trie Nodes */ pri_tsi, /* Private Time Stamp Indices (Index Entries/Nodes) */ pri_prodsf, /* Private Subsumptive Producer Subgoal Frames */ pri_conssf, /* Private Subsumptive Consumer Subgoal Frames */ pri_btn, /* Private Basic Trie Nodes (Tables) */ pri_assert_btn, /* Private Basic Trie Nodes (Asserts) */ pri_aln, /* Private Answer List Nodes */ pri_varsf, /* Private Variant Subgoal Frames */ pri_asi; /* Private Answer Subgoal Information */ HashStats pri_btht, /* Private Basic Trie Hash Tables (Tables) */ pri_assert_btht, /* Private Basic Trie Hash Tables (Asserts) */ pri_tstht; /* Private Time Stamp Trie Hash Tables */ size_t tablespace_alloc, tablespace_used, pri_tablespace_alloc, pri_tablespace_used, shared_tablespace_alloc, shared_tablespace_used, trieassert_alloc, trieassert_used, de_space_alloc, de_space_used, dl_space_alloc, dl_space_used, pnde_space_alloc, pnde_space_used, pri_de_space_alloc, pri_de_space_used, pri_dl_space_alloc, pri_dl_space_used, pri_pnde_space_alloc, pri_pnde_space_used; size_t num_de_blocks, num_dl_blocks, num_pnde_blocks; size_t pri_num_de_blocks, pri_num_dl_blocks, pri_num_pnde_blocks; SM_Lock(smTableBTN); btn = node_statistics(&smTableBTN); SM_Unlock(smTableBTN); SM_Lock(smTableBTHT); btht = hash_statistics(CTXTc &smTableBTHT); SM_Unlock(smTableBTHT); SM_Lock(smVarSF); varsf = subgoal_statistics(CTXTc &smVarSF); SM_Unlock(smVarSF); SM_Lock(smALN); aln = node_statistics(&smALN); SM_Unlock(smALN); SM_Lock(smASI); asi = node_statistics(&smASI); SM_Unlock(smASI); SYS_MUTEX_LOCK( MUTEX_DELAY ); de_space_alloc = allocated_de_space(current_de_block_gl,&num_de_blocks); de_space_used = de_space_alloc - unused_de_space(); dl_space_alloc = allocated_dl_space(current_dl_block_gl,&num_dl_blocks); dl_space_used = dl_space_alloc - unused_dl_space(); pnde_space_alloc = allocated_pnde_space(current_pnde_block_gl,&num_pnde_blocks); pnde_space_used = pnde_space_alloc - unused_pnde_space(); SYS_MUTEX_UNLOCK( MUTEX_DELAY ); pri_btn = node_statistics(private_smTableBTN); pri_btht = hash_statistics(CTXTc private_smTableBTHT); pri_assert_btn = node_statistics(private_smAssertBTN); pri_assert_btht = hash_statistics(CTXTc private_smAssertBTHT); pri_aln = node_statistics(private_smALN); pri_asi = node_statistics(private_smASI); pri_varsf = subgoal_statistics(CTXTc private_smVarSF); pri_prodsf = subgoal_statistics(CTXTc private_smProdSF); pri_conssf = subgoal_statistics(CTXTc private_smConsSF); pri_tstn = node_statistics(private_smTSTN); pri_tsi = node_statistics(private_smTSIN); pri_btht = hash_statistics(CTXTc private_smTableBTHT); pri_tstht = hash_statistics(CTXTc private_smTSTHT); pri_de_space_alloc = allocated_de_space(private_current_de_block,&pri_num_de_blocks); pri_de_space_used = pri_de_space_alloc - unused_de_space_private(CTXT); pri_dl_space_alloc = allocated_dl_space(private_current_dl_block,&pri_num_dl_blocks); pri_dl_space_used = pri_dl_space_alloc - unused_dl_space_private(CTXT); pri_pnde_space_alloc = allocated_pnde_space(private_current_pnde_block,&pri_num_pnde_blocks); pri_pnde_space_used = pri_pnde_space_alloc - unused_pnde_space_private(CTXT); pri_tablespace_alloc = CurrentPrivateTableSpaceAlloc(pri_btn,pri_btht,pri_varsf,pri_prodsf, pri_conssf,pri_aln,pri_tstn,pri_tstht,pri_tsi, pri_asi); pri_tablespace_used = CurrentPrivateTableSpaceUsed(pri_btn,pri_btht,pri_varsf,pri_prodsf, pri_conssf,pri_aln,pri_tstn,pri_tstht,pri_tsi, pri_asi); pri_tablespace_alloc = pri_tablespace_alloc + pri_de_space_alloc + pri_dl_space_alloc + pri_pnde_space_alloc; pri_tablespace_used = pri_tablespace_used + pri_de_space_used + pri_dl_space_used + pri_pnde_space_used; shared_tablespace_alloc = CurrentSharedTableSpaceAlloc(btn,btht,varsf,aln,asi); shared_tablespace_used = CurrentSharedTableSpaceUsed(btn,btht,varsf,aln,asi); shared_tablespace_alloc = shared_tablespace_alloc + de_space_alloc + dl_space_alloc + pnde_space_alloc; shared_tablespace_used = shared_tablespace_used + de_space_used + dl_space_used + pnde_space_used; tablespace_alloc = shared_tablespace_alloc + pri_tablespace_alloc; tablespace_used = shared_tablespace_used + pri_tablespace_used; abtn = node_statistics(&smAssertBTN); abtht = hash_statistics(CTXTc &smAssertBTHT); trieassert_alloc = NodeStats_SizeAllocNodes(abtn) + HashStats_SizeAllocTotal(abtht); trieassert_used = NodeStats_SizeUsedNodes(abtn) + HashStats_SizeUsedTotal(abtht); SQUASH_LINUX_COMPILER_WARN(trieassert_used) ; printf(" Current Total Allocation: %12"UIntfmt" bytes\n" " Current Total Usage: %12"UIntfmt" bytes\n", pspacesize[TABLE_SPACE]-trieassert_alloc, pspacesize[TABLE_SPACE]-trieassert_alloc-(tablespace_alloc-tablespace_used)); // printf("\n --------------------- Shared tables ---------------------\n"); printf("\n" "Shared Table Space Usage (exc"UIntfmt"ding asserted and interned tries) \n"); printf(" Current Total Allocation: %12"UIntfmt" bytes\n" " Current Total Usage: %12"UIntfmt" bytes\n", shared_tablespace_alloc,shared_tablespace_used); // Basic Trie Stuff if ( NodeStats_NumBlocks(btn) > 0 || HashStats_NumBlocks(btht) > 0 || NodeStats_NumBlocks(aln) > 0) { printf("\n" " Basic Tries\n"); if ( NodeStats_NumBlocks(btn) > 0) print_NodeStats(btn,"Basic Trie Nodes"); if (HashStats_NumBlocks(btht) > 0) print_HashStats(btht,"Basic Trie Hash Tables"); if ( NodeStats_NumBlocks(aln) > 0) print_NodeStats(aln,"Answer List Nodes (for Incomplete Variant Tables)"); } // Subgoal Frames if (NodeStats_NumBlocks(varsf) > 0) { printf("\n" " Subgoal Frames\n"); if (NodeStats_NumBlocks(varsf) > 0) print_NodeStats(varsf,"Variant Subgoal Frames"); } // Conditional Answers if (dl_space_alloc > 0 || de_space_alloc > 0 || pnde_space_alloc > 0 || NodeStats_NumBlocks(asi) > 0) { printf("\n" " Information for Conditional Answers in Variant Tables \n"); if (dl_space_alloc > 0) print_wfs_usage(dl_space_alloc,dl_space_used,num_dl_blocks,DLS_PER_BLOCK, sizeof(struct delay_list),"Delay Lists"); if (de_space_alloc > 0) print_wfs_usage(de_space_alloc,de_space_used,num_de_blocks,DES_PER_BLOCK, sizeof(struct delay_element),"Delay Elements"); if (pnde_space_alloc > 0) print_wfs_usage(pnde_space_alloc,pnde_space_used,num_pnde_blocks,PNDES_PER_BLOCK, sizeof(struct pos_neg_de_list),"Back-pointer Lists"); if ( NodeStats_NumBlocks(asi) > 0) print_NodeStats(asi,"Answer Substitution Frames"); } // Private trie assert space if ( NodeStats_NumBlocks(abtn) > 0 || HashStats_NumBlocks(abtht) > 0) { printf("\n ---------------- Shared Asserted and Interned Tries ----------------\n"); if ( NodeStats_NumBlocks(abtn) > 0) print_NodeStats(abtn,"Basic Trie Nodes (Assert)"); if (HashStats_NumBlocks(abtht) > 0) print_HashStats(abtht,"Basic Trie Hash Tables (Assert)"); } printf("\n --------------------- Private tables ---------------------\n"); printf("\n" "Private Table Space Usage for Thread %"Intfmt" (exc"UIntfmt"ding asserted and interned tries) \n" " Current Total Allocation: %12"UIntfmt" bytes\n" " Current Total Usage: %12"UIntfmt" bytes\n", xsb_thread_id,pri_tablespace_alloc,pri_tablespace_used); // Basic Trie Stuff if ( NodeStats_NumBlocks(pri_btn) > 0 || HashStats_NumBlocks(pri_btht) > 0 || NodeStats_NumBlocks(pri_aln) > 0) { printf("\n" " Basic Tries\n"); if ( NodeStats_NumBlocks(pri_btn) > 0) print_NodeStats(pri_btn,"Basic Trie Nodes"); if (HashStats_NumBlocks(pri_btht) > 0) print_HashStats(pri_btht,"Basic Trie Hash Tables"); if ( NodeStats_NumBlocks(pri_aln) > 0) print_NodeStats(pri_aln,"Answer List Nodes (for Incomplete Variant Tables)"); } // Subgoal Frames if (NodeStats_NumBlocks(pri_varsf) > 0 || NodeStats_NumBlocks(pri_prodsf) > 0 || NodeStats_NumBlocks(pri_conssf) > 0) { printf("\n" " Subgoal Frames\n"); if (NodeStats_NumBlocks(pri_varsf) > 0) print_NodeStats(pri_varsf,"Variant Subgoal Frames"); if (NodeStats_NumBlocks(pri_prodsf) > 0) print_NodeStats(pri_prodsf,"Producer Subgoal Frames"); if (NodeStats_NumBlocks(pri_conssf) > 0) print_NodeStats(pri_conssf,"Consumer Subgoal Frames"); } // Subsumptive Tables if ( NodeStats_NumBlocks(pri_tstn) > 0 || HashStats_NumBlocks(pri_tstht) > 0 || NodeStats_NumBlocks(pri_tsi) > 0) { printf("\n" " Time Stamp Tries (for Subsumptive Tables) \n"); if (NodeStats_NumBlocks(pri_tstn) > 0) print_NodeStats(pri_tstn,"Time Stamp Trie Nodes"); if (HashStats_NumBlocks(pri_tstht) > 0) print_HashStats(pri_tstht,"Time Stamp Trie Hash Tables"); if (NodeStats_NumBlocks(pri_tsi) > 0) print_NodeStats(pri_tsi,"Time Stamp Trie Index Nodes"); } // Conditional Answers if (pri_dl_space_alloc > 0 || pri_de_space_alloc > 0 || pri_pnde_space_alloc > 0 || NodeStats_NumBlocks(pri_asi) > 0) { printf("\n" " Information for Conditional Answers in Variant Tables \n"); if (pri_dl_space_alloc > 0) print_wfs_usage(pri_dl_space_alloc,pri_dl_space_used,pri_num_dl_blocks,DLS_PER_BLOCK, sizeof(struct delay_list),"Delay Lists"); if (pri_de_space_alloc > 0) print_wfs_usage(pri_de_space_alloc,pri_de_space_used,pri_num_de_blocks,DES_PER_BLOCK, sizeof(struct delay_element),"Delay Elements"); if (pri_pnde_space_alloc > 0) print_wfs_usage(pri_pnde_space_alloc,pri_pnde_space_used,pri_num_pnde_blocks,PNDES_PER_BLOCK, sizeof(struct pos_neg_de_list),"Back-pointer Lists"); if ( NodeStats_NumBlocks(pri_asi) > 0) print_NodeStats(pri_asi,"Answer Substitution Frames"); } // Private trie assert space if ( NodeStats_NumBlocks(pri_assert_btn) > 0 || HashStats_NumBlocks(pri_assert_btht) > 0) { printf("\n ---------------- Private Asserted and Interned Tries ----------------\n"); if ( NodeStats_NumBlocks(pri_assert_btn) > 0) print_NodeStats(pri_assert_btn,"Basic Trie Nodes (Assert)"); if (HashStats_NumBlocks(pri_assert_btht) > 0) print_HashStats(pri_assert_btht,"Basic Trie Hash Tables (Assert)"); } printf("\n"); }
void print_detailed_tablespace_stats(CTXTdecl) { NodeStats abtn, /* Asserted Basic Trie Nodes */ btn, /* Basic Trie Nodes */ tstn, /* Time Stamp Trie Nodes */ aln, /* Answer List Nodes */ tsi, /* Time Stamp Indices (Index Entries/Nodes) */ varsf, /* Variant Subgoal Frames */ prodsf, /* Subsumptive Producer Subgoal Frames */ conssf, /* Subsumptive Consumer Subgoal Frames */ asi; /* Answer Subst. Info (for conditional answers) */ HashStats abtht, /* Asserted Basic Trie Hash Tables */ btht, /* Basic Trie Hash Tables */ tstht; /* Time Stamp Trie Hash Tables */ size_t trieassert_alloc, trieassert_used, tablespace_alloc, tablespace_used, de_space_alloc, de_space_used, dl_space_alloc, dl_space_used, pnde_space_alloc, pnde_space_used; size_t num_de_blocks, num_dl_blocks, num_pnde_blocks; btn = node_statistics(&smTableBTN); btht = hash_statistics(CTXTc &smTableBTHT); varsf = subgoal_statistics(CTXTc &smVarSF); prodsf = subgoal_statistics(CTXTc &smProdSF); conssf = subgoal_statistics(CTXTc &smConsSF); aln = node_statistics(&smALN); tstn = node_statistics(&smTSTN); tstht = hash_statistics(CTXTc &smTSTHT); tsi = node_statistics(&smTSIN); tsi = node_statistics(&smTSIN); asi = node_statistics(&smASI); de_space_alloc = allocated_de_space(current_de_block_gl,&num_de_blocks); de_space_used = de_space_alloc - unused_de_space(); dl_space_alloc = allocated_dl_space(current_dl_block_gl,& num_dl_blocks); dl_space_used = dl_space_alloc - unused_dl_space(); pnde_space_alloc = allocated_pnde_space(current_pnde_block_gl,&num_pnde_blocks); pnde_space_used = pnde_space_alloc - unused_pnde_space(); tablespace_alloc = CurrentTotalTableSpaceAlloc(btn,btht,varsf,prodsf,conssf,aln, tstn,tstht,tsi,asi); tablespace_used = CurrentTotalTableSpaceUsed(btn,btht,varsf,prodsf,conssf,aln, tstn,tstht,tsi,asi); tablespace_alloc = tablespace_alloc + de_space_alloc + dl_space_alloc + pnde_space_alloc; tablespace_used = tablespace_used + de_space_used + dl_space_used + pnde_space_used; abtn = node_statistics(&smAssertBTN); abtht = hash_statistics(CTXTc &smAssertBTHT); trieassert_alloc = NodeStats_SizeAllocNodes(abtn) + HashStats_SizeAllocTotal(abtht); trieassert_used = NodeStats_SizeUsedNodes(abtn) + HashStats_SizeUsedTotal(abtht); SQUASH_LINUX_COMPILER_WARN(trieassert_used) ; printf("\n" "Table Space Usage (excluding asserted and interned tries) \n"); printf(" Current Total Allocation: %12" UIntfmt" bytes\n" " Current Total Usage: %12" UIntfmt" bytes\n", (UInteger) (pspacesize[TABLE_SPACE]-trieassert_alloc), (UInteger) (pspacesize[TABLE_SPACE]-trieassert_alloc-(tablespace_alloc-tablespace_used))); // Basic Trie Stuff if ( NodeStats_NumBlocks(btn) > 0 || HashStats_NumBlocks(btht) > 0 || NodeStats_NumBlocks(aln) > 0) { printf("\n" " Basic Tries\n"); if ( NodeStats_NumBlocks(btn) > 0) print_NodeStats(btn,"Basic Trie Nodes"); if (HashStats_NumBlocks(btht) > 0) print_HashStats(btht,"Basic Trie Hash Tables"); if ( NodeStats_NumBlocks(aln) > 0) print_NodeStats(aln,"Answer List Nodes (for Incomplete Variant Tables)"); } // Subgoal Frames if (NodeStats_NumBlocks(varsf) > 0 || NodeStats_NumBlocks(prodsf) > 0 || NodeStats_NumBlocks(conssf) > 0) { printf("\n" " Subgoal Frames\n"); if (NodeStats_NumBlocks(varsf) > 0) print_NodeStats(varsf,"Variant Subgoal Frames"); if (NodeStats_NumBlocks(prodsf) > 0) print_NodeStats(prodsf,"Producer Subgoal Frames"); if (NodeStats_NumBlocks(conssf) > 0) print_NodeStats(conssf,"Consumer Subgoal Frames"); } // Subsumptive Tables if (NodeStats_NumBlocks(tstn) > 0 || NodeStats_NumBlocks(tsi) > 0 || HashStats_NumBlocks(tstht) > 0) { printf("\n" " Time Stamp Tries (for Subsumptive Tables) \n"); if (NodeStats_NumBlocks(tstn) > 0) print_NodeStats(tstn,"Time Stamp Trie Nodes"); if (HashStats_NumBlocks(tstht) > 0) print_HashStats(tstht,"Time Stamp Trie Hash Tables"); if (NodeStats_NumBlocks(tsi) > 0) print_NodeStats(tsi,"Time Stamp Trie Index Nodes"); } // Conditional Answers if (dl_space_alloc > 0 || de_space_alloc > 0 || pnde_space_alloc > 0 || NodeStats_NumBlocks(asi) > 0) { printf("\n" " Information for Conditional Answers in Variant Tables \n"); if (dl_space_alloc > 0) print_wfs_usage(dl_space_alloc,dl_space_used,num_dl_blocks,DLS_PER_BLOCK, sizeof(struct delay_list),"Delay Lists"); if (de_space_alloc > 0) print_wfs_usage(de_space_alloc,de_space_used,num_de_blocks,DES_PER_BLOCK, sizeof(struct delay_element),"Delay Elements"); if (pnde_space_alloc > 0) print_wfs_usage(pnde_space_alloc,pnde_space_used,num_pnde_blocks,PNDES_PER_BLOCK, sizeof(struct pos_neg_de_list),"Back-pointer Lists"); if ( NodeStats_NumBlocks(asi) > 0) print_NodeStats(asi,"Answer Substitution Frames"); } if (total_call_node_count_gl) { printf("\nTotal number of incremental subgoals created: %d\n",total_call_node_count_gl); printf(" Current number of incremental call nodesd: %d\n",current_call_node_count_gl); printf(" Total number of incremental call edges created: %d\n",current_call_edge_count_gl); } // Private trie assert space if ( NodeStats_NumBlocks(abtn) > 0 || HashStats_NumBlocks(abtht) > 0) { printf("\n ------------------ Asserted and Interned Tries ----------------\n"); if ( NodeStats_NumBlocks(abtn) > 0) print_NodeStats(abtn,"Basic Trie Nodes (Assert)"); if (HashStats_NumBlocks(abtht) > 0) print_HashStats(abtht,"Basic Trie Hash Tables (Assert)"); } if (flags[MAX_USAGE]) { /* Report Maximum Usages --------------------- */ update_maximum_tablespace_stats(&btn,&btht,&varsf,&prodsf,&conssf, &aln,&tstn,&tstht,&tsi,&asi); printf("\n" "Maximum Total Usage: %12"UIntfmt" bytes\n", maximum_total_tablespace_usage()); printf("Maximum Structure Usage:\n" " ALNs: %10"UIntfmt" (%8"UIntfmt" bytes)\n" " TSINs: %10"UIntfmt" (%8"UIntfmt" bytes)\n", maximum_answer_list_nodes(), maximum_answer_list_nodes() * NodeStats_NodeSize(aln), maximum_timestamp_index_nodes(), maximum_timestamp_index_nodes() * NodeStats_NodeSize(tsi)); } printf("\n"); }
void get_memory_statistics_1(CTXTdeclc double elapstime, int type) { COMMON_MEMSTAT_DECLS; NodeStats pri_tbtn, /* Table Basic Trie Nodes */ pri_tstn, /* Time Stamp Trie Nodes */ pri_aln, /* Answer List Nodes */ pri_asi, /* Answer Subst Info for conditional answers */ pri_tsi, /* Time Stamp Indices (Index Entries/Nodes) */ pri_varsf, /* Variant Subgoal Frames */ pri_prodsf, /* Subsumptive Producer Subgoal Frames */ pri_conssf; /* Subsumptive Consumer Subgoal Frames */ HashStats tbtht, /* Table Basic Trie Hash Tables */ abtht, /* Asserted Basic Trie Hash Tables */ pri_tbtht, /* Table Basic Trie Hash Tables */ pri_tstht; /* Time Stamp Trie Hash Tables */ size_t total_alloc, total_used, tablespace_sm_alloc, tablespace_sm_used, private_tablespace_sm_alloc, private_tablespace_sm_used, shared_tablespace_sm_alloc, shared_tablespace_sm_used, trieassert_alloc, trieassert_used, gl_avail, tc_avail, de_space_alloc, de_space_used, dl_space_alloc, dl_space_used, pnde_space_alloc, pnde_space_used, private_de_space_alloc, private_de_space_used, private_dl_space_alloc, private_dl_space_used, private_pnde_space_alloc, private_pnde_space_used, pspacetot; size_t num_de_blocks, num_dl_blocks, num_pnde_blocks, de_count, dl_count, private_de_count, private_dl_count, i; tbtn = node_statistics(&smTableBTN); tbtht = hash_statistics(CTXTc &smTableBTHT); varsf = subgoal_statistics(CTXTc &smVarSF); aln = node_statistics(&smALN); asi = node_statistics(&smASI); pri_tbtn = node_statistics(&smTableBTN); pri_tbtht = hash_statistics(CTXTc &smTableBTHT); pri_varsf = subgoal_statistics(CTXTc &smVarSF); pri_aln = node_statistics(&smALN); pri_asi = node_statistics(&smASI); pri_prodsf = subgoal_statistics(CTXTc &smProdSF); pri_conssf = subgoal_statistics(CTXTc &smConsSF); pri_tstn = node_statistics(&smTSTN); pri_tstht = hash_statistics(CTXTc &smTSTHT); pri_tsi = node_statistics(&smTSIN); private_tablespace_sm_alloc = CurrentPrivateTableSpaceAlloc(pri_tbtn,pri_tbtht,pri_varsf, pri_prodsf, pri_conssf,pri_aln,pri_tstn,pri_tstht,pri_tsi,pri_asi); private_tablespace_sm_used = CurrentPrivateTableSpaceUsed(pri_tbtn,pri_tbtht,pri_varsf, pri_prodsf, pri_conssf,pri_aln,pri_tstn,pri_tstht,pri_tsi,pri_asi); shared_tablespace_sm_alloc = CurrentSharedTableSpaceAlloc(tbtn,tbtht,varsf,aln,asi); shared_tablespace_sm_used = CurrentSharedTableSpaceUsed(tbtn,tbtht,varsf,aln,asi); tablespace_sm_alloc = shared_tablespace_sm_alloc + private_tablespace_sm_alloc; tablespace_sm_used = shared_tablespace_sm_used + private_tablespace_sm_used; de_space_alloc = allocated_de_space(current_de_block_gl,&num_de_blocks); de_space_used = de_space_alloc - unused_de_space(); de_count = (de_space_used - num_de_blocks * sizeof(Cell)) / sizeof(struct delay_element); dl_space_alloc = allocated_dl_space(current_dl_block_gl,&num_dl_blocks); dl_space_used = dl_space_alloc - unused_dl_space(); dl_count = (dl_space_used - num_dl_blocks * sizeof(Cell)) / sizeof(struct delay_list); pnde_space_alloc = allocated_pnde_space(current_pnde_block_gl,&num_pnde_blocks); pnde_space_used = pnde_space_alloc - unused_pnde_space(); private_de_space_alloc = allocated_de_space(private_current_de_block,&num_de_blocks); private_de_space_used = private_de_space_alloc - unused_de_space_private(CTXT); private_de_count = (private_de_space_used - num_de_blocks * sizeof(Cell)) / sizeof(struct delay_element); private_dl_space_alloc = allocated_dl_space(private_current_dl_block,&num_dl_blocks); private_dl_space_used = private_dl_space_alloc - unused_dl_space_private(CTXT); private_dl_count = (private_dl_space_used - num_dl_blocks * sizeof(Cell)) / sizeof(struct delay_list); private_pnde_space_alloc = allocated_pnde_space(private_current_pnde_block,&num_pnde_blocks); private_pnde_space_used = private_pnde_space_alloc - unused_pnde_space_private(CTXT); tablespace_sm_alloc = tablespace_sm_alloc + de_space_alloc + dl_space_alloc + pnde_space_alloc; tablespace_sm_used = tablespace_sm_used + de_space_used + dl_space_used + pnde_space_alloc; shared_tablespace_sm_alloc = shared_tablespace_sm_alloc + de_space_alloc + dl_space_alloc + pnde_space_alloc; shared_tablespace_sm_used = shared_tablespace_sm_used + de_space_used + dl_space_used + pnde_space_used; private_tablespace_sm_alloc = private_tablespace_sm_alloc + private_de_space_alloc + private_dl_space_alloc + private_pnde_space_alloc; private_tablespace_sm_used = private_tablespace_sm_used + private_de_space_used + private_dl_space_used + private_pnde_space_used; abtn = node_statistics(&smAssertBTN); abtht = hash_statistics(CTXTc &smAssertBTHT); trieassert_alloc = NodeStats_SizeAllocNodes(abtn) + HashStats_SizeAllocTotal(abtht); trieassert_used = NodeStats_SizeUsedNodes(abtn) + HashStats_SizeUsedTotal(abtht); gl_avail = (top_of_localstk - top_of_heap - 1) * sizeof(Cell); tc_avail = (top_of_cpstack - (CPtr)top_of_trail - 1) * sizeof(Cell); pspacetot = 0; for (i=0; i<NUM_CATS_SPACE; i++) if (i != TABLE_SPACE && i != INCR_TABLE_SPACE) pspacetot += pspacesize[i]; total_alloc = pspacetot + pspacesize[TABLE_SPACE] + pspacesize[INCR_TABLE_SPACE] + (pdl.size + glstack.size + tcpstack.size + complstack.size) * K + de_space_alloc + dl_space_alloc + pnde_space_alloc; total_used = pspacetot + pspacesize[TABLE_SPACE]-(tablespace_sm_alloc-tablespace_sm_used) - (trieassert_alloc - trieassert_used) + pspacesize[INCR_TABLE_SPACE] + (glstack.size * K - gl_avail) + (tcpstack.size * K - tc_avail) + de_space_used + dl_space_used; switch(type) { case TOTALMEMORY: { ctop_int(CTXTc 4, total_alloc); ctop_int(CTXTc 5, total_used); break; } case GLMEMORY: { ctop_int(CTXTc 4, glstack.size *K); ctop_int(CTXTc 5, (glstack.size * K - gl_avail)); break; } case TCMEMORY: { ctop_int(CTXTc 4, tcpstack.size * K); ctop_int(CTXTc 5, (tcpstack.size * K - tc_avail)); break; } case TABLESPACE: { ctop_int(CTXTc 4, private_tablespace_sm_alloc); ctop_int(CTXTc 5, private_tablespace_sm_used); break; } case TRIEASSERTMEM: { ctop_int(CTXTc 4, trieassert_alloc); ctop_int(CTXTc 5, trieassert_used); break; } case HEAPMEM: { ctop_int(CTXTc 4,(Integer)((top_of_heap - (CPtr)glstack.low + 1)* sizeof(Cell))); break; } case CPMEM: { ctop_int(CTXTc 4, (Integer)(((CPtr)tcpstack.high - top_of_cpstack) * sizeof(Cell))); break; } case TRAILMEM: { ctop_int(CTXTc 4, (Integer)((top_of_trail - (CPtr *)tcpstack.low + 1) * sizeof(CPtr))); break; } case LOCALMEM: { ctop_int(CTXTc 4, (Integer)(((CPtr)glstack.high - top_of_localstk) * sizeof(Cell))); break; } case OPENTABLECOUNT: { ctop_int(CTXTc 4, ((size_t)COMPLSTACKBOTTOM - (size_t)top_of_complstk) / sizeof(struct completion_stack_frame)); ctop_int(CTXTc 5, count_sccs(CTXT)); break; } case SHARED_TABLESPACE: { ctop_int(CTXTc 4, shared_tablespace_sm_alloc); ctop_int(CTXTc 5, shared_tablespace_sm_used); break; } case ATOMMEM: { ctop_int(CTXTc 4, pspacesize[ATOM_SPACE]); break; } } }
void total_stat(CTXTdeclc double elapstime) { NodeStats tbtn, /* Table Basic Trie Nodes */ abtn, /* Asserted Basic Trie Nodes */ aln, /* Answer List Nodes */ varsf, /* Variant Subgoal Frames */ asi, /* Answer Substitution Info */ pri_tbtn, /* Private Table Basic Trie Nodes */ pri_tstn, /* Private Time Stamp Trie Nodes */ pri_aln, /* Private Answer List Nodes */ pri_asi, /* Private Answer Substitution Info */ pri_tsi, /* Private Time Stamp Indices (Index Entries/Nodes) */ pri_varsf, /* Private Variant Subgoal Frames */ pri_prodsf, /* Private Subsumptive Producer Subgoal Frames */ pri_conssf; /* Private Subsumptive Consumer Subgoal Frames */ HashStats abtht, /* Asserted Basic Trie Hash Tables */ tbtht, /* Table Basic Trie Hash Tables */ pri_tbtht, /* Table Basic Trie Hash Tables */ pri_tstht; /* Time Stamp Trie Hash Tables */ size_t total_alloc, total_used, tablespace_sm_alloc, tablespace_sm_used, shared_tablespace_sm_alloc, shared_tablespace_sm_used, private_tablespace_sm_alloc, private_tablespace_sm_used, trieassert_alloc, trieassert_used, gl_avail, tc_avail, de_space_alloc, de_space_used, dl_space_alloc, dl_space_used, pnde_space_alloc, pnde_space_used, private_de_space_alloc, private_de_space_used, private_dl_space_alloc, private_dl_space_used, private_pnde_space_alloc, private_pnde_space_used, pspacetot; UInteger de_count; size_t num_de_blocks,num_dl_blocks,num_pnde_blocks, dl_count, private_de_count, private_dl_count, i; tbtn = node_statistics(&smTableBTN); tbtht = hash_statistics(CTXTc &smTableBTHT); varsf = subgoal_statistics(CTXTc &smVarSF); aln = node_statistics(&smALN); asi = node_statistics(&smASI); pri_tbtn = node_statistics(private_smTableBTN); pri_tbtht = hash_statistics(CTXTc private_smTableBTHT); pri_varsf = subgoal_statistics(CTXTc private_smVarSF); pri_aln = node_statistics(private_smALN); pri_asi = node_statistics(private_smASI); pri_prodsf = subgoal_statistics(CTXTc private_smProdSF); pri_conssf = subgoal_statistics(CTXTc private_smConsSF); pri_tstn = node_statistics(private_smTSTN); pri_tstht = hash_statistics(CTXTc private_smTSTHT); pri_tsi = node_statistics(private_smTSIN); private_tablespace_sm_alloc = CurrentPrivateTableSpaceAlloc(pri_tbtn,pri_tbtht,pri_varsf, pri_prodsf, pri_conssf,pri_aln,pri_tstn,pri_tstht,pri_tsi,pri_asi); private_tablespace_sm_used = CurrentPrivateTableSpaceUsed(pri_tbtn,pri_tbtht,pri_varsf, pri_prodsf, pri_conssf,pri_aln,pri_tstn,pri_tstht,pri_tsi,pri_asi); shared_tablespace_sm_alloc = CurrentSharedTableSpaceAlloc(tbtn,tbtht,varsf,aln,asi); shared_tablespace_sm_used = CurrentSharedTableSpaceUsed(tbtn,tbtht,varsf,aln,asi); tablespace_sm_alloc = shared_tablespace_sm_alloc + private_tablespace_sm_alloc; tablespace_sm_used = shared_tablespace_sm_used + private_tablespace_sm_used; abtn = node_statistics(&smAssertBTN); abtht = hash_statistics(CTXTc &smAssertBTHT); trieassert_alloc = NodeStats_SizeAllocNodes(abtn) + HashStats_SizeAllocTotal(abtht); trieassert_used = NodeStats_SizeUsedNodes(abtn) + HashStats_SizeUsedTotal(abtht); gl_avail = (top_of_localstk - top_of_heap - 1) * sizeof(Cell); tc_avail = (top_of_cpstack - (CPtr)top_of_trail - 1) * sizeof(Cell); de_space_alloc = allocated_de_space(current_de_block_gl,&num_de_blocks); de_space_used = de_space_alloc - unused_de_space(); de_count = (de_space_used - num_de_blocks * sizeof(Cell)) / sizeof(struct delay_element); dl_space_alloc = allocated_dl_space(current_dl_block_gl,&num_dl_blocks); dl_space_used = dl_space_alloc - unused_dl_space(); dl_count = (dl_space_used - num_dl_blocks * sizeof(Cell)) / sizeof(struct delay_list); pnde_space_alloc = allocated_pnde_space(current_pnde_block_gl,&num_pnde_blocks); pnde_space_used = pnde_space_alloc - unused_pnde_space(); private_de_space_alloc = allocated_de_space(private_current_de_block,&num_de_blocks); private_de_space_used = private_de_space_alloc - unused_de_space_private(CTXT); private_de_count = (private_de_space_used - num_de_blocks * sizeof(Cell)) / sizeof(struct delay_element); private_dl_space_alloc = allocated_dl_space(private_current_dl_block,&num_dl_blocks); private_dl_space_used = private_dl_space_alloc - unused_dl_space_private(CTXT); private_dl_count = (private_dl_space_used - num_dl_blocks * sizeof(Cell)) / sizeof(struct delay_list); private_pnde_space_alloc = allocated_pnde_space(private_current_pnde_block,&num_pnde_blocks); private_pnde_space_used = private_pnde_space_alloc - unused_pnde_space_private(CTXT); tablespace_sm_alloc = tablespace_sm_alloc + de_space_alloc + dl_space_alloc + pnde_space_alloc; tablespace_sm_used = tablespace_sm_used + de_space_used + dl_space_used + pnde_space_alloc; shared_tablespace_sm_alloc = shared_tablespace_sm_alloc + de_space_alloc + dl_space_alloc + pnde_space_alloc; shared_tablespace_sm_used = shared_tablespace_sm_used + de_space_used + dl_space_used + pnde_space_used; private_tablespace_sm_alloc = private_tablespace_sm_alloc + private_de_space_alloc + private_dl_space_alloc + private_pnde_space_alloc; private_tablespace_sm_used = private_tablespace_sm_used + private_de_space_used + private_dl_space_used + private_pnde_space_used; pspacetot = 0; for (i=0; i<NUM_CATS_SPACE; i++) if (i != TABLE_SPACE) pspacetot += pspacesize[i]; total_alloc = pspacetot + trieassert_alloc + pspacesize[TABLE_SPACE] + de_space_alloc + dl_space_alloc + pnde_space_alloc; total_used = pspacetot + trieassert_used + pspacesize[TABLE_SPACE]-(tablespace_sm_alloc-tablespace_sm_used) + de_space_used + dl_space_used; printf("\n"); printf("Thread-shared memory for process:\n"); printf(" permanent space %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", pspacetot + trieassert_alloc, pspacetot + trieassert_used, trieassert_alloc - trieassert_used); if (trieassert_alloc > 0) printf(" trie-asserted %15" Intfmt " %15" Intfmt "\n", trieassert_used,trieassert_alloc-trieassert_used); for (i=0; i<NUM_CATS_SPACE; i++) if (pspacesize[i] > 0 && i != TABLE_SPACE) printf(" %s %15" Intfmt "\n",pspace_cat[i],pspacesize[i]); printf(" SLG table space %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", pspacesize[TABLE_SPACE]-trieassert_alloc, pspacesize[TABLE_SPACE]-trieassert_alloc-(tablespace_sm_alloc-tablespace_sm_used), tablespace_sm_alloc - tablespace_sm_used); printf(" Shared SLG table space %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", shared_tablespace_sm_alloc,shared_tablespace_sm_used, shared_tablespace_sm_alloc - shared_tablespace_sm_used); printf("Total %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", total_alloc, total_used, total_alloc - total_used); printf("\n"); printf("Thread-private memory thread %"Intfmt":\n",xsb_thread_id); printf(" glob/loc space %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", glstack.size * K, glstack.size * K - gl_avail, gl_avail); printf(" global %15" Intfmt " bytes\n", (Integer)((top_of_heap - (CPtr)glstack.low + 1) * sizeof(Cell))); printf(" local %15" Intfmt " bytes\n", (Integer)(((CPtr)glstack.high - top_of_localstk) * sizeof(Cell))); printf(" trail/cp space %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", tcpstack.size * K, tcpstack.size * K - tc_avail, tc_avail); printf(" trail %15" Intfmt " bytes\n", (Integer)((top_of_trail - (CPtr *)tcpstack.low + 1) * sizeof(CPtr))); printf(" choice point %15" Intfmt " bytes\n", (Integer)(((CPtr)tcpstack.high - top_of_cpstack) * sizeof(Cell))); printf(" SLG unific. space %10" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", pdl.size * K, (size_t)(pdlreg+1) - (size_t)pdl.high, pdl.size * K - ((size_t)(pdlreg+1)-(size_t)pdl.high)); printf(" SLG completion %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", (size_t)complstack.size * K, (size_t)COMPLSTACKBOTTOM - (size_t)top_of_complstk, (size_t)complstack.size * K - ((size_t)COMPLSTACKBOTTOM - (size_t)top_of_complstk)); if (((size_t)COMPLSTACKBOTTOM - (size_t)top_of_complstk) > 0) { printf(" (%" Intfmt " incomplete table(s)", ((size_t)COMPLSTACKBOTTOM - (size_t)top_of_complstk)/(COMPLFRAMESIZE*WORD_SIZE)); printf(" in %d SCCs)",count_sccs(CTXT)); } printf("\n"); printf(" Private SLG table space %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", private_tablespace_sm_alloc,private_tablespace_sm_used, private_tablespace_sm_alloc - private_tablespace_sm_used); printf("\n"); #ifdef GC print_gc_statistics(CTXT); #endif /* TES: Max stack stuff is probably not real useful with multiple threads -- to even get it to work correcly you'd have to use locks. So omitted below. */ #if !defined(MULTI_THREAD) || defined(NON_OPT_COMPILE) printf("Tabling Operations (shared and all private tables)\n"); printf(" %"UIntfmt" subsumptive call check/insert ops: %"UIntfmt" producers, %"UIntfmt" variants,\n" " %"UIntfmt" properly subsumed (%"UIntfmt" table entries), %"UIntfmt" used completed table.\n" " %"UIntfmt" relevant answer ident ops. %"UIntfmt" consumptions via answer list.\n", NumSubOps_CallCheckInsert, NumSubOps_ProducerCall, NumSubOps_VariantCall, NumSubOps_SubsumedCall, NumSubOps_SubsumedCallEntry, NumSubOps_CallToCompletedTable, NumSubOps_IdentifyRelevantAnswers, NumSubOps_AnswerConsumption); { size_t ttl_ops = ans_chk_ins + NumSubOps_AnswerCheckInsert, ttl_ins = ans_inserts + NumSubOps_AnswerInsert; printf(" %"UIntfmt" variant call check/insert ops: %"UIntfmt" producers, %"UIntfmt" variants.\n" " %"UIntfmt" answer check/insert ops: %"UIntfmt" unique inserts, %"UIntfmt" redundant.\n", var_subg_chk_ins_gl, var_subg_inserts_gl, var_subg_chk_ins_gl - var_subg_inserts_gl, ttl_ops, ttl_ins, ttl_ops - ttl_ins); } if (de_count > 0) { printf(" %6"UIntfmt" DEs in the tables (space: %5"UIntfmt" bytes allocated, %5"UIntfmt" in use)\n", de_count, de_space_alloc, de_space_used); printf(" %6"UIntfmt" DLs in the tables (space: %5"UIntfmt" bytes allocated, %5"UIntfmt" in use)\n", dl_count, dl_space_alloc, dl_space_used); printf("\n"); } if (abol_subg_ctr == 1) printf(" 1 tabled subgoal explicitly abolished\n"); else if (abol_subg_ctr > 1) printf(" %"UIntfmt" tabled subgoals explicitly abolished\n",abol_subg_ctr); if (abol_pred_ctr == 1) printf(" 1 tabled predicate explicitly abolished\n"); else if (abol_pred_ctr > 1) printf(" %"UIntfmt" tabled predicates explicitly abolished\n",abol_pred_ctr); #endif #ifdef SHARED_COMPL_TABLES printf("%"UIntfmt" thread suspensions have occured\n\n", num_suspends ); printf("%"UIntfmt" deadlocks have occured\n\n", num_deadlocks ); #endif printf("Peak number of active user threads: %"UIntfmt"\n", max_threads_sofar ); printf("%"UIntfmt" active user thread%s.\n",(UInteger)flags[NUM_THREADS], (flags[NUM_THREADS]>1?"s":"")); printf("Time: %.3f sec. cputime, %.3f sec. elapsetime\n", time_count, elapstime); }
void total_stat(CTXTdeclc double elapstime) { NodeStats tbtn, /* Table Basic Trie Nodes */ abtn, /* Asserted Basic Trie Nodes */ tstn, /* Time Stamp Trie Nodes */ aln, /* Answer List Nodes */ tsi, /* Time Stamp Indices (Index Entries/Nodes) */ varsf, /* Variant Subgoal Frames */ prodsf, /* Subsumptive Producer Subgoal Frames */ conssf, /* Subsumptive Consumer Subgoal Frames */ asi, /* Answer Subst Info for conditional answers */ tot_Key, /* Keys used in incremental tabling */ tot_CallNode, tot_OutEdge, tot_CallList, tot_Call2List; HashStats tbtht, /* Table Basic Trie Hash Tables */ abtht, /* Asserted Basic Trie Hash Tables */ tstht; /* Time Stamp Trie Hash Tables */ size_t pnde_space_alloc, pnde_space_used, num_de_blocks, num_dl_blocks, num_pnde_blocks, i; UInteger de_count, dl_count, de_space_alloc, de_space_used, total_alloc, total_used, dl_space_alloc, dl_space_used, tablespace_sm_alloc, tablespace_sm_used, tablespace_sm_free, pspacetot, incr_tablespace_sm_alloc, // incr_tablespace_sm_used, trieassert_alloc, trieassert_used, tc_avail, gl_avail; UInteger total_table_space; int clref_count = 0; int predref_count = 0; abtn = node_statistics(&smAssertBTN); abtht = hash_statistics(CTXTc &smAssertBTHT); trieassert_alloc = NodeStats_SizeAllocNodes(abtn) + HashStats_SizeAllocTotal(abtht); trieassert_used = NodeStats_SizeUsedNodes(abtn) + HashStats_SizeUsedTotal(abtht); de_space_alloc = allocated_de_space(current_de_block_gl,&num_de_blocks); de_space_used = de_space_alloc - unused_de_space(); de_count = (de_space_used - num_de_blocks * sizeof(Cell)) / sizeof(struct delay_element); dl_space_alloc = allocated_dl_space(current_dl_block_gl,&num_dl_blocks); dl_space_used = dl_space_alloc - unused_dl_space(); dl_count = (dl_space_used - num_dl_blocks * sizeof(Cell)) / sizeof(struct delay_list); pnde_space_alloc = allocated_pnde_space(current_pnde_block_gl,&num_pnde_blocks); pnde_space_used = pnde_space_alloc - unused_pnde_space(); #ifdef DETAILED_STATISTICS tbtn = node_statistics(&smTableBTN); tbtht = hash_statistics(CTXTc &smTableBTHT); varsf = subgoal_statistics(CTXTc &smVarSF); prodsf = subgoal_statistics(CTXTc &smProdSF); conssf = subgoal_statistics(CTXTc &smConsSF); aln = node_statistics(&smALN); tstn = node_statistics(&smTSTN); tstht = hash_statistics(CTXTc &smTSTHT); tsi = node_statistics(&smTSIN); asi = node_statistics(&smASI); tablespace_sm_alloc = CurrentTotalTableSpaceAlloc(tbtn,tbtht,varsf,prodsf,conssf,aln,tstn,tstht,tsi,asi); tablespace_sm_used = CurrentTotalTableSpaceUsed(tbtn,tbtht,varsf,prodsf, conssf,aln,tstn,tstht,tsi,asi); tot_CallNode = node_statistics(&smCallNode); tot_OutEdge = node_statistics(&smOutEdge); tot_CallList = node_statistics(&smCallList); tot_Call2List = node_statistics(&smCall2List); tot_Key = node_statistics(&smKey); incr_tablespace_sm_alloc = CurrentTotalIncrTableSpaceAlloc(tot_CallNode,tot_OutEdge,tot_CallList,tot_Call2List,tot_Key); // incr_tablespace_sm_used = CurrentTotalIncrTableSpaceUsed(tot_CallNode,tot_OutEdge,tot_CallList,tot_Call2List,tot_Key); tablespace_sm_alloc = tablespace_sm_alloc + de_space_alloc + dl_space_alloc + pnde_space_alloc; tablespace_sm_used = tablespace_sm_used + de_space_used + dl_space_used + pnde_space_used; tablespace_sm_free = tablespace_sm_alloc - tablespace_sm_used; #endif /* DETAILED_STATISTICS */ gl_avail = (top_of_localstk - top_of_heap - 1) * sizeof(Cell); tc_avail = (top_of_cpstack - (CPtr)top_of_trail - 1) * sizeof(Cell); pspacetot = 0; for (i=0; i<NUM_CATS_SPACE; i++) if (i != TABLE_SPACE && i != INCR_TABLE_SPACE) pspacetot += pspacesize[i]; total_table_space = pspacesize[TABLE_SPACE]+(pspacesize[INCR_TABLE_SPACE]-trieassert_alloc) +de_space_alloc+dl_space_alloc+pnde_space_alloc; total_alloc = pspacetot + total_table_space + trieassert_alloc + (pdl.size + glstack.size + tcpstack.size + complstack.size) * K ; total_used = pspacetot + total_table_space + trieassert_used - tablespace_sm_free + ((UInteger) ((size_t)(pdlreg+1) - (size_t)pdl.high) + glstack.size*K - gl_avail) + (tcpstack.size * K - tc_avail + complstack.size) ; printf("\n"); // printf("Memory (total) " NIntfmt Intfmt " bytes: %'15" Intfmt " in use, %'15" Intfmt " free\n", printf("Memory (total) " NLoc15Int " bytes: " NLoc15Int " in use, " NLoc15Int " free\n", total_alloc, total_used, total_alloc - total_used); printf(" permanent space " NLoc15Int " bytes: " NLoc15Int " in use, " NLoc15Int " free\n", pspacetot + trieassert_alloc, pspacetot + trieassert_used, trieassert_alloc - trieassert_used); if (trieassert_alloc > 0) printf(" trie-asserted " NLoc15Int " in use, " NLoc15Int "\n", trieassert_used,trieassert_alloc-trieassert_used); for (i=0; i<NUM_CATS_SPACE; i++) if (pspacesize[i] > 0 && i != TABLE_SPACE && i != INCR_TABLE_SPACE) printf(" %s "NLoc15Int "\n",pspace_cat[i],pspacesize[i]); printf(" glob/loc space "NLoc15Int " bytes: "NLoc15Int " in use, "NLoc15Int " free\n", glstack.size * K, glstack.size * K - gl_avail, gl_avail); printf(" global " NLoc15Int "\n", (Integer)((top_of_heap - (CPtr)glstack.low + 1) * sizeof(Cell))); printf(" local " NLoc15Int "\n", (Integer)(((CPtr)glstack.high - top_of_localstk) * sizeof(Cell))); printf(" trail/cp space "NLoc15Int " bytes: " NLoc15Int " in use, " NLoc15Int " free\n", tcpstack.size * K, tcpstack.size * K - tc_avail, tc_avail); printf(" trail " NLoc15Int "\n", (Integer)((top_of_trail - (CPtr *)tcpstack.low + 1) * sizeof(CPtr))); printf(" choice point " NLoc15Int "\n", (Integer)(((CPtr)tcpstack.high - top_of_cpstack) * sizeof(Cell))); printf(" SLG unific. space "NLoc15Int " bytes: "NLoc15Int " in use, "NLoc15Int " free\n", (UInteger) pdl.size * K, (UInteger) ((size_t)(pdlreg+1) - (size_t)pdl.high), (UInteger) (pdl.size * K - ((size_t)(pdlreg+1)-(size_t)pdl.high))); printf(" SLG completion "NLoc15Int " bytes: "NLoc15Int " in use, "NLoc15Int " free\n", (UInteger)complstack.size * K, (UInteger)COMPLSTACKBOTTOM - (UInteger)top_of_complstk, (UInteger)complstack.size * K - (UInteger) ((size_t)COMPLSTACKBOTTOM - (size_t)top_of_complstk)); if (((size_t)COMPLSTACKBOTTOM - (size_t)top_of_complstk) > 0) { printf(" ("NLocInt " Incomplete table(s)", (UInteger) (((UInteger)COMPLSTACKBOTTOM - (UInteger)top_of_complstk)/(COMPLFRAMESIZE*WORD_SIZE))); printf(" in %d SCCs)",count_sccs(CTXT)); printf("\n"); } printf(" SLG table space "NLoc15Int " bytes: " NLoc15Int " in use, " NLoc15Int " free\n", total_table_space, total_table_space - tablespace_sm_free, tablespace_sm_free); if (pspacesize[INCR_TABLE_SPACE]) { printf(" Incr table space " NLoc15Int " allocated\n", pspacesize[INCR_TABLE_SPACE] + incr_tablespace_sm_alloc); printf(" Hash space " NLoc15Int " allocated\n",pspacesize[INCR_TABLE_SPACE]); #ifdef DETAILED_STATISTICS printf(" Callnode spc " NLoc15Int " bytes: " NLoc15Int " in use\n", NodeStats_SizeAllocNodes(tot_CallNode),NodeStats_SizeUsedNodes(tot_CallNode)); printf(" Outedge space " NLoc15Int " bytes: " NLoc15Int " in use\n", NodeStats_SizeAllocNodes(tot_OutEdge),NodeStats_SizeUsedNodes(tot_OutEdge)); printf(" CallList spc " NLoc15Int " bytes: " NLoc15Int " in use\n", NodeStats_SizeAllocNodes(tot_CallList),NodeStats_SizeUsedNodes(tot_CallList)); printf(" Call2List spc " NLoc15Int " bytes: " NLoc15Int " in use\n", NodeStats_SizeAllocNodes(tot_Call2List),NodeStats_SizeUsedNodes(tot_Call2List)); printf(" Key space " NLoc15Int " bytes: " NLoc15Int " in use\n", NodeStats_SizeAllocNodes(tot_Key),NodeStats_SizeUsedNodes(tot_Key)); #endif } printf("\n"); // printf(" Incr tab space %15" Intfmt " bytes: %15" Intfmt " in use, %15" Intfmt " free\n", // incr_tablespace_sm_alloc, incr_tablespace_sm_used, // incr_tablespace_sm_alloc-incr_tablespace_sm_used); //,tot_OutEdge,tot_CallList,tot_Call2List,tot_Key); // if (flags[MAX_USAGE]) { // /* Report Maximum Usages // --------------------- */ // update_maximum_tablespace_stats(&tbtn,&tbtht,&varsf,&prodsf,&conssf, // &aln,&tstn,&tstht,&tsi,&asi); // printf(" Maximum table space used: %'d" Intfmt " bytes\n", // maximum_total_tablespace_usage()); // printf("\n"); // } #if !defined(MULTI_THREAD) || defined(NON_OPT_COMPILE) printf("Tabling Operations\n"); printf(" "NLocUInt" subsumptive call check/insert ops: "NLocUInt" producers, "NLocUInt" variants,\n" " "NLocUInt" properly subsumed ("NLocUInt" table entries), "NLocUInt" used completed table.\n" " "NLocUInt" relevant answer ident ops. "NLocUInt" consumptions via answer list.\n", NumSubOps_CallCheckInsert, NumSubOps_ProducerCall, NumSubOps_VariantCall, NumSubOps_SubsumedCall, NumSubOps_SubsumedCallEntry, NumSubOps_CallToCompletedTable, NumSubOps_IdentifyRelevantAnswers, NumSubOps_AnswerConsumption); { UInteger ttl_ops = ans_chk_ins + NumSubOps_AnswerCheckInsert, ttl_ins = ans_inserts + NumSubOps_AnswerInsert; printf(" "NLocUInt " variant table call check/insert ops: \n",var_subg_chk_ins_gl); printf(" "NLocUInt " checks/inserts for tabled subgoals; "NLocUInt " checks/inserts for IDG leaf nodes \n", var_subg_chk_ins_gl-(dyn_incr_chk_ins_gl+2*incr_table_recomputations_gl),dyn_incr_chk_ins_gl); printf(" "NLocUInt " check/inserts for incremental recomputations\n", (UInteger) 2*incr_table_recomputations_gl); printf(" "NLocUInt " distinct variant subgoals\n",var_subg_inserts_gl); printf(" "NLocUInt" answer check/insert ops: "NLocUInt " unique inserts, "NLocUInt" redundant.\n", ttl_ops, ttl_ins, ttl_ops - ttl_ins); } if (de_count > 0) { printf(" "NLocInt " DEs in the tables (space: "NLocInt " bytes allocated, "NLocInt" in use)\n", de_count, de_space_alloc, de_space_used); printf(" "NLocInt " DLs in the tables (space: "NLocInt " bytes allocated, "NLocInt" in use)\n", dl_count, dl_space_alloc, dl_space_used); printf("\n"); } if (total_call_node_count_gl) { // printf(" Total number of IDG nodes created: %'d\n",total_call_node_count_gl); if (current_call_node_count_gl) { printf(" Currently "NLocint " IDG nodes, "NLocint " dependency edges\n", (long) current_call_node_count_gl,(long) current_call_edge_count_gl); } if (incr_table_recomputations_gl) { printf(" incremental table recomputations "NLocint "\n",(long) incr_table_recomputations_gl); } if (dyn_incr_chk_ins_gl) { printf(" "NLocInt " call check/insert ops for incr dyn IDG nodes; "NLocInt " unique goals\n", dyn_incr_chk_ins_gl,dyn_incr_inserts_gl); } } if (abol_subg_ctr == 1) printf(" 1 tabled subgoal explicitly abolished\n"); else if (abol_subg_ctr > 1) printf(" "NLocUInt " tabled subgoals explicitly abolished\n",abol_subg_ctr); if (abol_pred_ctr == 1) printf(" 1 tabled predicate explicitly abolished\n"); else if (abol_pred_ctr > 1) printf(" "NLocUInt " tabled predicates explicitly abolished\n",abol_pred_ctr); print_abolish_table_statistics(); #endif count_dynamic(&clref_count, &predref_count); printf("\n");printf(" Uncollected clauses %d predrefs %d\n",clref_count,predref_count); print_gc_statistics(); printf("Time: %.3f sec. cputime, %.3f sec. elapsetime\n", cputime_count_gl, elapstime); }
void total_stat(CTXTdeclc double elapstime) { NodeStats tbtn, /* Table Basic Trie Nodes */ abtn, /* Asserted Basic Trie Nodes */ tstn, /* Time Stamp Trie Nodes */ aln, /* Answer List Nodes */ tsi, /* Time Stamp Indices (Index Entries/Nodes) */ varsf, /* Variant Subgoal Frames */ prodsf, /* Subsumptive Producer Subgoal Frames */ conssf, /* Subsumptive Consumer Subgoal Frames */ asi; /* Answer Subst Info for conditional answers */ HashStats tbtht, /* Table Basic Trie Hash Tables */ abtht, /* Asserted Basic Trie Hash Tables */ tstht; /* Time Stamp Trie Hash Tables */ unsigned long total_alloc, total_used, tablespace_alloc, tablespace_used, trieassert_alloc, trieassert_used, gl_avail, tc_avail, de_space_alloc, de_space_used, dl_space_alloc, dl_space_used, pnde_space_alloc, pnde_space_used, pspacetot; int num_de_blocks, num_dl_blocks, num_pnde_blocks, de_count, dl_count, i; tbtn = node_statistics(&smTableBTN); tbtht = hash_statistics(&smTableBTHT); varsf = subgoal_statistics(CTXTc &smVarSF); prodsf = subgoal_statistics(CTXTc &smProdSF); conssf = subgoal_statistics(CTXTc &smConsSF); aln = node_statistics(&smALN); tstn = node_statistics(&smTSTN); tstht = hash_statistics(&smTSTHT); tsi = node_statistics(&smTSIN); asi = node_statistics(&smASI); tablespace_alloc = CurrentTotalTableSpaceAlloc(tbtn,tbtht,varsf,prodsf, conssf,aln,tstn,tstht,tsi,asi); tablespace_used = CurrentTotalTableSpaceUsed(tbtn,tbtht,varsf,prodsf, conssf,aln,tstn,tstht,tsi,asi); abtn = node_statistics(&smAssertBTN); abtht = hash_statistics(&smAssertBTHT); trieassert_alloc = NodeStats_SizeAllocNodes(abtn) + HashStats_SizeAllocTotal(abtht); trieassert_used = NodeStats_SizeUsedNodes(abtn) + HashStats_SizeUsedTotal(abtht); de_space_alloc = allocated_de_space(current_de_block_gl,&num_de_blocks); de_space_used = de_space_alloc - unused_de_space(); de_count = (de_space_used - num_de_blocks * sizeof(Cell)) / sizeof(struct delay_element); dl_space_alloc = allocated_dl_space(current_dl_block_gl,&num_dl_blocks); dl_space_used = dl_space_alloc - unused_dl_space(); dl_count = (dl_space_used - num_dl_blocks * sizeof(Cell)) / sizeof(struct delay_list); pnde_space_alloc = allocated_pnde_space(current_pnde_block_gl,&num_pnde_blocks); pnde_space_used = pnde_space_alloc - unused_pnde_space(); tablespace_alloc = tablespace_alloc + de_space_alloc + dl_space_alloc + pnde_space_alloc; tablespace_used = tablespace_used + de_space_used + dl_space_used + pnde_space_used; gl_avail = (top_of_localstk - top_of_heap - 1) * sizeof(Cell); tc_avail = (top_of_cpstack - (CPtr)top_of_trail - 1) * sizeof(Cell); pspacetot = 0; for (i=0; i<NUM_CATS_SPACE; i++) if (i != TABLE_SPACE && i != INCR_TABLE_SPACE) pspacetot += pspacesize[i]; total_alloc = pspacetot + pspacesize[TABLE_SPACE] + pspacesize[INCR_TABLE_SPACE] + (pdl.size + glstack.size + tcpstack.size + complstack.size) * K + de_space_alloc + dl_space_alloc + pnde_space_alloc; total_used = pspacetot + pspacesize[TABLE_SPACE]-(tablespace_alloc-tablespace_used) - (trieassert_alloc - trieassert_used) + pspacesize[INCR_TABLE_SPACE] + (glstack.size * K - gl_avail) + (tcpstack.size * K - tc_avail) + de_space_used + dl_space_used; printf("\n"); printf("Memory (total) %12ld bytes: %12ld in use, %12ld free\n", total_alloc, total_used, total_alloc - total_used); printf(" permanent space %12ld bytes: %12ld in use, %12ld free\n", pspacetot + trieassert_alloc, pspacetot + trieassert_used, trieassert_alloc - trieassert_used); if (trieassert_alloc > 0) printf(" trie-asserted %12ld %12ld\n", trieassert_used,trieassert_alloc-trieassert_used); for (i=0; i<NUM_CATS_SPACE; i++) if (pspacesize[i] > 0 && i != TABLE_SPACE && i != INCR_TABLE_SPACE) printf(" %s %12ld\n",pspace_cat[i],pspacesize[i]); printf(" glob/loc space %12ld bytes: %12ld in use, %12ld free\n", glstack.size * K, glstack.size * K - gl_avail, gl_avail); printf(" global %12ld bytes\n", (long)((top_of_heap - (CPtr)glstack.low + 1) * sizeof(Cell))); printf(" local %12ld bytes\n", (long)(((CPtr)glstack.high - top_of_localstk) * sizeof(Cell))); printf(" trail/cp space %12ld bytes: %12ld in use, %12ld free\n", tcpstack.size * K, tcpstack.size * K - tc_avail, tc_avail); printf(" trail %12ld bytes\n", (long)((top_of_trail - (CPtr *)tcpstack.low + 1) * sizeof(CPtr))); printf(" choice point %12ld bytes\n", (long)(((CPtr)tcpstack.high - top_of_cpstack) * sizeof(Cell))); printf(" SLG unific. space %10ld bytes: %12ld in use, %12ld free\n", pdl.size * K, (unsigned long)(pdlreg+1) - (unsigned long)pdl.high, pdl.size * K - ((unsigned long)(pdlreg+1)-(unsigned long)pdl.high)); printf(" SLG completion %12ld bytes: %12ld in use, %12ld free\n", (unsigned long)complstack.size * K, (unsigned long)COMPLSTACKBOTTOM - (unsigned long)top_of_complstk, (unsigned long)complstack.size * K - ((unsigned long)COMPLSTACKBOTTOM - (unsigned long)top_of_complstk)); if (pspacesize[INCR_TABLE_SPACE] > 0) printf(" Incr table space %12ld in use\n", pspacesize[INCR_TABLE_SPACE]); printf(" SLG table space %12ld bytes: %12ld in use, %12ld free\n", pspacesize[TABLE_SPACE]+pspacesize[INCR_TABLE_SPACE]-trieassert_alloc, pspacesize[TABLE_SPACE]+pspacesize[INCR_TABLE_SPACE]-trieassert_alloc- (tablespace_alloc-tablespace_used), tablespace_alloc - tablespace_used); printf("\n"); if (flags[TRACE_STA]) { /* Report Maximum Usages --------------------- */ printf(" Maximum stack used: global %ld, local %ld, trail %ld, cp %ld,\n", ttt.maxgstack_count, ttt.maxlstack_count, ttt.maxtrail_count, ttt.maxcpstack_count); printf(" SLG completion %ld (%ld subgoals)\n", ttt.maxopenstack_count, (ttt.maxopenstack_count/sizeof(struct completion_stack_frame))); update_maximum_tablespace_stats(&tbtn,&tbtht,&varsf,&prodsf,&conssf, &aln,&tstn,&tstht,&tsi,&asi); printf(" Maximum table space used: %ld bytes\n", maximum_total_tablespace_usage()); printf("\n"); } #if !defined(MULTI_THREAD) || defined(NON_OPT_COMPILE) printf("Tabling Operations\n"); printf(" %lu subsumptive call check/insert ops: %lu producers, %lu variants,\n" " %lu properly subsumed (%lu table entries), %lu used completed table.\n" " %lu relevant answer ident ops. %lu consumptions via answer list.\n", NumSubOps_CallCheckInsert, NumSubOps_ProducerCall, NumSubOps_VariantCall, NumSubOps_SubsumedCall, NumSubOps_SubsumedCallEntry, NumSubOps_CallToCompletedTable, NumSubOps_IdentifyRelevantAnswers, NumSubOps_AnswerConsumption); { unsigned long ttl_ops = ans_chk_ins + NumSubOps_AnswerCheckInsert, ttl_ins = ans_inserts + NumSubOps_AnswerInsert; printf(" %lu variant call check/insert ops: %lu producers, %lu variants.\n" " %lu answer check/insert ops: %lu unique inserts, %lu redundant.\n", subg_chk_ins, subg_inserts, subg_chk_ins - subg_inserts, ttl_ops, ttl_ins, ttl_ops - ttl_ins); } printf("\n"); if (de_count > 0) { printf(" %6d DEs in the tables (space: %5ld bytes allocated, %5ld in use)\n", de_count, de_space_alloc, de_space_used); printf(" %6d DLs in the tables (space: %5ld bytes allocated, %5ld in use)\n", dl_count, dl_space_alloc, dl_space_used); printf("\n"); } #endif #ifdef GC printf("\n"); print_gc_statistics(); #endif printf("Time: %.3f sec. cputime, %.3f sec. elapsetime\n", ttt.time_count, elapstime); }