home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / extras / memlib / mwreport.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-24  |  1.6 KB  |  54 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  2. * |_o_o|\\ Copyright (c) 1989 The Software Distillery.                    *
  3. * |. o.| ||          All Rights Reserved                                  *
  4. * | .  | ||          Written by Doug Walker                               *
  5. * | o  | ||          The Software Distillery                              *
  6. * |  . |//           235 Trillingham Lane                                 *
  7. * ======             Cary, NC 27513                                       *
  8. *                    BBS:(919)-471-6436                                   *
  9. \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  10.  
  11. #include "mempriv.h"
  12.  
  13. extern struct MWGlobal mwg;
  14.  
  15. void MWReport(char *title, long level)
  16. {
  17.    struct MWAlc *mwa;
  18.  
  19.    if(!(mwg.flags & MWF_ACTIVE)) return;
  20.  
  21.    MWCheck();
  22.  
  23.    if(mwg.flags & MWF_NOLOG) return;
  24.  
  25.    if(level == MWR_NONE) return;
  26.  
  27.  
  28.    MWPrintf("\7\n\n********** CURRENT MEMORY USAGE SUMMARY\n");
  29.    if(title) MWPrintf("%s\n", title);
  30.  
  31.    MWPrintf("\nCurrent chip usage = %ld bytes in %ld allocations\n", 
  32.             mwg.sum[MWT_CHIP], mwg.num[MWT_CHIP]);
  33.  
  34.    MWPrintf("Current fast usage = %ld bytes in %ld allocations\n", 
  35.             mwg.sum[MWT_FAST], mwg.num[MWT_FAST]);
  36.  
  37.    MWPrintf("Peak chip usage = %ld bytes; Peak fast usage = %ld bytes\n\n",
  38.       mwg.max[MWT_CHIP], mwg.max[MWT_FAST]);
  39.  
  40.    if(level == MWR_SUM) return;
  41.  
  42.    MWPrintf("********** CURRENT MEMORY USAGE DETAIL\n\n"); 
  43.  
  44.    if(mwg.first)
  45.    {
  46.       for(mwa=mwg.first; mwa; mwa=mwa->next)
  47.          MWPrintAlc(mwa);
  48.    }
  49.    else
  50.       MWPrintf("No memory currently allocated\n");
  51.  
  52.    MWPrintf("\n**********\n\n"); 
  53. }
  54.