257 references to Interop
System.Diagnostics.PerformanceCounter (257)
_generated\0\LibraryImports.g.cs (28)
223
internal static partial global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle CreateFileMapping(global::Microsoft.Win32.SafeHandles.SafeFileHandle hFile, ref global::
Interop
.Kernel32.SECURITY_ATTRIBUTES lpFileMappingAttributes, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, string lpName)
239
fixed (global::
Interop
.Kernel32.SECURITY_ATTRIBUTES* __lpFileMappingAttributes_native = &lpFileMappingAttributes)
270
static extern unsafe nint __PInvoke(nint __hFile_native, global::
Interop
.Kernel32.SECURITY_ATTRIBUTES* __lpFileMappingAttributes_native, int __flProtect_native, int __dwMaximumSizeHigh_native, int __dwMaximumSizeLow_native, ushort* __lpName_native);
280
internal static partial global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle CreateFileMapping(nint hFile, ref global::
Interop
.Kernel32.SECURITY_ATTRIBUTES lpFileMappingAttributes, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, string lpName)
292
fixed (global::
Interop
.Kernel32.SECURITY_ATTRIBUTES* __lpFileMappingAttributes_native = &lpFileMappingAttributes)
318
static extern unsafe nint __PInvoke(nint __hFile_native, global::
Interop
.Kernel32.SECURITY_ATTRIBUTES* __lpFileMappingAttributes_native, int __flProtect_native, int __dwMaximumSizeHigh_native, int __dwMaximumSizeLow_native, ushort* __lpName_native);
695
internal static partial nuint VirtualQuery(global::System.Runtime.InteropServices.SafeHandle lpAddress, ref global::
Interop
.Kernel32.MEMORY_BASIC_INFORMATION lpBuffer, nuint dwLength)
707
fixed (global::
Interop
.Kernel32.MEMORY_BASIC_INFORMATION* __lpBuffer_native = &lpBuffer)
726
static extern unsafe nuint __PInvoke(nint __lpAddress_native, global::
Interop
.Kernel32.MEMORY_BASIC_INFORMATION* __lpBuffer_native, nuint __dwLength_native);
775
public static partial int PdhFormatFromRawValue(uint dwCounterType, uint dwFormat, ref long pTimeBase, ref global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER pRawValue1, ref global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER pRawValue2, ref global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE pFmtValue)
779
fixed (global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE* __pFmtValue_native = &pFmtValue)
780
fixed (global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER* __pRawValue2_native = &pRawValue2)
781
fixed (global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER* __pRawValue1_native = &pRawValue1)
790
static extern unsafe int __PInvoke(uint __dwCounterType_native, uint __dwFormat_native, long* __pTimeBase_native, global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER* __pRawValue1_native, global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER* __pRawValue2_native, global::
Interop
.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE* __pFmtValue_native);
808
internal static partial uint PerfStartProvider(ref global::System.Guid ProviderGuid, global::
Interop
.PerfCounter.PERFLIBREQUEST ControlCallback, out global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle phProvider)
857
internal static unsafe partial global::
Interop
.PerfCounter.PerfCounterSetInstanceStruct* PerfCreateInstance(global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle hProvider, ref global::System.Guid CounterSetGuid, string szInstanceName, uint dwInstance)
861
global::
Interop
.PerfCounter.PerfCounterSetInstanceStruct* __retVal = default;
889
static extern unsafe global::
Interop
.PerfCounter.PerfCounterSetInstanceStruct* __PInvoke(nint __hProvider_native, global::System.Guid* __CounterSetGuid_native, ushort* __szInstanceName_native, uint __dwInstance_native);
899
internal static unsafe partial uint PerfSetCounterSetInfo(global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle hProvider, global::
Interop
.PerfCounter.PerfCounterSetInfoStruct* pTemplate, uint dwTemplateSize)
924
static extern unsafe uint __PInvoke(nint __hProvider_native, global::
Interop
.PerfCounter.PerfCounterSetInfoStruct* __pTemplate_native, uint __dwTemplateSize_native);
934
internal static unsafe partial uint PerfDeleteInstance(global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle hProvider, global::
Interop
.PerfCounter.PerfCounterSetInstanceStruct* InstanceBlock)
959
static extern unsafe uint __PInvoke(nint __hProvider_native, global::
Interop
.PerfCounter.PerfCounterSetInstanceStruct* __InstanceBlock_native);
969
internal static unsafe partial uint PerfSetCounterRefValue(global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle hProvider, global::
Interop
.PerfCounter.PerfCounterSetInstanceStruct* pInstance, uint CounterId, void* lpAddr)
994
static extern unsafe uint __PInvoke(nint __hProvider_native, global::
Interop
.PerfCounter.PerfCounterSetInstanceStruct* __pInstance_native, uint __CounterId_native, void* __lpAddr_native);
misc\EnvironmentHelpers.cs (2)
45
if (!
Interop
.Advapi32.GetTokenInformation(wi.Token, (uint)
Interop
.Advapi32.TOKEN_INFORMATION_CLASS.TokenIsAppContainer, new IntPtr(dwIsAppContainerPtr), sizeof(int), out dwLength))
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ConvertStringSecurityDescriptorToSecurityDescriptor.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "ConvertStringSecurityDescriptorToSecurityDescriptorW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetTokenInformation.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Pdh\Interop.PdhFormatFromRawValue.cs (3)
15
ref
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER pRawValue1,
16
ref
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER pRawValue2,
17
ref
Interop
.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE pFmtValue
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafePerfProviderHandle.cs (2)
16
uint Status =
Interop
.PerfCounter.PerfStopProvider(handle);
17
Debug.Assert(Status == (uint)
Interop
.Errors.ERROR_SUCCESS, "PerfStopProvider() fails");
src\runtime\src\libraries\Common\src\System\Diagnostics\NetFrameworkUtils.cs (4)
87
int result =
Interop
.Kernel32.WaitForSingleObject(mutexIn.SafeWaitHandle, 500);
90
case
Interop
.Kernel32.WAIT_OBJECT_0:
91
case
Interop
.Kernel32.WAIT_ABANDONED:
97
case
Interop
.Kernel32.WAIT_TIMEOUT:
src\runtime\src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeRegistryHandle.cs (2)
37
Interop
.Advapi32.RegCloseKey(handle) ==
Interop
.Errors.ERROR_SUCCESS;
System\Diagnostics\CounterSampleCalculator.cs (56)
64
if ((newCounterType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION) &&
65
(newCounterType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT) &&
66
(newCounterType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX) &&
67
(newCounterType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT) &&
68
(newCounterType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX) &&
69
(newCounterType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_BASE))
82
if (newCounterType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_ELAPSED_TIME)
85
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER newPdhValue = default;
86
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER oldPdhValue = default;
90
Interop
.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE pdhFormattedValue = default;
92
int result =
Interop
.Pdh.PdhFormatFromRawValue((uint)newCounterType,
Interop
.Kernel32.PerformanceCounterOptions.PDH_FMT_DOUBLE |
Interop
.Kernel32.PerformanceCounterOptions.PDH_FMT_NOSCALE |
Interop
.Kernel32.PerformanceCounterOptions.PDH_FMT_NOCAP100,
95
if (result !=
Interop
.Errors.ERROR_SUCCESS)
98
if (result ==
Interop
.Kernel32.PerformanceCounterOptions.PDH_CALC_NEGATIVE_VALUE || result ==
Interop
.Kernel32.PerformanceCounterOptions.PDH_CALC_NEGATIVE_DENOMINATOR || result ==
Interop
.Kernel32.PerformanceCounterOptions.PDH_NO_DATA)
110
private static void FillInValues(CounterSample oldSample, CounterSample newSample, ref
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER oldPdhValue, ref
Interop
.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER newPdhValue)
116
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_COUNTER:
117
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_QUEUELEN_TYPE:
118
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_COUNTER:
119
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_OBJ_TIME_TIMER:
120
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_OBJ_TIME_QUEUELEN_TYPE:
128
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_100NS_QUEUELEN_TYPE:
136
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER:
137
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER_INV:
138
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_BULK_COUNT:
139
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_QUEUELEN_TYPE:
140
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER:
141
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV:
147
if (newCounterType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER || newCounterType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV)
158
if ((newCounterType &
Interop
.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER) ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER)
168
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT:
169
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX:
170
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_DELTA:
171
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT:
172
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX:
173
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_DELTA:
183
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER:
184
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER_INV:
185
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER:
186
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV:
192
if ((newCounterType &
Interop
.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER) ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER)
201
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION:
202
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION:
203
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_LARGE_RAW_FRACTION:
204
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_PRECISION_SYSTEM_TIMER:
205
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_PRECISION_100NS_TIMER:
206
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_PRECISION_OBJECT_TIMER:
207
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER:
208
case
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK:
System\Diagnostics\PerformanceCounterCategory.cs (16)
305
if ((currentSampleType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK) ||
306
(currentSampleType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER) ||
307
(currentSampleType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV) ||
308
(currentSampleType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER) ||
309
(currentSampleType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV) ||
310
(currentSampleType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION) ||
311
(currentSampleType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION) ||
312
(currentSampleType ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER))
334
(currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK) &&
335
(currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER) &&
336
(currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV) &&
337
(currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER) &&
338
(currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV) &&
339
(currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION) &&
340
(currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION) &&
341
(currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER))
System\Diagnostics\PerformanceCounterLib.cs (18)
14
using static
Interop
.Advapi32;
115
s_computerName ??=
Interop
.Kernel32.GetComputerName() ?? string.Empty;
1139
return (type ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BASE ||
1140
type ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_BASE ||
1141
type ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_BASE ||
1142
type ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_LARGE_RAW_BASE ||
1143
type ==
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_BASE);
1222
if (res ==
Interop
.Errors.ERROR_ACCESS_DENIED)
1269
throw new Win32Exception(
Interop
.Errors.ERROR_ACCESS_DENIED);
1312
case
Interop
.Advapi32.RPCStatus.RPC_S_CALL_FAILED:
1313
case
Interop
.Errors.ERROR_INVALID_HANDLE:
1314
case
Interop
.Advapi32.RPCStatus.RPC_S_SERVER_UNAVAILABLE:
1316
goto case
Interop
.Kernel32.WAIT_TIMEOUT;
1318
case
Interop
.Kernel32.WAIT_TIMEOUT:
1319
case
Interop
.Errors.ERROR_NOT_READY:
1320
case
Interop
.Errors.ERROR_LOCK_FAILED:
1321
case
Interop
.Errors.ERROR_BUSY:
1462
if (currentSampleType !=
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_NODATA)
System\Diagnostics\PerformanceCounterType.cs (28)
11
NumberOfItems32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT,
12
NumberOfItems64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT,
13
NumberOfItemsHEX32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX,
14
NumberOfItemsHEX64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX,
15
RateOfCountsPerSecond32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_COUNTER,
16
RateOfCountsPerSecond64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_BULK_COUNT,
17
CountPerTimeInterval32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_QUEUELEN_TYPE,
18
CountPerTimeInterval64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_QUEUELEN_TYPE,
19
RawFraction =
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION,
20
RawBase =
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_BASE,
22
AverageTimer32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER,
23
AverageBase =
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BASE,
24
AverageCount64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK,
26
SampleFraction =
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION,
27
SampleCounter =
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_COUNTER,
28
SampleBase =
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_BASE,
30
CounterTimer =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER,
31
CounterTimerInverse =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER_INV,
32
Timer100Ns =
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER,
33
Timer100NsInverse =
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER_INV,
34
ElapsedTime =
Interop
.Kernel32.PerformanceCounterOptions.PERF_ELAPSED_TIME,
35
CounterMultiTimer =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER,
36
CounterMultiTimerInverse =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV,
37
CounterMultiTimer100Ns =
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER,
38
CounterMultiTimer100NsInverse =
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV,
39
CounterMultiBase =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_BASE,
41
CounterDelta32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_DELTA,
42
CounterDelta64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_DELTA
System\Diagnostics\PerformanceData\CounterSet.cs (14)
204
uint Status = (uint)
Interop
.Errors.ERROR_SUCCESS;
208
uint CounterSetInfoSize = checked((uint)sizeof(
Interop
.PerfCounter.PerfCounterSetInfoStruct)
209
+ (uint)_idToCounter.Count * (uint)sizeof(
Interop
.PerfCounter.PerfCounterInfoStruct));
214
Debug.Assert(sizeof(
Interop
.PerfCounter.PerfCounterSetInfoStruct) == 40);
215
Debug.Assert(sizeof(
Interop
.PerfCounter.PerfCounterInfoStruct) == 32);
217
Interop
.PerfCounter.PerfCounterSetInfoStruct* CounterSetInfo;
218
Interop
.PerfCounter.PerfCounterInfoStruct* CounterInfo;
223
CounterSetInfo = (
Interop
.PerfCounter.PerfCounterSetInfoStruct*)pCounterSetBuffer;
231
CounterSetInfoUsed = (uint)sizeof(
Interop
.PerfCounter.PerfCounterSetInfoStruct)
232
+ (uint)CurrentCounter * (uint)sizeof(
Interop
.PerfCounter.PerfCounterInfoStruct);
235
CounterInfo = (
Interop
.PerfCounter.PerfCounterInfoStruct*)(pCounterSetBuffer + CounterSetInfoUsed);
248
Status =
Interop
.PerfCounter.PerfSetCounterSetInfo(_provider._hProvider, CounterSetInfo, CounterSetInfoSize);
251
if (Status != (uint)
Interop
.Errors.ERROR_SUCCESS)
255
(uint)
Interop
.Errors.ERROR_ALREADY_EXISTS => new InvalidOperationException(SR.Format(SR.Perflib_Argument_CounterSetAlreadyRegister, _counterSet)),
System\Diagnostics\PerformanceData\CounterSetInstance.cs (8)
18
internal unsafe
Interop
.PerfCounter.PerfCounterSetInstanceStruct* _nativeInst;
33
Debug.Assert(sizeof(
Interop
.PerfCounter.PerfCounterSetInstanceStruct) == 32);
35
_nativeInst =
Interop
.PerfCounter.PerfCreateInstance(
37
int Status = (int)((_nativeInst != null) ?
Interop
.Errors.ERROR_SUCCESS : Marshal.GetLastWin32Error());
51
case (int)
Interop
.Errors.ERROR_ALREADY_EXISTS:
54
case (int)
Interop
.Errors.ERROR_NOT_FOUND:
57
case (int)
Interop
.Errors.ERROR_INVALID_PARAMETER:
104
Interop
.PerfCounter.PerfDeleteInstance(_counterSet._provider._hProvider, _nativeInst);
System\Diagnostics\PerformanceData\CounterSetInstanceCounterDataSet.cs (3)
141
uint Status =
Interop
.PerfCounter.PerfSetCounterRefValue(
146
if (Status != (uint)
Interop
.Errors.ERROR_SUCCESS)
153
(uint)
Interop
.Errors.ERROR_NOT_FOUND => new InvalidOperationException(SR.Format(SR.Perflib_InvalidOperation_CounterRefValue, _instance._counterSet._counterSet, CounterDef.Key, _instance._instName)),
System\Diagnostics\PerformanceData\CounterType.cs (36)
11
QueueLength =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_QUEUELEN_TYPE,
12
LargeQueueLength =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_QUEUELEN_TYPE,
13
QueueLength100Ns =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_100NS_QUEUELEN_TYPE,
14
QueueLengthObjectTime =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_OBJ_TIME_QUEUELEN_TYPE,
15
RawData32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT,
16
RawData64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT,
17
RawDataHex32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX,
18
RawDataHex64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX,
19
RateOfCountPerSecond32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_COUNTER,
20
RateOfCountPerSecond64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_BULK_COUNT,
21
RawFraction32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION,
22
RawFraction64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_LARGE_RAW_FRACTION,
23
RawBase32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_RAW_BASE,
24
RawBase64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_LARGE_RAW_BASE,
25
SampleFraction =
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION,
26
SampleCounter =
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_COUNTER,
27
SampleBase =
Interop
.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_BASE,
28
AverageTimer32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER,
29
AverageBase =
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BASE,
30
AverageCount64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK,
31
PercentageActive =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER,
32
PercentageNotActive =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER_INV,
33
PercentageActive100Ns =
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER,
34
PercentageNotActive100Ns =
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER_INV,
35
ElapsedTime =
Interop
.Kernel32.PerformanceCounterOptions.PERF_ELAPSED_TIME,
36
MultiTimerPercentageActive =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER,
37
MultiTimerPercentageNotActive =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV,
38
MultiTimerPercentageActive100Ns =
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER,
39
MultiTimerPercentageNotActive100Ns =
Interop
.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV,
40
MultiTimerBase =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_BASE,
41
Delta32 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_DELTA,
42
Delta64 =
Interop
.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_DELTA,
43
ObjectSpecificTimer =
Interop
.Kernel32.PerformanceCounterOptions.PERF_OBJ_TIME_TIMER,
44
PrecisionSystemTimer =
Interop
.Kernel32.PerformanceCounterOptions.PERF_PRECISION_SYSTEM_TIMER,
45
PrecisionTimer100Ns =
Interop
.Kernel32.PerformanceCounterOptions.PERF_PRECISION_100NS_TIMER,
46
PrecisionObjectSpecificTimer =
Interop
.Kernel32.PerformanceCounterOptions.PERF_PRECISION_OBJECT_TIMER
System\Diagnostics\PerformanceData\PerfProviderCollection.cs (2)
20
uint Status =
Interop
.PerfCounter.PerfStartProvider(ref _providerGuid, null, out _hProvider);
22
if (Status != (uint)
Interop
.Errors.ERROR_SUCCESS)
System\Diagnostics\PerformanceDataRegistryKey.cs (6)
27
int ret =
Interop
.Advapi32.RegConnectRegistry(machineName, new IntPtr(PerformanceData), out SafeRegistryHandle foreignHKey);
35
if (ret ==
Interop
.Errors.ERROR_DLL_INIT_FAILED)
64
while (
Interop
.Errors.ERROR_MORE_DATA == (ret =
Interop
.Advapi32.RegQueryValueEx(_hkey, name, lpReserved: null, ref type, data, ref sizeInput)))
124
if (errorCode ==
Interop
.Errors.ERROR_ACCESS_DENIED)
129
throw new IOException(
Interop
.Kernel32.GetMessage(errorCode), errorCode);
System\Diagnostics\SharedPerformanceCounter.cs (27)
40
int pid = (int)
Interop
.Kernel32.GetCurrentProcessId();
49
using (SafeProcessHandle procHandle =
Interop
.Kernel32.OpenProcess(
Interop
.Advapi32.ProcessOptions.PROCESS_QUERY_INFORMATION, false, pid))
54
Interop
.Kernel32.GetProcessTimes(procHandle, out startTime, out temp, out temp, out temp);
1303
using (SafeProcessHandle procHandle =
Interop
.Kernel32.OpenProcess(
Interop
.Advapi32.ProcessOptions.PROCESS_QUERY_INFORMATION, false, pid))
1306
if ((error ==
Interop
.Errors.ERROR_INVALID_PARAMETER) && procHandle.IsInvalid)
1321
if (
Interop
.Kernel32.GetProcessTimes(procHandle, out processStartTime, out temp, out temp, out temp))
1335
using (SafeProcessHandle procHandle =
Interop
.Kernel32.OpenProcess(
Interop
.Advapi32.ProcessOptions.SYNCHRONIZE, false, pid))
1339
using (
Interop
.Kernel32.ProcessWaitHandle wh = new
Interop
.Kernel32.ProcessWaitHandle(procHandle))
1684
if (!
Interop
.Advapi32.ConvertStringSecurityDescriptorToSecurityDescriptor(
1686
Interop
.Kernel32.PerformanceCounterOptions.SDDL_REVISION_1,
1693
Interop
.Kernel32.SECURITY_ATTRIBUTES securityAttributes = default;
1695
securityAttributes.bInheritHandle =
Interop
.BOOL.FALSE;
1714
_fileMappingHandle =
Interop
.Kernel32.CreateFileMapping((IntPtr)(-1), ref securityAttributes,
1715
Interop
.Kernel32.PageOptions.PAGE_READWRITE, 0, fileMappingSize, mappingName);
1717
if ((Marshal.GetLastWin32Error() !=
Interop
.Errors.ERROR_ACCESS_DENIED) || !_fileMappingHandle.IsInvalid)
1725
_fileMappingHandle =
Interop
.Kernel32.OpenFileMapping(
Interop
.Kernel32.FileMapOptions.FILE_MAP_WRITE, false, mappingName);
1727
if ((Marshal.GetLastWin32Error() !=
Interop
.Errors.ERROR_FILE_NOT_FOUND) || !_fileMappingHandle.IsInvalid)
1751
_fileViewAddress =
Interop
.Kernel32.MapViewOfFile(_fileMappingHandle,
Interop
.Kernel32.FileMapOptions.FILE_MAP_WRITE, 0, 0, UIntPtr.Zero);
1756
Interop
.Kernel32.MEMORY_BASIC_INFORMATION meminfo = default;
1757
if (
Interop
.Kernel32.VirtualQuery(_fileViewAddress, ref meminfo, (UIntPtr)sizeof(
Interop
.Kernel32.MEMORY_BASIC_INFORMATION)) == UIntPtr.Zero)