- Timestamp:
- Nov 13, 2001, 12:06:03 AM (24 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.DEF
r7010 r7326 1 ; $Id: KERNEL32.DEF,v 1.12 5 2001-10-11 00:59:42phaller Exp $1 ; $Id: KERNEL32.DEF,v 1.126 2001-11-12 23:04:56 phaller Exp $ 2 2 3 3 ;Basis is Windows95 KERNEL32 … … 1202 1202 PerfView_DumpProfile @3104 NONAME 1203 1203 PerfView_Write @3105 NONAME 1204 _dbg_GetLastCallerName@0 @3106 NONAME 1205 _dbg_ThreadPushCall@4 @3107 NONAME 1206 _dbg_ThreadPopCall@0 @3108 NONAME 1207 -
trunk/src/kernel32/perfview.cpp
r7027 r7326 1 /* $Id: perfview.cpp,v 1. 3 2001-10-12 03:48:06phaller Exp $ */1 /* $Id: perfview.cpp,v 1.4 2001-11-12 23:04:57 phaller Exp $ */ 2 2 3 3 /* … … 19 19 // insert "nullified" dummies here to save space in the executable image 20 20 void PerfView_Initialize(void) {} 21 void PerfView_RegisterCall(char* pszFunctionName, 21 void PerfView_RegisterCall(char* pszCallerName, 22 char* pszFunctionName, 22 23 unsigned long int nTicks) {} 23 24 … … 87 88 88 89 // register a call to a function 89 void _Optlink PerfView_RegisterCall(char* pszFunctionName, 90 void _Optlink PerfView_RegisterCall(char* pszCallerName, 91 char* pszFunctionName, 90 92 unsigned long int nTicks) 91 93 { … … 127 129 if (nTicks > p->nMaximumTicks) 128 130 p->nMaximumTicks = nTicks; 131 132 133 // add call-path tracing 134 if (NULL != pszCallerName) 135 { 136 // build path name 137 char szBuf[256]; 138 strcpy(szBuf, pszCallerName); 139 strcat(szBuf, "->"); 140 strcat(szBuf, pszFunctionName); 141 142 // check if that particular callpath is registered already 143 PPERFVIEW_FUNCTION p2 = (PPERFVIEW_FUNCTION)pProfileMap->getElement(szBuf); 144 if (NULL == p2) 145 { 146 // new function call 147 p2 = (PPERFVIEW_FUNCTION)malloc( sizeof( PERFVIEW_FUNCTION ) ); 148 p2->pszFunctionName = strdup( szBuf ); 149 p2->nCalled = 0; 150 p2->nTotalTicks = 0; 151 p2->nMinimumTicks = 0xffffffff; 152 p2->nMaximumTicks = 0; 153 154 // add to the hashtable 155 pProfileMap->addElement(p2->pszFunctionName, p2); 156 } 157 158 // update statistical data 159 p2->nCalled++; 160 p2->nTotalTicks += nTicks; 161 162 if (nTicks < p2->nMinimumTicks) 163 p2->nMinimumTicks = nTicks; 164 165 if (nTicks > p2->nMaximumTicks) 166 p2->nMaximumTicks = nTicks; 167 } 129 168 } 130 169 -
trunk/src/kernel32/thread.cpp
r7318 r7326 1 /* $Id: thread.cpp,v 1.3 3 2001-11-10 12:47:48 sandervlExp $ */1 /* $Id: thread.cpp,v 1.34 2001-11-12 23:04:56 phaller Exp $ */ 2 2 3 3 /* … … 90 90 91 91 92 #define MAX_CALLSTACK_SIZE 128 93 void WIN32API dbg_ThreadPushCall(char *pszCaller) 94 { 95 #ifdef DEBUG 96 TEB *teb; 97 98 // embedded dbg_IncThreadCallDepth 99 teb = GetThreadTEB(); 100 if(teb == NULL) 101 return; 102 103 teb->o.odin.dbgCallDepth++; 104 105 // add caller name to call stack trace 106 int iIndex = teb->o.odin.dbgCallDepth; 107 108 // allocate callstack on demand 109 if (teb->o.odin.arrstrCallStack == NULL) 110 teb->o.odin.arrstrCallStack = (PVOID*)malloc( sizeof(LPSTR) * MAX_CALLSTACK_SIZE); 111 112 // insert entry 113 if (iIndex < MAX_CALLSTACK_SIZE) 114 teb->o.odin.arrstrCallStack[iIndex] = (PVOID)pszCaller; 115 #endif 116 } 117 118 92 119 void WIN32API dbg_DecThreadCallDepth() 93 120 { … … 99 126 --(teb->o.odin.dbgCallDepth); 100 127 #endif 128 } 129 130 131 void WIN32API dbg_ThreadPopCall() 132 { 133 #ifdef DEBUG 134 TEB *teb; 135 136 // embedded dbg_DecThreadCallDepth 137 teb = GetThreadTEB(); 138 if(teb == NULL) 139 return; 140 141 --(teb->o.odin.dbgCallDepth); 142 143 // add caller name to call stack trace 144 int iIndex = teb->o.odin.dbgCallDepth; 145 146 // insert entry 147 if (teb->o.odin.arrstrCallStack) 148 if (iIndex < MAX_CALLSTACK_SIZE) 149 teb->o.odin.arrstrCallStack[iIndex] = NULL; 150 #endif 151 } 152 153 char* WIN32API dbg_GetLastCallerName() 154 { 155 // retrieve last caller name from stack 156 TEB *teb; 157 158 // embedded dbg_DecThreadCallDepth 159 teb = GetThreadTEB(); 160 if(teb != NULL) 161 { 162 int iIndex = teb->o.odin.dbgCallDepth - 1; 163 if ( (iIndex > 0) && 164 (iIndex < MAX_CALLSTACK_SIZE) ) 165 { 166 return (char*)teb->o.odin.arrstrCallStack[iIndex]; 167 } 168 } 169 170 return NULL; 101 171 } 102 172
Note:
See TracChangeset
for help on using the changeset viewer.