Skip to content

Commit ef4d442

Browse files
Add ARM64 env support & update docs (#489)
* add ARM64 env support & update docs * nit whitespace
1 parent 8775da5 commit ef4d442

File tree

6 files changed

+26
-21
lines changed

6 files changed

+26
-21
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Please format the changes as follows:
88
+ Updates:
99

1010
## 1.0.45
11+
+ New:
12+
+ Add ARM64 environment variable support
1113
+ BugFixes:
1214
+ Refactor duplicate instrumentation method check
1315

docs/configuration.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ Priority|Integer ordering for InstrumentationMethod consumption. Higher priority
3232
### Config Environment Variable
3333

3434
The CLR Instrumentation Engine checks for environment variables with these prefixes:
35-
* 64bit: `MicrosoftInstrumentationEngine_ConfigPath64_`
36-
* 32bit: `MicrosoftInstrumentationEngine_ConfigPath32_`
35+
* ARM64: `MicrosoftInstrumentationEngine_ConfigPathARM64_`
36+
* x64: `MicrosoftInstrumentationEngine_ConfigPath64_`
37+
* x86: `MicrosoftInstrumentationEngine_ConfigPath32_`
3738

3839
The value of these variables should be a **full path** to the *.config file.
3940

docs/environment_variables.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ COR_ENABLE_PROFILING|1|The CLR will only connect to a profiler if this is set to
1212
COR_PROFILER|"{324F817A-7420-4E6D-B3C1-143FBED6D855}"|The CLR will search for the CLSID or ProgID specified.|
1313
COR_PROFILER_PATH_32 (see below)|"[FULL PATH TO MicrosoftInstrumentationEngine_x86.dll or InstrumentationEngine.ProfilerProxy_x86.dll]"|Skips the registry lookup, uses the 32bit dll from the path.
1414
COR_PROFILER_PATH_64 (see below)|"[FULL PATH TO MicrosoftInstrumentationEngine_x64.dll or InstrumentationEngine.ProfilerProxy_x64.dll]"|Skips the registry lookup, uses the 64bit dll from the path.
15+
COR_PROFILER_PATH_ARM64|"[FULL PATH TO MicrosoftInstrumentationEngine_arm64.dll]"|Skips the registry lookup, uses the arm64 dll from the path. This is only supported on .NET framework 4.8.1+
1516

1617
Alternatively, for CoreCLR:
1718

@@ -21,6 +22,7 @@ CORECLR_ENABLE_PROFILING|1|The CoreCLR will only connect to a profiler if this i
2122
CORECLR_PROFILER|"{324F817A-7420-4E6D-B3C1-143FBED6D855}"|The CoreCLR will search for the CLSID or ProgID specified.
2223
CORECLR_PROFILER_PATH_32 (see below)|"[FULL PATH TO MicrosoftInstrumentationEngine_x86.dll or InstrumentationEngine.ProfilerProxy_x86.dll]"|Skips the registry lookup, uses the 32bit dll from the path.
2324
CORECLR_PROFILER_PATH_64 (see below)|"[FULL PATH TO MicrosoftInstrumentationEngine_x64.dll or InstrumentationEngine.ProfilerProxy_x64.dll]"|Skips the registry lookup, uses the 64bit dll from the path.
25+
CORECLR_PROFILER_PATH_ARM64 (see below)|"[FULL PATH TO MicrosoftInstrumentationEngine_arm64.dll]"|Skips the registry lookup, uses the arm64 dll from the path. This is only supported on .NET 6+
2426

2527
> Please see [Profiler Proxy](profilerproxy.md) for details on using the Profiler Proxy dll. We recommend setting the COR_PROFILER variables to
2628
the proxy whenever applicable since it redirects to the latest CLRIE installed on every process re/start.
@@ -58,7 +60,7 @@ For reference, InstrumentationEngine versions are expected to be in one of the b
5860

5961
| Variable | Value | Description |
6062
|-|-|-|
61-
InstrumentationEngineProxy_UseDebug|1|Toggles the proxy to **only** consider versions with `_debug` suffix.
63+
InstrumentationEngineProxy_UseDebug|1|Toggles the proxy to **only** consider versions with `_debug` suffix.
6264
InstrumentationEngineProxy_UsePreview|1|Toggles the proxy to also consider versions with `-build###` suffix.
6365
InstrumentationEngineProxy_UseSpecificVersion|1.0.0-build1234|Forces the proxy to only use the specific folder version.
6466

@@ -69,7 +71,7 @@ The RawProfilerHook allows one additional profiler that has not yet on-boarded t
6971
| Variable | Value | Description |
7072
|-|-|-|
7173
MicrosoftInstrumentationEngine_RawProfilerHook|"{GUID}"|This would be the value set to CORECLR/COR_PROFILER.
72-
MicrosoftInstrumentationEngine_RawProfilerHookPath_32/64|"[FULL PATH TO raw profiler dll]"|This would be the value set to CORECLR/COR_PROFILER_PATH_32/64.
74+
MicrosoftInstrumentationEngine_RawProfilerHookPath_32/64/ARM64|"[FULL PATH TO raw profiler dll]"|This would be the value set to CORECLR/COR_PROFILER_PATH_32/64/ARM64.
7375

7476
## Deprecated as of Version 1.0.22
7577
The following variables allowed custom ExtensionHosts for the InstrumentationEngine. The responsibility of the ExtensionsHost involves setting

src/ExtensionsCommon/NativeInstanceMethodsCodeInjector.cpp

+7-13
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@ namespace Instrumentation
9797

9898
const auto NumberOfExtraMethodParameters = 1;
9999

100-
#if defined(_M_X64)
100+
#if (defined(_M_X64)) || (defined(_M_ARM64))
101101
const auto NativeObjThisPointerElementType = ELEMENT_TYPE_I8;
102102
#elif defined(_M_IX86)
103103
const auto NativeObjThisPointerElementType = ELEMENT_TYPE_I4;
104-
#elif defined(_M_ARM64)
105-
const auto NativeObjThisPointerElementType = ELEMENT_TYPE_I8;
106104
#else
107105
static_assert(true, "Unsupported processor architecture");
108106
#endif
@@ -189,21 +187,19 @@ namespace Instrumentation
189187
{
190188
IInstructionSptr spLoadNativeObjAddressInstruction;
191189

192-
#if defined(_M_X64)
190+
#if (defined(_M_X64)) || (defined(_M_ARM64))
193191
IfFailRet(
194192
spInstructionFactory->CreateLongOperandInstruction(
195193
Cee_Ldc_I8,
196194
pInstance,
197195
&spLoadNativeObjAddressInstruction));
198-
#endif
199-
#if defined(_M_IX86)
196+
#elif defined(_M_IX86)
200197
IfFailRet(
201198
spInstructionFactory->CreateIntOperandInstruction(
202199
Cee_Ldc_I4,
203200
pInstance,
204201
&spLoadNativeObjAddressInstruction));
205-
#endif
206-
#if (!defined(_M_X64)) && !defined(_M_IX86)
202+
#else
207203
static_assert(true, "Unsupported processor architecture");
208204
#endif
209205

@@ -226,21 +222,19 @@ namespace Instrumentation
226222
{
227223
IInstructionSptr spLoadCallbackAddress;
228224

229-
#if defined(_M_X64)
225+
#if (defined(_M_X64)) || (defined(_M_ARM64))
230226
IfFailRet(
231227
spInstructionFactory->CreateLongOperandInstruction(
232228
Cee_Ldc_I8,
233229
pMethod,
234230
&spLoadCallbackAddress));
235-
#endif
236-
#if defined(_M_IX86)
231+
#elif defined(_M_IX86)
237232
IfFailRet(
238233
spInstructionFactory->CreateIntOperandInstruction(
239234
Cee_Ldc_I4,
240235
pMethod,
241236
&spLoadCallbackAddress));
242-
#endif
243-
#if (!defined(_M_X64)) && !defined(_M_IX86)
237+
#else
244238
static_assert(true, "Unsupported processor architecture");
245239
#endif
246240

src/InstrumentationEngine.Lib/ConfigurationLocator.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ namespace MicrosoftInstrumentationEngine
2222
static constexpr const char s_cEnvironmentVariableNameValueSeparator = '=';
2323
static constexpr const char s_cEnvironmentVariablePathDelimiter = ':';
2424
#else // PLATFORM_UNIX
25-
#if defined(_WIN64)
26-
static constexpr const WCHAR* s_wszConfigurationPathEnvironmentVariablePrefix = _T("MicrosoftInstrumentationEngine_ConfigPath64_");
27-
#else
25+
#ifdef _M_IX86
2826
static constexpr const WCHAR* s_wszConfigurationPathEnvironmentVariablePrefix = _T("MicrosoftInstrumentationEngine_ConfigPath32_");
27+
#elif defined(_M_ARM64)
28+
static constexpr const WCHAR* s_wszConfigurationPathEnvironmentVariablePrefix = _T("MicrosoftInstrumentationEngine_ConfigPathARM64_");
29+
#else
30+
static constexpr const WCHAR* s_wszConfigurationPathEnvironmentVariablePrefix = _T("MicrosoftInstrumentationEngine_ConfigPath64_");
2931
#endif
3032
static constexpr const WCHAR* s_wszEnvironmentVariableNameValueSeparator = _T("=");
3133
static constexpr const WCHAR* s_wszEnvironmentVariablePathDelimiter = _T(";");

src/InstrumentationEngine.Lib/RawProfilerHookSettingsReader.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ namespace MicrosoftInstrumentationEngine
1010
LPCWSTR cszRawProfilerHookPathVariableNameNoBitness = L"MicrosoftInstrumentationEngine_RawProfilerHookPath";
1111
#ifdef X86
1212
LPCWSTR cszRawProfilerHookPathVariableName = L"MicrosoftInstrumentationEngine_RawProfilerHookPath_32";
13-
#else
13+
#elif defined(_M_X64)
1414
LPCWSTR cszRawProfilerHookPathVariableName = L"MicrosoftInstrumentationEngine_RawProfilerHookPath_64";
15+
#elif defined(_M_ARM64)
16+
LPCWSTR cszRawProfilerHookPathVariableName = L"MicrosoftInstrumentationEngine_RawProfilerHookPath_ARM64";
17+
#else
18+
static_assert(true, "Unsupported processor architecture");
1519
#endif
1620

1721
CRawProfilerHookSettingsReader::CRawProfilerHookSettingsReader() noexcept

0 commit comments

Comments
 (0)