Changeset 7627 for trunk/src


Ignore:
Timestamp:
Dec 13, 2001, 4:32:57 PM (24 years ago)
Author:
sandervl
Message:

added statistics

Location:
trunk/src
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/initkernel32.cpp

    r7567 r7627  
    1 /* $Id: initkernel32.cpp,v 1.11 2001-12-07 14:13:37 sandervl Exp $
     1/* $Id: initkernel32.cpp,v 1.12 2001-12-13 15:32:34 sandervl Exp $
    22 *
    33 * KERNEL32 DLL entry point
     
    5757#include <codepage.h>
    5858#include <process.h>
     59#include <stats.h>
    5960
    6061#define DBG_LOCALLOG    DBG_initterm
     
    226227    DestroyCodeHeap();
    227228
     229#ifdef DEBUG
     230    ULONG totalmemalloc, nrcalls_malloc, nrcalls_free;
     231
     232    getcrtstat(&nrcalls_malloc, &nrcalls_free, &totalmemalloc);
     233    dprintf(("*************  KERNEL32 STATISTICS BEGIN *****************"));
     234    dprintf(("Total nr of malloc calls %d", nrcalls_malloc));
     235    dprintf(("Total nr of free   calls %d", nrcalls_free));
     236    dprintf(("Leaked memory: %d bytes", totalmemalloc));
     237    dprintf(("*************  KERNEL32 STATISTICS END   *****************"));
     238#endif
     239
    228240    //NOTE: Must be done after DestroyTIB
    229241    ClosePrivateLogFiles();
  • trunk/src/odincrt/malloc.cpp

    r5090 r7627  
    1 /* $Id: malloc.cpp,v 1.5 2001-02-11 10:32:51 sandervl Exp $ */
     1/* $Id: malloc.cpp,v 1.6 2001-12-13 15:32:17 sandervl Exp $ */
    22/*
    33 * Project Odin Software License can be found in LICENSE.TXT
     
    2020void * _IMPORT _LNK_CONV _debug_ucalloc(Heap_t , size_t, size_t ,const char *,size_t);
    2121
     22#ifdef DEBUG
     23unsigned long nrcalls_malloc = 0;
     24unsigned long nrcalls_free   = 0;
     25unsigned long totalmemalloc  = 0;
     26
     27void _LNK_CONV getcrtstat(unsigned long *pnrcalls_malloc,
     28                          unsigned long *pnrcalls_free,
     29                          unsigned long *ptotalmemalloc)
     30{
     31    *pnrcalls_malloc = nrcalls_malloc;
     32    *pnrcalls_free   = nrcalls_free;
     33    *ptotalmemalloc  = totalmemalloc;
     34}
     35#endif
     36
    2237void * _LNK_CONV os2calloc( size_t a, size_t b )
    2338{
     
    2540    void *rc;
    2641
     42#ifdef DEBUG
     43        totalmemalloc += a*b;
     44        nrcalls_malloc++;
     45#endif
    2746        rc = calloc(a,b);
    2847        SetFS(sel);
     
    3453    unsigned short sel = RestoreOS2FS();
    3554
     55#ifdef DEBUG
     56        nrcalls_free++;
     57        totalmemalloc -= _msize(a);
     58#endif
    3659        free(a);
    3760        SetFS(sel);
     
    4366    void *rc;
    4467
     68
     69#ifdef DEBUG
     70        totalmemalloc += a;
     71        nrcalls_malloc++;
     72#endif
    4573        rc = malloc(a);
    4674        SetFS(sel);
     
    5381    void *rc;
    5482
     83#ifdef DEBUG
     84        totalmemalloc += (b - _msize(a));
     85#endif
     86
    5587        rc = realloc(a, b);
    5688        SetFS(sel);
     
    6395    void *rc;
    6496
     97#ifdef DEBUG
     98        totalmemalloc += a*b;
     99        nrcalls_malloc++;
     100#endif
     101
    65102        rc = _debug_calloc(a,b,c,d);
    66103        SetFS(sel);
     
    72109    unsigned short sel = RestoreOS2FS();
    73110
     111
     112#ifdef DEBUG
     113        nrcalls_free++;
     114        totalmemalloc -= _msize(a);
     115#endif
    74116        _debug_free(a,b,c);
    75117        SetFS(sel);
     
    81123    void *rc;
    82124
     125#ifdef DEBUG
     126        totalmemalloc += a;
     127        nrcalls_malloc++;
     128#endif
    83129        rc = _debug_calloc(1,a,b,c);
    84130        SetFS(sel);
     
    91137    void *rc;
    92138
     139#ifdef DEBUG
     140        totalmemalloc += (b - _msize(a));
     141#endif
    93142        rc = _debug_realloc(a,b,c,d);
    94143        SetFS(sel);
     
    101150    void *rc;
    102151
     152#ifdef DEBUG
     153        totalmemalloc += b;
     154        nrcalls_malloc++;
     155#endif
    103156        rc = _umalloc(a,b);
    104157        SetFS(sel);
     
    111164    void *rc;
    112165
     166#ifdef DEBUG
     167        totalmemalloc += b*c;
     168        nrcalls_malloc++;
     169#endif
    113170        rc = _ucalloc(a,b,c);
    114171        SetFS(sel);
     
    121178    void *rc;
    122179
     180#ifdef DEBUG
     181        totalmemalloc += b;
     182        nrcalls_malloc++;
     183#endif
    123184        rc = _debug_ucalloc(a, 1, b,c,d);
    124185        SetFS(sel);
     
    131192    void *rc;
    132193
     194#ifdef DEBUG
     195        totalmemalloc += b*c;
     196        nrcalls_malloc++;
     197#endif
    133198        rc = _debug_ucalloc(a,b,c,d,e);
    134199        SetFS(sel);
  • trunk/src/odincrt/odincrtd.def

    r6373 r7627  
    1 ; $Id: odincrtd.def,v 1.4 2001-07-20 15:40:30 sandervl Exp $
     1; $Id: odincrtd.def,v 1.5 2001-12-13 15:32:17 sandervl Exp $
    22; Odin VAC++ 3.08 shared multithreaded runtime
    33LIBRARY ODINCRTD INITINSTANCE TERMINSTANCE
     
    954954    __divi64                                           @1031 NONAME
    955955    __divu64                                           @1032 NONAME
     956
     957    getcrtstat                                         @1033 NONAME
  • trunk/src/user32/Makefile

    r6961 r7627  
    1 # $Id: Makefile,v 1.97 2001-10-07 11:48:27 sandervl Exp $
     1# $Id: Makefile,v 1.98 2001-12-13 15:32:57 sandervl Exp $
    22
    33#
     
    101101$(OBJDIR)\oldnls32.obj \
    102102$(OBJDIR)\user32rsrc.obj \
    103 $(OBJDIR)\oslibprf.obj
     103$(OBJDIR)\oslibprf.obj \
     104$(OBJDIR)\stats.obj
    104105
    105106
  • trunk/src/user32/dc.cpp

    r6941 r7627  
    1 /* $Id: dc.cpp,v 1.112 2001-10-03 18:37:51 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.113 2001-12-13 15:32:57 sandervl Exp $ */
    22
    33/*
     
    3636#include <codepage.h>
    3737#include <wingdi32.h>
     38#include <stats.h>
    3839
    3940#define INCLUDED_BY_DC
     
    874875        UnselectGDIObjects(hdc);
    875876        rc = O32_ReleaseDC (0, hdc);
     877        STATS_ReleaseDC(hwnd, hdc);
    876878    }
    877879
     
    946948
    947949            RELEASE_WNDOBJ(wnd);
     950
     951            STATS_GetDCEx(hwnd, hps, hrgn, flags);
     952
    948953            return (HDC)hps;
    949954        }
     
    10811086    RELEASE_WNDOBJ(wnd);
    10821087
     1088
     1089    STATS_GetDCEx(hwnd, pHps->hps, hrgn, flags);
    10831090    return (HDC)pHps->hps;
    10841091
  • trunk/src/user32/inituser32.cpp

    r7622 r7627  
    1 /* $Id: inituser32.cpp,v 1.8 2001-12-13 12:24:42 sandervl Exp $ */
     1/* $Id: inituser32.cpp,v 1.9 2001-12-13 15:32:57 sandervl Exp $ */
    22/*
    33 * USER32 DLL entry point
     
    4747#include <exitlist.h>
    4848#include <initdll.h>
     49#include <stats.h>
    4950
    5051#define DBG_LOCALLOG    DBG_initterm
     
    262263   SYSCOLOR_Save();
    263264   CloseSpyQueue();
     265   STATS_DumpStats();
    264266   dprintf(("user32 exit done\n"));
    265267}
Note: See TracChangeset for help on using the changeset viewer.