abc/src/bdd/cudd/cuddCheck.c
/**Function********************************************************************

  Synopsis    [Prints information about the heap.]

  Description [Prints to the manager's stdout the number of live nodes for each
  level of the DD heap that contains at least one live node.  It also
  prints a summary containing:
  <ul>
  <li> total number of tables;
  <li> number of tables with live nodes;
  <li> table with the largest number of live nodes;
  <li> number of nodes in that table.
  </ul>
  If more than one table contains the maximum number of live nodes,
  only the one of lowest index is reported. Returns 1 in case of success
  and 0 otherwise.]

  SideEffects [None]

  SeeAlso     []

******************************************************************************/
Function
Synopsis    [Prints information about the heap.]

Description [Prints to the manager's stdout the number of live nodes for each
level of the DD heap that contains at least one live node.  It also
prints a summary containing:

 total number of tables;
 number of tables with live nodes;
 table with the largest number of live nodes;
 number of nodes in that table.

If more than one table contains the maximum number of live nodes,
only the one of lowest index is reported. Returns 1 in case of success
and 0 otherwise.]




Function Synopsis [ Prints information about the heap . ] Description [ Prints to the manager ' s stdout the number of live nodes for each level of the DD heap that contains at least one live node . It also prints a summary containing : total number of tables ; number of tables with live nodes ; table with the largest number of live nodes ; number of nodes in that table . If more than one table contains the maximum number of live nodes only the one of lowest index is reported . Returns 1 in case of success and 0 otherwise . ]
int
cuddHeapProfile(
  DdManager * dd)
{
    int ntables = dd->size;
    DdSubtable *subtables = dd->subtables;
    int i,              
        nodes,          
        retval,         
        largest = -1,   
        maxnodes = -1,  
        nonempty = 0;   
#if SIZEOF_VOID_P == 8
    retval = fprintf(dd->out,"*** DD heap profile for 0x%lx ***\n",
                     (ptruint) dd);
#else
    retval = fprintf(dd->out,"*** DD heap profile for 0x%x ***\n",
                     (ptruint) dd);
#endif
    if (retval == EOF) return 0;
    for (i=0; i<ntables; i++) {
        nodes = subtables[i].keys - subtables[i].dead;
        if (nodes) {
            nonempty++;
            retval = fprintf(dd->out,"%5d: %5d nodes\n", i, nodes);
            if (retval == EOF) return 0;
            if (nodes > maxnodes) {
                maxnodes = nodes;
                largest = i;
            }
        }
    }
    nodes = dd->constants.keys - dd->constants.dead;
    if (nodes) {
        nonempty++;
        retval = fprintf(dd->out,"const: %5d nodes\n", nodes);
        if (retval == EOF) return 0;
        if (nodes > maxnodes) {
            maxnodes = nodes;
            largest = CUDD_CONST_INDEX;
        }
    }
    retval = fprintf(dd->out,"Summary: %d tables, %d non-empty, largest: %d ",
          ntables+1, nonempty, largest);
    if (retval == EOF) return 0;
    retval = fprintf(dd->out,"(with %d nodes)\n", maxnodes);
    if (retval == EOF) return 0;
    return(1);
}
int cuddHeapProfile ( DdManager * dd ) { int ntables = dd -> size ; DdSubtable * subtables = dd -> subtables ; int i , nodes , retval , largest = -1 , maxnodes = -1 , nonempty = 0 ; #if SIZEOF_VOID_P == 8 retval = fprintf ( dd -> out , " \n " , ( ptruint ) dd ) ; #else retval = fprintf ( dd -> out , " \n " , ( ptruint ) dd ) ; #endif if ( retval == EOF ) return 0 ; for ( i = 0 ; i < ntables ; i ++ ) { nodes = subtables [ i ] . keys - subtables [ i ] . dead ; if ( nodes ) { nonempty ++ ; retval = fprintf ( dd -> out , " \n " , i , nodes ) ; if ( retval == EOF ) return 0 ; if ( nodes > maxnodes ) { maxnodes = nodes ; largest = i ; } } } nodes = dd -> constants . keys - dd -> constants . dead ; if ( nodes ) { nonempty ++ ; retval = fprintf ( dd -> out , " \n " , nodes ) ; if ( retval == EOF ) return 0 ; if ( nodes > maxnodes ) { maxnodes = nodes ; largest = CUDD_CONST_INDEX ; } } retval = fprintf ( dd -> out , " " , ntables + 1 , nonempty , largest ) ; if ( retval == EOF ) return 0 ; retval = fprintf ( dd -> out , " \n " , maxnodes ) ; if ( retval == EOF ) return 0 ; return ( 1 ) ; }
Function
Synopsis    [Prints information about the heap.]
Function Synopsis [ Prints information about the heap . ]
/* loop index */ /* live nodes in i-th layer */ /* return value of fprintf */ /* index of the table with most live nodes */ /* maximum number of live nodes in a table */ /* number of tables with live nodes */ /* Print header. */ /* Print number of live nodes for each nonempty table. */ /* Print summary. */