trace_xsb.c

00001 /* File:      trace_xsb.c
00002 ** Author(s): Jiyang Xu, Terrance Swift, Kostis Sagonas
00003 ** Contact:   xsb-contact@cs.sunysb.edu
00004 ** 
00005 ** Copyright (C) The Research Foundation of SUNY, 1986, 1993-1998
00006 ** Copyright (C) ECRC, Germany, 1990
00007 ** 
00008 ** XSB is free software; you can redistribute it and/or modify it under the
00009 ** terms of the GNU Library General Public License as published by the Free
00010 ** Software Foundation; either version 2 of the License, or (at your option)
00011 ** any later version.
00012 ** 
00013 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
00014 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00015 ** FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
00016 ** more details.
00017 ** 
00018 ** You should have received a copy of the GNU Library General Public License
00019 ** along with XSB; if not, write to the Free Software Foundation,
00020 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00021 **
00022 ** $Id: trace_xsb.c,v 1.24 2006/06/20 17:43:21 dwarren Exp $
00023 ** 
00024 */
00025 
00026 #include "xsb_config.h"
00027 #include "xsb_debug.h"
00028 
00029 #include <stdio.h>
00030 
00031 #include "auxlry.h"
00032 #include "cell_xsb.h"
00033 #include "inst_xsb.h"
00034 #include "memory_xsb.h"
00035 #include "register.h"
00036 #include "psc_xsb.h"
00037 #include "table_stats.h"
00038 #include "trie_internals.h"
00039 #include "tries.h"
00040 #include "macro_xsb.h"
00041 #include "choice.h"
00042 #include "flags_xsb.h"
00043 #include "heap_xsb.h"
00044 #include "thread_xsb.h"
00045 #include "trace_xsb.h"
00046 
00047 /*======================================================================*/
00048 /* Process-level information: keep this global */
00049 
00050 double time_start;      /* time from which stats started being collected */
00051 
00052 #ifndef MULTI_THREAD
00053 struct trace_str tds;                   /* trace datastructure */
00054 struct trace_str ttt;                   /* trace total */
00055 struct trace_str trace_init = {         /* initial value for a trace str */
00056     0, 0, 0, 0, 0, 0, 0.0
00057    };
00058 #else 
00059 double time_count = 0;
00060 #endif
00061 
00062 /*======================================================================*/
00063 /* perproc_stat()                                                       */
00064 /*======================================================================*/
00065 
00066 /*
00067  * Moves values from 'tds' into 'ttt' for reporting in total_stat().
00068  * (Since 'ttt' is always reset when the builtin statistics/1
00069  *  (statistics/0 calls statistics(1)) is called, 'ttt' always gets *
00070  *  what's in 'tds'.  The *real* check for max usage occurs in *
00071  *  subp.c::intercept(), which compares current usage to previous max *
00072  *  values held in 'tds'.)
00073  */
00074 
00075 #ifndef MULTI_THREAD
00076 void perproc_stat(void)
00077 {
00078   tds.time_count = cpu_time() - time_start;
00079   if (ttt.maxgstack_count < tds.maxgstack_count) 
00080      ttt.maxgstack_count = tds.maxgstack_count;
00081   if (ttt.maxlstack_count < tds.maxlstack_count) 
00082      ttt.maxlstack_count = tds.maxlstack_count;
00083   if (ttt.maxtrail_count < tds.maxtrail_count)
00084      ttt.maxtrail_count = tds.maxtrail_count;
00085   if (ttt.maxcpstack_count < tds.maxcpstack_count)
00086      ttt.maxcpstack_count = tds.maxcpstack_count;
00087   if (ttt.maxopenstack_count < tds.maxopenstack_count)
00088      ttt.maxopenstack_count = tds.maxopenstack_count;
00089   if (ttt.maxlevel_num < tds.maxlevel_num)
00090      ttt.maxlevel_num = tds.maxlevel_num;
00091   ttt.time_count += tds.time_count;
00092 }
00093 #else
00094 void perproc_stat(void)
00095 {
00096   time_count = cpu_time() - time_start;
00097 }
00098 #endif
00099 
00100 /*======================================================================*/
00101 /* total_stat()                                                         */
00102 /*======================================================================*/
00103 
00104 /*
00105  * Prints current memory usage info, operational counts, and, if the
00106  * "-s" option was given to xsb at invocation, maximum usage from the
00107  * time of 'time_start'.
00108  */
00109 
00110 static char *pspace_cat[NUM_CATS_SPACE] =
00111   {"atom        ","string      ","asserted    ","compiled    ",
00112    "foreign     ","table       ","findall     ","profile     ",
00113    "mt-private  ","buffer      ","gc temp     ","hash        ",
00114    "interprolog ","thread      ","read canon  ","leaking...  ",
00115    "special     ","other       "};
00116 
00117 #ifndef MULTI_THREAD
00118 void total_stat(CTXTdeclc double elapstime) {
00119 
00120   NodeStats
00121     tbtn,               /* Table Basic Trie Nodes */
00122     abtn,               /* Asserted Basic Trie Nodes */
00123     tstn,               /* Time Stamp Trie Nodes */
00124     aln,                /* Answer List Nodes */
00125     tsi,                /* Time Stamp Indices (Index Entries/Nodes) */
00126     varsf,              /* Variant Subgoal Frames */
00127     prodsf,             /* Subsumptive Producer Subgoal Frames */
00128     conssf;             /* Subsumptive Consumer Subgoal Frames */
00129 
00130   HashStats
00131     tbtht,              /* Table Basic Trie Hash Tables */
00132     abtht,              /* Asserted Basic Trie Hash Tables */
00133     tstht;              /* Time Stamp Trie Hash Tables */
00134   
00135   unsigned long
00136     total_alloc, total_used,
00137     tablespace_alloc, tablespace_used,
00138     trieassert_alloc, trieassert_used,
00139     gl_avail, tc_avail,
00140     de_space_alloc, de_space_used,
00141     dl_space_alloc, dl_space_used,
00142     pspacetot;
00143 
00144   int
00145     num_de_blocks, num_dl_blocks,
00146     de_count, dl_count,
00147     i;
00148 
00149   tbtn = node_statistics(&smTableBTN);
00150   tbtht = hash_statistics(&smTableBTHT);
00151   varsf = subgoal_statistics(CTXTc &smVarSF);
00152   prodsf = subgoal_statistics(CTXTc &smProdSF);
00153   conssf = subgoal_statistics(CTXTc &smConsSF);
00154   aln = node_statistics(&smALN);
00155   tstn = node_statistics(&smTSTN);
00156   tstht = hash_statistics(&smTSTHT);
00157   tsi = node_statistics(&smTSIN);
00158 
00159   tablespace_alloc = CurrentTotalTableSpaceAlloc(tbtn,tbtht,varsf,prodsf,
00160                                                  conssf,aln,tstn,tstht,tsi);
00161   tablespace_used = CurrentTotalTableSpaceUsed(tbtn,tbtht,varsf,prodsf,
00162                                                conssf,aln,tstn,tstht,tsi);
00163 
00164   abtn = node_statistics(&smAssertBTN);
00165   abtht = hash_statistics(&smAssertBTHT);
00166   trieassert_alloc =
00167     NodeStats_SizeAllocNodes(abtn) + HashStats_SizeAllocTotal(abtht);
00168   trieassert_used =
00169     NodeStats_SizeUsedNodes(abtn) + HashStats_SizeUsedTotal(abtht);
00170 
00171   gl_avail = (top_of_localstk - top_of_heap - 1) * sizeof(Cell);
00172   tc_avail = (top_of_cpstack - (CPtr)top_of_trail - 1) * sizeof(Cell);
00173   
00174   de_space_alloc = allocated_de_space(& num_de_blocks);
00175   de_space_used = de_space_alloc - unused_de_space();
00176   de_count = (de_space_used - num_de_blocks * sizeof(Cell)) /
00177              sizeof(struct delay_element);
00178 
00179   dl_space_alloc = allocated_dl_space(& num_dl_blocks);
00180   dl_space_used = dl_space_alloc - unused_dl_space();
00181   dl_count = (dl_space_used - num_dl_blocks * sizeof(Cell)) /
00182              sizeof(struct delay_list);
00183 
00184 
00185   pspacetot = 0;
00186   for (i=0; i<NUM_CATS_SPACE; i++) 
00187     if (i != TABLE_SPACE) pspacetot += pspacesize[i];
00188 
00189   total_alloc =
00190     pspacetot  +  trieassert_alloc  +  pspacesize[TABLE_SPACE] +
00191     (pdl.size + glstack.size + tcpstack.size + complstack.size) * K +
00192     de_space_alloc + dl_space_alloc;
00193 
00194   total_used  =
00195     pspacetot  +  trieassert_used  +  pspacesize[TABLE_SPACE]-(tablespace_alloc-tablespace_used) +
00196     (glstack.size * K - gl_avail) + (tcpstack.size * K - tc_avail) +
00197     de_space_used + dl_space_used;
00198 
00199 
00200   printf("\n");
00201   printf("Memory (total)    %12ld bytes: %12ld in use, %12ld free\n",
00202          total_alloc, total_used, total_alloc - total_used);
00203   printf("  permanent space %12ld bytes: %12ld in use, %12ld free\n",
00204          pspacetot + trieassert_alloc, pspacetot + trieassert_used,
00205          trieassert_alloc - trieassert_used);
00206   if (trieassert_alloc > 0)
00207     printf("    trie-asserted                     %12ld         %12ld\n",
00208            trieassert_used,trieassert_alloc-trieassert_used);
00209 
00210   for (i=0; i<NUM_CATS_SPACE; i++) 
00211     if (pspacesize[i] > 0 && i != TABLE_SPACE)
00212       printf("    %s                      %12ld\n",pspace_cat[i],pspacesize[i]);
00213 
00214   printf("  glob/loc space  %12ld bytes: %12ld in use, %12ld free\n",
00215          glstack.size * K, glstack.size * K - gl_avail, gl_avail);
00216   printf("    global                            %12ld bytes\n",
00217          (long)((top_of_heap - (CPtr)glstack.low + 1) * sizeof(Cell)));
00218   printf("    local                             %12ld bytes\n",
00219          (long)(((CPtr)glstack.high - top_of_localstk) * sizeof(Cell)));
00220   printf("  trail/cp space  %12ld bytes: %12ld in use, %12ld free\n",
00221          tcpstack.size * K, tcpstack.size * K - tc_avail, tc_avail);
00222   printf("    trail                             %12ld bytes\n",
00223          (long)((top_of_trail - (CPtr *)tcpstack.low + 1) * sizeof(CPtr)));
00224   printf("    choice point                      %12ld bytes\n",
00225          (long)(((CPtr)tcpstack.high - top_of_cpstack) * sizeof(Cell)));
00226   printf("  SLG unific. space %10ld bytes: %12ld in use, %12ld free\n",
00227          pdl.size * K, (unsigned long)(pdlreg+1) - (unsigned long)pdl.high,
00228          pdl.size * K - ((unsigned long)(pdlreg+1)-(unsigned long)pdl.high)); 
00229   printf("  SLG completion  %12ld bytes: %12ld in use, %12ld free\n",
00230          (unsigned long)complstack.size * K,
00231          (unsigned long)COMPLSTACKBOTTOM - (unsigned long)top_of_complstk,
00232          (unsigned long)complstack.size * K -
00233          ((unsigned long)COMPLSTACKBOTTOM - (unsigned long)top_of_complstk));
00234   printf("  SLG table space %12ld bytes: %12ld in use, %12ld free\n",
00235          pspacesize[TABLE_SPACE]-trieassert_alloc,  
00236          pspacesize[TABLE_SPACE]-trieassert_alloc-(tablespace_alloc-tablespace_used),
00237          tablespace_alloc - tablespace_used);
00238   printf("\n");
00239 
00240 /* TLS: Max stack stuff is probably not real useful with multiple
00241    threads -- to even get it to work correcly you'd have to use locks.
00242 */
00243 
00244   if (flags[TRACE_STA]) {
00245     /* Report Maximum Usages
00246        --------------------- */
00247     printf("  Maximum stack used: global %ld, local %ld, trail %ld, cp %ld,\n",
00248            ttt.maxgstack_count, ttt.maxlstack_count, 
00249            ttt.maxtrail_count, ttt.maxcpstack_count);
00250     printf("                      SLG completion %ld (%ld subgoals)\n",
00251            ttt.maxopenstack_count,
00252            (ttt.maxopenstack_count/sizeof(struct completion_stack_frame)));
00253 
00254     update_maximum_tablespace_stats(&tbtn,&tbtht,&varsf,&prodsf,&conssf,
00255                                     &aln,&tstn,&tstht,&tsi);
00256     printf("  Maximum table space used:  %ld bytes\n",
00257            maximum_total_tablespace_usage());
00258     printf("\n");
00259   }
00260 
00261   printf("Tabling Operations\n");
00262   printf("  %u subsumptive call check/insert ops: %u producers, %u variants,\n"
00263          "  %u properly subsumed (%u table entries), %u used completed table.\n"
00264          "  %u relevant answer ident ops.  %u consumptions via answer list.\n",
00265          NumSubOps_CallCheckInsert,             NumSubOps_ProducerCall,
00266          NumSubOps_VariantCall,                 NumSubOps_SubsumedCall,
00267          NumSubOps_SubsumedCallEntry,           NumSubOps_CallToCompletedTable,
00268          NumSubOps_IdentifyRelevantAnswers,     NumSubOps_AnswerConsumption);
00269   {
00270     long ttl_ops = ans_chk_ins + NumSubOps_AnswerCheckInsert,
00271          ttl_ins = ans_inserts + NumSubOps_AnswerInsert;
00272 
00273     printf("  %ld variant call check/insert ops: %ld producers, %ld variants.\n"
00274            "  %ld answer check/insert ops: %ld unique inserts, %ld redundant.\n",
00275            subg_chk_ins, subg_inserts, subg_chk_ins - subg_inserts,
00276            ttl_ops, ttl_ins, ttl_ops - ttl_ins);
00277   }
00278   printf("\n");
00279 
00280   if (de_count > 0) {
00281     printf(" %6d DEs in the tables (space: %5ld bytes allocated, %5ld in use)\n",
00282            de_count, de_space_alloc, de_space_used);
00283     printf(" %6d DLs in the tables (space: %5ld bytes allocated, %5ld in use)\n",
00284            dl_count, dl_space_alloc, dl_space_used);
00285     printf("\n");
00286   }
00287 
00288 #ifdef GC
00289   printf("\n");
00290   print_gc_statistics();
00291 #endif
00292 
00293   printf("Time: %.3f sec. cputime,  %.3f sec. elapsetime\n",
00294          ttt.time_count, elapstime);
00295 }
00296 
00297 /**********************************************************************/
00298 #else /* Below, the MT version */
00299 /**********************************************************************/
00300 
00301 void total_stat(CTXTdeclc double elapstime) {
00302 
00303   NodeStats
00304     tbtn,               /* Table Basic Trie Nodes */
00305     abtn,               /* Asserted Basic Trie Nodes */
00306     aln,                /* Answer List Nodes */
00307     varsf,              /* Variant Subgoal Frames */
00308 
00309     pri_tbtn,           /* Private Table Basic Trie Nodes */
00310     pri_tstn,           /* Private Time Stamp Trie Nodes */
00311     pri_aln,            /* Private Answer List Nodes */
00312     pri_tsi,            /* Private Time Stamp Indices (Index Entries/Nodes) */
00313     pri_varsf,          /* Private Variant Subgoal Frames */
00314     pri_prodsf,         /* Private Subsumptive Producer Subgoal Frames */
00315     pri_conssf;         /* Private Subsumptive Consumer Subgoal Frames */
00316 
00317   HashStats
00318     abtht,              /* Asserted Basic Trie Hash Tables */
00319     tbtht,              /* Table Basic Trie Hash Tables */
00320 
00321     pri_tbtht,          /* Table Basic Trie Hash Tables */
00322     pri_tstht;          /* Time Stamp Trie Hash Tables */
00323   
00324   unsigned long
00325     total_alloc, total_used,
00326     tablespace_alloc, tablespace_used,
00327     shared_tablespace_alloc, shared_tablespace_used,
00328     private_tablespace_alloc, private_tablespace_used,
00329     trieassert_alloc, trieassert_used,
00330     gl_avail, tc_avail,
00331     de_space_alloc, de_space_used,
00332     dl_space_alloc, dl_space_used,
00333     pspacetot;
00334 
00335   int
00336     num_de_blocks, num_dl_blocks,
00337     de_count, dl_count,
00338     i;
00339 
00340   tbtn = node_statistics(&smTableBTN);
00341   tbtht = hash_statistics(&smTableBTHT);
00342   varsf = subgoal_statistics(CTXTc &smVarSF);
00343   aln = node_statistics(&smALN);
00344 
00345   pri_tbtn = node_statistics(private_smTableBTN);
00346   pri_tbtht = hash_statistics(private_smTableBTHT);
00347   pri_varsf = subgoal_statistics(CTXTc private_smVarSF);
00348   pri_prodsf = subgoal_statistics(CTXTc private_smProdSF);
00349   pri_conssf = subgoal_statistics(CTXTc private_smConsSF);
00350   pri_aln = node_statistics(private_smALN);
00351   pri_tstn = node_statistics(private_smTSTN);
00352   pri_tstht = hash_statistics(private_smTSTHT);
00353   pri_tsi = node_statistics(private_smTSIN);
00354 
00355   shared_tablespace_alloc = CurrentSharedTableSpaceAlloc(tbtn,tbtht,varsf,aln);
00356 
00357   private_tablespace_alloc = 
00358     CurrentPrivateTableSpaceAlloc(pri_tbtn,pri_tbtht,pri_varsf,pri_prodsf,
00359                           pri_conssf,pri_aln,pri_tstn,pri_tstht,pri_tsi);
00360   private_tablespace_used = 
00361     CurrentPrivateTableSpaceUsed(pri_tbtn,pri_tbtht,pri_varsf,pri_prodsf,
00362                           pri_conssf,pri_aln,pri_tstn,pri_tstht,pri_tsi);
00363 
00364   shared_tablespace_used = CurrentSharedTableSpaceUsed(tbtn,tbtht,varsf,aln);
00365 
00366   tablespace_alloc = shared_tablespace_alloc + private_tablespace_alloc;
00367   tablespace_used =  shared_tablespace_used + private_tablespace_used;
00368 
00369   abtn = node_statistics(&smAssertBTN);
00370   abtht = hash_statistics(&smAssertBTHT);
00371   trieassert_alloc =
00372     NodeStats_SizeAllocNodes(abtn) + HashStats_SizeAllocTotal(abtht);
00373   trieassert_used =
00374     NodeStats_SizeUsedNodes(abtn) + HashStats_SizeUsedTotal(abtht);
00375 
00376   gl_avail = (top_of_localstk - top_of_heap - 1) * sizeof(Cell);
00377   tc_avail = (top_of_cpstack - (CPtr)top_of_trail - 1) * sizeof(Cell);
00378   
00379   de_space_alloc = allocated_de_space(& num_de_blocks);
00380   de_space_used = de_space_alloc - unused_de_space();
00381   de_count = (de_space_used - num_de_blocks * sizeof(Cell)) /
00382              sizeof(struct delay_element);
00383 
00384   dl_space_alloc = allocated_dl_space(& num_dl_blocks);
00385   dl_space_used = dl_space_alloc - unused_dl_space();
00386   dl_count = (dl_space_used - num_dl_blocks * sizeof(Cell)) /
00387              sizeof(struct delay_list);
00388 
00389 
00390   pspacetot = 0;
00391   for (i=0; i<NUM_CATS_SPACE; i++) 
00392     if (i != TABLE_SPACE) pspacetot += pspacesize[i];
00393 
00394   total_alloc =
00395     pspacetot  +  trieassert_alloc  +  pspacesize[TABLE_SPACE] +
00396     de_space_alloc + dl_space_alloc;
00397 
00398   total_used  =
00399     pspacetot  +  trieassert_used  + 
00400     pspacesize[TABLE_SPACE]-(tablespace_alloc-tablespace_used) +
00401     de_space_used + dl_space_used;
00402 
00403 
00404   printf("\n");
00405   printf("Non-stack memory for process:\n");
00406   printf("  permanent space %12ld bytes: %12ld in use, %12ld free\n",
00407          pspacetot + trieassert_alloc, pspacetot + trieassert_used,
00408          trieassert_alloc - trieassert_used);
00409   if (trieassert_alloc > 0)
00410     printf("    trie-asserted                     %12ld         %12ld\n",
00411            trieassert_used,trieassert_alloc-trieassert_used);
00412   for (i=0; i<NUM_CATS_SPACE; i++) 
00413     if (pspacesize[i] > 0 && i != TABLE_SPACE)
00414       printf("    %s                      %12ld\n",pspace_cat[i],pspacesize[i]);
00415   printf("  SLG table space %12ld bytes: %12ld in use, %12ld free\n",
00416          pspacesize[TABLE_SPACE]-trieassert_alloc,  
00417          pspacesize[TABLE_SPACE]-trieassert_alloc-(tablespace_alloc-tablespace_used),
00418          tablespace_alloc - tablespace_used);
00419   printf("Total             %12ld bytes: %12ld in use, %12ld free\n",
00420          total_alloc, total_used, total_alloc - total_used);
00421   printf("\n");
00422 
00423   printf("Stack info for thread %d:\n",xsb_thread_id);
00424   printf("  glob/loc space  %12ld bytes: %12ld in use, %12ld free\n",
00425          glstack.size * K, glstack.size * K - gl_avail, gl_avail);
00426   printf("    global                            %12ld bytes\n",
00427          (long)((top_of_heap - (CPtr)glstack.low + 1) * sizeof(Cell)));
00428   printf("    local                             %12ld bytes\n",
00429          (long)(((CPtr)glstack.high - top_of_localstk) * sizeof(Cell)));
00430   printf("  trail/cp space  %12ld bytes: %12ld in use, %12ld free\n",
00431          tcpstack.size * K, tcpstack.size * K - tc_avail, tc_avail);
00432   printf("    trail                             %12ld bytes\n",
00433          (long)((top_of_trail - (CPtr *)tcpstack.low + 1) * sizeof(CPtr)));
00434   printf("    choice point                      %12ld bytes\n",
00435          (long)(((CPtr)tcpstack.high - top_of_cpstack) * sizeof(Cell)));
00436   printf("  SLG unific. space %10ld bytes: %12ld in use, %12ld free\n",
00437          pdl.size * K, (unsigned long)(pdlreg+1) - (unsigned long)pdl.high,
00438          pdl.size * K - ((unsigned long)(pdlreg+1)-(unsigned long)pdl.high)); 
00439   printf("  SLG completion  %12ld bytes: %12ld in use, %12ld free\n",
00440          (unsigned long)complstack.size * K,
00441          (unsigned long)COMPLSTACKBOTTOM - (unsigned long)top_of_complstk,
00442          (unsigned long)complstack.size * K -
00443          ((unsigned long)COMPLSTACKBOTTOM - (unsigned long)top_of_complstk));
00444   printf("\n");
00445 #ifdef GC
00446   print_gc_statistics(CTXT);
00447 #endif
00448 
00449 /* TLS: Max stack stuff is probably not real useful with multiple
00450    threads -- to even get it to work correcly you'd have to use locks.
00451    So omitted below.
00452 */
00453 
00454   printf("Tabling Operations (shared and all private tables)\n");
00455   printf("  %u subsumptive call check/insert ops: %u producers, %u variants,\n"
00456          "  %u properly subsumed (%u table entries), %u used completed table.\n"
00457          "  %u relevant answer ident ops.  %u consumptions via answer list.\n",
00458          NumSubOps_CallCheckInsert,             NumSubOps_ProducerCall,
00459          NumSubOps_VariantCall,                 NumSubOps_SubsumedCall,
00460          NumSubOps_SubsumedCallEntry,           NumSubOps_CallToCompletedTable,
00461          NumSubOps_IdentifyRelevantAnswers,     NumSubOps_AnswerConsumption);
00462   {
00463     long ttl_ops = ans_chk_ins + NumSubOps_AnswerCheckInsert,
00464          ttl_ins = ans_inserts + NumSubOps_AnswerInsert;
00465 
00466     printf("  %ld variant call check/insert ops: %ld producers, %ld variants.\n"
00467            "  %ld answer check/insert ops: %ld unique inserts, %ld redundant.\n",
00468            subg_chk_ins, subg_inserts, subg_chk_ins - subg_inserts,
00469            ttl_ops, ttl_ins, ttl_ops - ttl_ins);
00470   }
00471   printf("\n");
00472 
00473   if (de_count > 0) {
00474     printf(" %6d DEs in the tables (space: %5ld bytes allocated, %5ld in use)\n",
00475            de_count, de_space_alloc, de_space_used);
00476     printf(" %6d DLs in the tables (space: %5ld bytes allocated, %5ld in use)\n",
00477            dl_count, dl_space_alloc, dl_space_used);
00478     printf("\n");
00479   }
00480 
00481   printf("%ld active user thread%s.\n",flags[NUM_THREADS],
00482          (flags[NUM_THREADS]>1?"s":""));
00483 
00484   printf("Time: %.3f sec. cputime,  %.3f sec. elapsetime\n",
00485          time_count, elapstime);
00486 }
00487 #endif
00488 
00489 /*======================================================================*/
00490 
00491 /*
00492  * Called when builtin statistics(0) is invoked.  Resets all operational
00493  * counts and max memory usage info.
00494  */
00495 
00496 #ifndef MULTI_THREAD
00497 void perproc_reset_stat(void)
00498 {
00499    tds = trace_init;
00500    reset_subsumption_stats();
00501    reset_maximum_tablespace_stats();
00502    ans_chk_ins = ans_inserts = 0;
00503    subg_chk_ins = subg_inserts = 0;
00504    time_start = cpu_time();
00505 }
00506 #else
00507 void perproc_reset_stat(void)
00508 {
00509    ans_chk_ins = ans_inserts = 0;
00510    subg_chk_ins = subg_inserts = 0;
00511    time_start = cpu_time();
00512 }
00513 
00514 #endif
00515 
00516 /*======================================================================*/
00517 
00518 #ifndef MULTI_THREAD
00519 void reset_stat_total(void)
00520 {
00521    ttt = trace_init;
00522 }
00523 #else
00524 void reset_stat_total(void)
00525 {
00526   time_start = 0;
00527 }
00528 
00529 #endif
00530 
00531 /*======================================================================*/

Generated on Wed Jul 26 13:30:43 2006 for XSB by  doxygen 1.4.5