/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* |_o_o|\\ Copyright (c) 1989 The Software Distillery.                    *
* |. o.| ||          All Rights Reserved                                  *
* | .  | ||          Written by Doug Walker                               *
* | o  | ||          The Software Distillery                              *
* |  . |//           235 Trillingham Lane                                 *
* ======             Cary, NC 27513                                       *
*                    BBS:(919)-471-6436                                   *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include "mempriv.h"

extern struct MWGlobal mwg;

void MWReport(title, level)
char *title;
int level;
{
   struct MWAlc *mwa;

   if(!(mwg.flags & MWF_ACTIVE)) return;

   if(!(mwg.flags & MWF_NOCHECK)) MWCheck();

   if(level == MWR_NONE) return;

   if(!mwg.dbfh) return;

   MSG(mwg.dbfh, "********** MEMORY USAGE SUMMARY ");
   if(title) MSG(mwg.dbfh, title);

   MSG(mwg.dbfh, "\n\nCurrent chip usage = ");
   MWPrint(NULL, 3, mwg.sum[MWT_CHIP], mwg.num[MWT_CHIP]);

   MSG(mwg.dbfh, "Current fast usage = ");
   MWPrint(NULL, 3, mwg.sum[MWT_FAST], mwg.num[MWT_FAST]);

   MWPrint(NULL, 4, mwg.max[MWT_CHIP], mwg.max[MWT_FAST]);

   if(level == MWR_SUM) return;

   MSG(mwg.dbfh, "********** MEMORY USAGE DETAIL\n\n"); 

   /*           0x00000000 [00000] ... */
   for(mwa=mwg.first; mwa; mwa=mwa->next)
      MWPrint(mwa, 0, 0, 0);

   MSG(mwg.dbfh, "\n**********\n\n"); 
}
