source: trunk/src/user32/stats.cpp

Last change on this file was 21303, checked in by ydario, 16 years ago

User32 updates.

File size: 2.5 KB
Line 
1#include <os2win.h>
2#include <stats.h>
3
4#ifdef RAS
5
6RAS_TRACK_HANDLE rthDCCalls = 0;
7
8//******************************************************************************
9//******************************************************************************
10void STATS_GetDCEx(HWND hwnd, HDC hdc, HRGN hrgn, ULONG flags)
11{
12 if (!rthDCCalls) STATS_InitializeUSER32 ();
13 RasAddObject (rthDCCalls, hdc, NULL, 0);
14}
15//******************************************************************************
16//******************************************************************************
17void STATS_ReleaseDC(HWND hwnd, HDC hdc)
18{
19 if (!rthDCCalls) STATS_InitializeUSER32 ();
20 RasRemoveObject (rthDCCalls, hdc);
21}
22//******************************************************************************
23//******************************************************************************
24void STATS_DumpStatsUSER32()
25{
26 RasLogObjects (rthDCCalls, RAS_FLAG_LOG_OBJECTS);
27}
28void STATS_InitializeUSER32 (void)
29{
30 RasEnterSerialize ();
31 if (!rthDCCalls)
32 {
33 RasRegisterObjectTracking(&rthDCCalls, "DCCalls", 0, 0, NULL, NULL);
34 }
35 RasExitSerialize ();
36}
37
38void STATS_UninitializeUSER32(void)
39{
40}
41
42
43#else
44
45#ifdef DEBUG
46
47static DWORD nrwindowdcsallocated = 0;
48static DWORD nrcalls_GetDCEx = 0;
49static DWORD nrcalls_ReleaseDC = 0;
50
51//******************************************************************************
52//******************************************************************************
53void STATS_GetDCEx(HWND hwnd, HDC hdc, HRGN hrgn, ULONG flags)
54{
55 nrwindowdcsallocated++;
56 nrcalls_GetDCEx++;
57}
58//******************************************************************************
59//******************************************************************************
60void STATS_ReleaseDC(HWND hwnd, HDC hdc)
61{
62 nrwindowdcsallocated--;
63 nrcalls_ReleaseDC++;
64}
65//******************************************************************************
66//******************************************************************************
67void STATS_DumpStatsUSER32()
68{
69 dprintf(("************* USER32 STATISTICS BEGIN *****************"));
70 dprintf(("Total nr of GetDCEx calls %d", nrcalls_GetDCEx));
71 dprintf(("Total nr of ReleaseDC calls %d", nrcalls_ReleaseDC));
72 dprintf(("Leaked DCs: %d", nrwindowdcsallocated));
73 dprintf(("************* USER STATISTICS END *****************"));
74}
75//******************************************************************************
76//******************************************************************************
77
78
79#endif //DEBUG
80#endif //RAS
Note: See TracBrowser for help on using the repository browser.