Browse Source

Profiler: Upload original assembler callback hooks; fixed some outdated comments.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5005 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
72cf9a48df
  1. 25
      src/AddIns/Misc/Profiler/Hook/Callback.cpp
  2. BIN
      src/AddIns/Misc/Profiler/Hook/FunctionHooks.zip
  3. 2
      src/AddIns/Misc/Profiler/Hook/FunctionInfo.h

25
src/AddIns/Misc/Profiler/Hook/Callback.cpp

@ -24,30 +24,27 @@ void _declspec(naked) FunctionEnterNaked(FunctionID functionID, UINT_PTR clientD
#define FrameSize (SavedRegisterOffset + SavedRegisterSize) #define FrameSize (SavedRegisterOffset + SavedRegisterSize)
// stack layout: // stack layout:
// esp + 0 -> functionID \ // esp + 0 -> saved edx
// + 4 -> low bits of tsc |- parameters for FunctionEnterGlobal // + 4 -> saved ecx
// + 8 -> high bits of tsc / // + 8 -> saved eax
// + 12 -> saved edx // + 12 -> saved esi
// + 16 -> saved ecx // + 16 -> return address
// + 20 -> saved eax // + 20 -> functionID \
// + 24 -> saved esi // + 24 -> clientData |- parameters for FunctionEnterNaked
// + 28 -> return address // + 28 -> ... /
// + 32 -> functionID \
// + 36 -> clientData |- parameters for FunctionEnterNaked
// + 40 -> ... /
sub esp, FrameSize sub esp, FrameSize
// eax, ecx and edx are scratch registers in stdcall, so we need to save those // eax, ecx and edx are scratch registers in stdcall, so we need to save those
mov SavedRegister(8), eax mov SavedRegister(8), eax
mov SavedRegister(4), ecx mov SavedRegister(4), ecx
mov SavedRegister(0), edx mov SavedRegister(0), edx
mov ecx, [esp+FrameSize+8] // get clientData = custom FunctionID mov ecx, [esp+FrameSize+8] // get clientData = custom FunctionID
// first argument is in ecx // first argument to FunctionEnterGlobal is in ecx (__fastcall)
call FunctionEnterGlobal call FunctionEnterGlobal
// the call causes CallPopSize bytes to be popped from the stack // the call causes CallPopSize bytes to be popped from the stack
mov edx, SavedRegister(0 - CallPopSize) mov edx, SavedRegister(0 - CallPopSize)
mov ecx, SavedRegister(4 - CallPopSize) mov ecx, SavedRegister(4 - CallPopSize)
mov eax, SavedRegister(8 - CallPopSize) mov eax, SavedRegister(8 - CallPopSize)

BIN
src/AddIns/Misc/Profiler/Hook/FunctionHooks.zip

Binary file not shown.

2
src/AddIns/Misc/Profiler/Hook/FunctionInfo.h

@ -16,7 +16,7 @@ struct FunctionInfo
// other 55 bits: number of CPU cycles // other 55 bits: number of CPU cycles
ULONGLONG TimeSpent; ULONGLONG TimeSpent;
int FillCount; // Number of elements in the hash table int FillCount; // Number of elements in the hash table
int LastChildIndex; // (Capacity - 1) Binary value in the from 000001111 for some number of ones int LastChildIndex; // (Capacity - 1) Binary value in the form 000001111 for some number of ones
// Therefore it can be used as bit mask // Therefore it can be used as bit mask
FunctionInfo* Children[0]; // Inline array. Must be the last element. FunctionInfo* Children[0]; // Inline array. Must be the last element.
// Overruns behind the struct. The size must be power of 2. // Overruns behind the struct. The size must be power of 2.

Loading…
Cancel
Save