#include "calInt.h"
Go to the source code of this file.
Functions | |
static void | CalBddPrintProfileAux (Cal_BddManager_t *bddManager, long *levelCounts, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp) |
static void | chars (char c, int n, FILE *fp) |
void | Cal_BddPrintProfile (Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp) |
void | Cal_BddPrintProfileMultiple (Cal_BddManager bddManager, Cal_Bdd *userBdds, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp) |
void | Cal_BddPrintFunctionProfile (Cal_BddManager bddManager, Cal_Bdd f, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp) |
void | Cal_BddPrintFunctionProfileMultiple (Cal_BddManager bddManager, Cal_Bdd *userBdds, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp) |
Variables | |
static char | profileWidth [] = "XXXXXXXXX" |
void Cal_BddPrintFunctionProfile | ( | Cal_BddManager | bddManager, | |
Cal_Bdd | f, | |||
Cal_VarNamingFn_t | varNamingProc, | |||
char * | env, | |||
int | lineLength, | |||
FILE * | fp | |||
) |
Function********************************************************************
Synopsis [Cal_BddPrintFunctionProfile is like Cal_BddPrintProfile except it displays a function profile for f]
Description [optional]
SideEffects [None]
SeeAlso [optional]
Definition at line 161 of file calPrintProfile.c.
00167 { 00168 long *levelCounts; 00169 if (CalBddPreProcessing(bddManager, 1, f)){ 00170 return; 00171 } 00172 levelCounts = Cal_MemAlloc(long, bddManager->numVars+1); 00173 Cal_BddFunctionProfile(bddManager, f, levelCounts); 00174 CalBddPrintProfileAux(bddManager, levelCounts, varNamingProc, env, 00175 lineLength, fp); 00176 Cal_MemFree(levelCounts); 00177 }
void Cal_BddPrintFunctionProfileMultiple | ( | Cal_BddManager | bddManager, | |
Cal_Bdd * | userBdds, | |||
Cal_VarNamingFn_t | varNamingProc, | |||
char * | env, | |||
int | lineLength, | |||
FILE * | fp | |||
) |
Function********************************************************************
Synopsis [Cal_BddPrintFunctionProfileMultiple is like Cal_BddPrintFunctionProfile except for multiple BDDs]
Description [optional]
SideEffects [None]
SeeAlso [optional]
Definition at line 193 of file calPrintProfile.c.
00199 { 00200 long *levelCounts; 00201 if (CalBddArrayPreProcessing(bddManager, userBdds) == 0){ 00202 return; 00203 } 00204 levelCounts = Cal_MemAlloc(long, bddManager->numVars+1); 00205 Cal_BddFunctionProfileMultiple(bddManager, userBdds, levelCounts); 00206 CalBddPrintProfileAux(bddManager, levelCounts, varNamingProc, env, lineLength, fp); 00207 Cal_MemFree(levelCounts); 00208 }
void Cal_BddPrintProfile | ( | Cal_BddManager | bddManager, | |
Cal_Bdd | fUserBdd, | |||
Cal_VarNamingFn_t | varNamingProc, | |||
char * | env, | |||
int | lineLength, | |||
FILE * | fp | |||
) |
AutomaticEnd Function********************************************************************
Synopsis [Displays the node profile for f on fp. lineLength specifies the maximum line length. varNamingFn is as in Cal_BddPrintBdd.]
Description [optional]
SideEffects [None]
SeeAlso [optional]
Definition at line 95 of file calPrintProfile.c.
00101 { 00102 long *levelCounts; 00103 00104 if (CalBddPreProcessing(bddManager, 1, fUserBdd) == 0){ 00105 return; 00106 } 00107 levelCounts = Cal_MemAlloc(long, bddManager->numVars+1); 00108 Cal_BddProfile(bddManager, fUserBdd, levelCounts, 1); 00109 CalBddPrintProfileAux(bddManager, levelCounts, varNamingProc, env, 00110 lineLength, fp); 00111 Cal_MemFree(levelCounts); 00112 }
void Cal_BddPrintProfileMultiple | ( | Cal_BddManager | bddManager, | |
Cal_Bdd * | userBdds, | |||
Cal_VarNamingFn_t | varNamingProc, | |||
char * | env, | |||
int | lineLength, | |||
FILE * | fp | |||
) |
Function********************************************************************
Synopsis [Cal_BddPrintProfileMultiple is like Cal_BddPrintProfile except it displays the profile for a set of BDDs]
Description [optional]
SideEffects [None]
SeeAlso [optional]
Definition at line 127 of file calPrintProfile.c.
00134 { 00135 long *levelCounts; 00136 00137 if (CalBddArrayPreProcessing(bddManager, userBdds) == 0){ 00138 return; 00139 } 00140 levelCounts = Cal_MemAlloc(long, bddManager->numVars+1); 00141 Cal_BddProfileMultiple(bddManager, userBdds, levelCounts, 1); 00142 CalBddPrintProfileAux(bddManager, levelCounts, varNamingProc, env, lineLength, fp); 00143 Cal_MemFree(levelCounts); 00144 }
static void CalBddPrintProfileAux | ( | Cal_BddManager_t * | bddManager, | |
long * | levelCounts, | |||
Cal_VarNamingFn_t | varNamingProc, | |||
char * | env, | |||
int | lineLength, | |||
FILE * | fp | |||
) | [static] |
AutomaticStart
Function********************************************************************
Synopsis [Prints a profile to the file given by fp. The varNamingProc is as in Cal_BddPrintBdd. lineLength gives the line width to scale the profile to.]
Description [optional]
SideEffects [required]
SeeAlso [optional]
Definition at line 227 of file calPrintProfile.c.
00234 { 00235 long i, n; 00236 int l; 00237 char *name; 00238 int maxPrefixLen; 00239 int maxProfileWidth; 00240 int histogramColumn; 00241 int histogramWidth; 00242 int profileScale; 00243 long total; 00244 00245 n = bddManager->numVars; 00246 /* max_... initialized with values for leaf nodes */ 00247 maxPrefixLen = 5; 00248 maxProfileWidth = levelCounts[n]; 00249 total = levelCounts[n]; 00250 for(i = 0; i < n; i++){ 00251 if(levelCounts[i]){ 00252 sprintf(profileWidth, "%ld", levelCounts[i]); 00253 l = strlen(CalBddVarName(bddManager, 00254 bddManager->varBdds[bddManager->indexToId[i]], 00255 varNamingProc, env)) + strlen((char *)profileWidth); 00256 if(l > maxPrefixLen){ 00257 maxPrefixLen = l; 00258 } 00259 if(levelCounts[i] > maxProfileWidth){ 00260 maxProfileWidth = levelCounts[i]; 00261 } 00262 total += levelCounts[i]; 00263 } 00264 } 00265 histogramColumn = maxPrefixLen+3; 00266 histogramWidth = lineLength-histogramColumn-1; 00267 if(histogramWidth < 20) 00268 histogramWidth = 20; /* Random minimum width */ 00269 if(histogramWidth >= maxProfileWidth){ 00270 profileScale = 1; 00271 } 00272 else{ 00273 profileScale = (maxProfileWidth+histogramWidth-1)/histogramWidth; 00274 } 00275 for(i = 0; i < n; ++i){ 00276 if(levelCounts[i]){ 00277 name = CalBddVarName(bddManager, 00278 bddManager->varBdds[bddManager->indexToId[i]], 00279 varNamingProc, env); 00280 fputs(name, fp); 00281 fputc(':', fp); 00282 sprintf(profileWidth, "%ld", levelCounts[i]); 00283 chars(' ', (int)(maxPrefixLen-strlen(name)-strlen(profileWidth)+1), fp); 00284 fputs(profileWidth, fp); 00285 fputc(' ', fp); 00286 chars('#', levelCounts[i]/profileScale, fp); 00287 fputc('\n', fp); 00288 } 00289 } 00290 fputs("leaf:", fp); 00291 sprintf(profileWidth, "%ld", levelCounts[n]); 00292 chars(' ', (int)(maxPrefixLen-4-strlen(profileWidth)+1), fp); 00293 fputs(profileWidth, fp); 00294 fputc(' ', fp); 00295 chars('#', levelCounts[n]/profileScale, fp); 00296 fputc('\n', fp); 00297 fprintf(fp, "Total: %ld\n", total); 00298 }
static void chars | ( | char | c, | |
int | n, | |||
FILE * | fp | |||
) | [static] |
Function********************************************************************
Synopsis []
Description [optional]
SideEffects [required]
SeeAlso [optional]
Definition at line 312 of file calPrintProfile.c.
char profileWidth[] = "XXXXXXXXX" [static] |
CFile***********************************************************************
FileName [calPrintProfile.c]
PackageName [cal]
Synopsis [Routines for printing various profiles for a BDD.]
Description [ ]
SeeAlso [optional]
Author [Jagesh Sanghavi (sanghavi@eecs.berkeley.edu) Rajeev Ranjan (rajeev@eecs.berkeley.edu) Originally written by David Long. ]
Copyright [Copyright (c) 1994-1996 The Regents of the Univ. of California. All rights reserved.
Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following two paragraphs appear in all copies of this software.
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
Revision [
]
Definition at line 59 of file calPrintProfile.c.