Keen的博客

记录所思、所想、所遇

欢迎来到我的个人站~


Windows Performance Analyzer使用

概述

基本过程:WPA是辅助WPR使用,WPR(Windows Performance Record)用来录制ETL(包括CPU使用率、IO、文件、网络、GPU、堆等),借助ETW技术框架实现,WPA用来可视化分析ETL文件。
基本使用方法:拖拽、右键选择
基本展示内容:各种维度的统计数据,可选择总和、平均、最大、最小等各种统计方法,也可选择UI延迟、CPU占用、文件读写耗时等各种维度数据

一个特点:灵活,丰富的内容需要根据各种不同场景灵活选择处理,以便尽可能快的定位问题

jpg

ETW技术架构

png

Controllers:启动和停止Events发送,以及log路径和大小设置,以及Provider的选择允许。WPR(Windows Performance Record)就是一个Controller。它会使用StartTrace等API

Providers:不同类型的Event产生者。例如线程、网络、IO、内存等各种Provider。它会使用WriteEvent

Consumers:使用Event的使用者。WPA就是使用者,用来做可视化分析。它会解析log file

Data Table

灵活处理用各种不同维度做主key,来统计数据,需要了解两根线条(黄线蓝线)的含义

png

Key Area:用这一组维度数据作为统计关键字,通常需要正确搭配,例如Process可以搭配Thread

Data Area:数据统计区,这里可以是消耗时间cost time、次数等

Graphing element Area:绘制区,这里可以是时间间隔during time、权重占比Weight等

WPA使用步骤

Step1:打开ETL文件
Step2:选择要分析的图形属性,例如是要分析CPU占用?磁盘存储?界面卡顿UI Delay?网络?内存使用?
Step3:选择一个时间区间(通常是肉眼观察到的数据波形有问题的区间段)
Step4:放大Zoom
Step5:定制要分析观测的数据Data Table维度

各种Event Provider一览

通过System Configuration - Trace Statistic,可以看到有非常多的各种不同的Provider

Providers列表
Line #Provider NameEvent NameCount
1d00792da-07b7-40f5-97eb-5d974e05474027
2a688ee40-d8d9-4736-b6f9-6b74935ba3b1652
3WinSATAssessment 3
4 WinSAT: WinSPR Compressed Info1
5 WinSAT: Metrics Compressed Info1
6 WinSAT: SystemConfig Compressed Info1
7Thread 143991
8 Thread: Create95
9 Thread: Delete159
10 Thread: Start Rundown2490
11 Thread: End Rundown2428
12 Thread: CSwitch85467
13 Thread: SetPriority860
14 Thread: SetBasePriority5362
15 Thread: ReadyThread46270
16 Thread: Set Page Priority167
17 Thread: Set I/O Priority100
18 Thread [Provider]401
19 Thread: Set Ideal Processor97
20 Thread: Set User Ideal Processor95
21SysConfigEx 63
22 SysConfigEx: BuildInfo1
23 SysConfigEx: SystemPaths1
24 SysConfigEx: UnknownVolume1
25 SysConfigEx: VolumeMapping13
26 SysConfigEx: NetworkInterface46
27 SysConfigEx [Provider]1
28SysConfig 455
29 SysConfig: CPUs1
30 SysConfig: Physical Disks2
31 SysConfig: Logical Disks7
32 SysConfig: Network Cards5
33 SysConfig: Video Adapters2
34 SysConfig: Services283
35 SysConfig: Power Management1
36 SysConfig: IRQs16
37 SysConfig: PnP Devices117
38 SysConfig: NUMA Nodes1
39 SysConfig: Platform1
40 SysConfig: Processor Group Configuration1
41 SysConfig: Processor Mapping1
42 SysConfig: Display DPI1
43 SysConfig: Code Integrity1
44 SysConfig: Machine Id1
45 SysConfig [Provider]14
46StackWalkStack Walk1260641
47Process 594
48 Process: Create1
49 Process: Delete6
50 Process: Start Rundown154
51 Process: End Rundown149
52 Process [Provider]6
53 Process: PerfCounters: End6
54 Process: PerfCounters: Rundown149
55 Process: Zombie123
56Power 113
57 Power: Perf State Change4
58 Power: Idle State Change109
59Pool 626357
60 Pool: Allocate241999
61 Pool: Allocate Session7365
62 Pool: Free368975
63 Pool: Free Session7643
64 Pool: PoolSnap Start Rundown24
65 Pool: PoolSnap End Rundown24
66 Pool: BigPoolSnap Start Rundown149
67 Pool: BigPoolSnap End Rundown146
68 Pool: PoolSnap Session Start Rundown5
69 Pool: PoolSnap Session End Rundown5
70 Pool: BigPoolSnap Session Start Rundown11
71 Pool: BigPoolSnap Session End Rundown11
72Perfinfo 1568074
73 Mark3
74 Sampled Profile13853
75 Message Signaled Interrupt5468
76 SysCall: Enter769129
77 SysCall: Exit767373
78 Interrupt190
79 Dpc12056
80 Sampled Profile Freq: Start Rundown1
81 Sampled Profile Freq: End Rundown1
82PageFault 135319
83 PageFault: Transition38820
84 PageFault: Demand Zero47925
85 PageFault: Copy on Write76
86 PageFault: Guard Page60
87 PageFault: Hard Page Fault16401
88 PageFault [Provider]34
89 Hardfault5150
90 Memory: VirtualAlloc1269
91 Memory: VirtualFree855
92 Memory: MemInfo27
93 Memory: MMStat1
94 Memory: MemInfoExWS27
95 Memory: MemInfoExSessionWS27
96 Memory: VirtualAlloc Start Rundown12434
97 Memory: VirtualAlloc End Rundown12213
98Microsoft-Windows-Win32k 13925
99 Microsoft-Windows-Win32k/ThreadInfoRundown/win:Info778
100 Microsoft-Windows-Win32k/QueuePostMessage/win:Info4994
101 Microsoft-Windows-Win32k/SendMessage/win:Start31
102 Microsoft-Windows-Win32k/RetrievePostMessage/win:Info7296
103 Microsoft-Windows-Win32k/RetrieveSendMessage/win:Start31
104 Microsoft-Windows-Win32k/RetrieveInputMessage/win:Info201
105 Microsoft-Windows-Win32k/RetrievePseudoMessage/win:Info37
106 Microsoft-Windows-Win32k/WakePump/win:Info228
107 Microsoft-Windows-Win32k/SendMessage/win:Stop31
108 Microsoft-Windows-Win32k/RetrieveSendMessage/win:Stop31
109 Microsoft-Windows-Win32k/QueueInputMessage/win:Info196
110 Microsoft-Windows-Win32k/DispatchMessage/win:Start28
111 Microsoft-Windows-Win32k/DispatchMessage/win:Stop28
112 Microsoft-Windows-Win32k/QueueNullPostMessage/win:Info15
113Microsoft-Windows-UserModePowerService 310
114 Microsoft-Windows-UserModePowerService/RundownPlatformRole/win:Info1
115 Microsoft-Windows-UserModePowerService/RundownPowerScheme/win:Info1
116 Microsoft-Windows-UserModePowerService/RundownAcPowerSetting/win:Info140
117 Microsoft-Windows-UserModePowerService/RundownDcPowerSetting/win:Info140
118 Microsoft-Windows-UserModePowerService/RundownBatteryInformation/win:Info1
119 Microsoft-Windows-UserModePowerService/RundownBatteryStatus/win:Info1
120 Microsoft-Windows-UserModePowerService/RundownBrightnessCapability/win:Info1
121 Microsoft-Windows-UserModePowerService/RundownPowerSource/win:Info1
122 Microsoft-Windows-UserModePowerService/RundownOverrideConfiguration/win:Info1
123 Microsoft-Windows-UserModePowerService/RundownPowerProfileSetting/win:Info7
124 Microsoft-Windows-UserModePowerService/RundownSmartUserPresenceState/win:Info1
125 Microsoft-Windows-UserModePowerService/RundownOverlaySchemePowerSetting/win:Info11
126 Microsoft-Windows-UserModePowerService/RundownActualOverlayPowerScheme/win:Info2
127 Microsoft-Windows-UserModePowerService/RundownEffectiveOverlayPowerScheme/win:Info1
128 Microsoft-Windows-UserModePowerService/RundownOverlaySuspendReason/win:Info1
129Microsoft-Windows-TCPIP 1930
130 Microsoft-Windows-TCPIP/TcpEndpointCreation/win:Info12
131 Microsoft-Windows-TCPIP/TcpRequestConnect/win:Info3
132 Microsoft-Windows-TCPIP/TcpInspectConnectComplete/win:Info3
133 Microsoft-Windows-TCPIP/TcpTcbSynSend/win:Info3
134 Microsoft-Windows-TCPIP/TcpBindEndpointComplete/win:Info3
135 Microsoft-Windows-TCPIP/TcpCloseEndpoint/win:Info16
136 Microsoft-Windows-TCPIP/TcpCreateEndpointComplete/win:Info12
137 Microsoft-Windows-TCPIP/TcpConnectTcbProceeding/win:Info3
138 Microsoft-Windows-TCPIP/TcpConnectTcbComplete/win:Info1
139 Microsoft-Windows-TCPIP/TcpConnectTcbFailure/win:Info2
140 Microsoft-Windows-TCPIP/TcpCloseTcbRequest/win:Info5
141 Microsoft-Windows-TCPIP/TcpAbortTcbRequest/win:Info4
142 Microsoft-Windows-TCPIP/TcpAbortTcbComplete/win:Info4
143 Microsoft-Windows-TCPIP/TcpShutdownTcb/win:Info6
144 Microsoft-Windows-TCPIP/TcpDisconnectTcbRtoTimeout/win:Info2
145 Microsoft-Windows-TCPIP/TcpTcbStateChange/win:Info10
146 Microsoft-Windows-TCPIP/TcpTcbStartTimer/win:Info68
147 Microsoft-Windows-TCPIP/TcpTcbStopTimer/win:Info124
148 Microsoft-Windows-TCPIP/TcpTcbExpireTimer/win:Info7
149 Microsoft-Windows-TCPIP/TcpDataTransferReceive/win:Info118
150 Microsoft-Windows-TCPIP/TcpSetTcpOption/win:Info1
151 Microsoft-Windows-TCPIP/TcpReceiveRequest/win:Info6
152 Microsoft-Windows-TCPIP/TcpDeliveryIndicated/win:Info54
153 Microsoft-Windows-TCPIP/TcpDeliverySatisfied/win:Info5
154 Microsoft-Windows-TCPIP/TcpSendPosted/win:Info57
155 Microsoft-Windows-TCPIP/TcpSendTransmitted/win:Info57
156 Microsoft-Windows-TCPIP/TcpSendAdvance/win:Info58
157 Microsoft-Windows-TCPIP/TcpSrttMeasurementStarted/win:Info60
158 Microsoft-Windows-TCPIP/TcpSrttMeasurementComplete/win:Info58
159 Microsoft-Windows-TCPIP/TcpSrttMeasurementCancelled/win:Info2
160 Microsoft-Windows-TCPIP/UdpEndpointSendMessages/win:Info1
161 Microsoft-Windows-TCPIP/UdpEndpointReceiveMessages/win:Info1
162 Microsoft-Windows-TCPIP/TcpDeliveryFlush/win:Info4
163 Microsoft-Windows-TCPIP/TcpConnectRestransmit/win:Info2
164 Microsoft-Windows-TCPIP/TcpAcquirePort/win:Info3
165 Microsoft-Windows-TCPIP/TcpAcquireWeakRefPort/win:Info3
166 Microsoft-Windows-TCPIP/TcpReleasePort/win:Info14
167 Microsoft-Windows-TCPIP/TcpFlushSack/win:Info2
168 Microsoft-Windows-TCPIP/IpInterfaceRundown/win:Info10
169 Microsoft-Windows-TCPIP/TcpipReceiveSlowPath/win:Info16
170 Microsoft-Windows-TCPIP/TcpipSendSlowPath/win:Info141
171 Microsoft-Windows-TCPIP/TcpTemplateParameters/win:Info1
172 Microsoft-Windows-TCPIP/TcpTemplateChanged/win:Info3
173 Microsoft-Windows-TCPIP/TcpCwndRestart/win:Info58
174 Microsoft-Windows-TCPIP/RssBindingRundown/win:Info1
175 Microsoft-Windows-TCPIP/RssPortRundown/win:Info1
176 Microsoft-Windows-TCPIP/TcpConnectionRundown/win:Info32
177 Microsoft-Windows-TCPIP//win:Info136
178 Microsoft-Windows-TCPIP/IpNeighborState/win:Info1
179 Microsoft-Windows-TCPIP/IpNeighborDiscovery/win:Info2
180 Microsoft-Windows-TCPIP/IpSourceAddressSelection/win:Info16
181 Microsoft-Windows-TCPIP/IpSortedAddressPairs/win:Info26
182 Microsoft-Windows-TCPIP/TcpDataTransferCumAck/win:Info57
183 Microsoft-Windows-TCPIP/TcpDataTransferSend/win:Info123
184 Microsoft-Windows-TCPIP/TcpDataTransferRttSample/win:Info58
185 Microsoft-Windows-TCPIP/TcpDataTransferRetransmitRound/win:Info2
186 Microsoft-Windows-TCPIP/TcpipNblOob/win:Info39
187 Microsoft-Windows-TCPIP/TcpipRouteLookup/win:Info56
188 Microsoft-Windows-TCPIP/TcpipSrcAddrLookup/win:Info8
189 Microsoft-Windows-TCPIP/Memory/win:Info6
190 Microsoft-Windows-TCPIP/TcpAssociateNameResContext/win:Info2
191 Microsoft-Windows-TCPIP/TcpInspectConnectWithNameResContext/win:Info1
192 Microsoft-Windows-TCPIP/IpRouteBlocked/win:Info1
193 Microsoft-Windows-TCPIP/TcpTailLossProbe/win:Info3
194 Microsoft-Windows-TCPIP/TcpRack/win:Info11
195 Microsoft-Windows-TCPIP/UdpCreateEndpointComplete/win:Info10
196 Microsoft-Windows-TCPIP/UdpBindEndpointComplete/win:Info3
197 Microsoft-Windows-TCPIP/UdpCloseEndpointBound/win:Info3
198 Microsoft-Windows-TCPIP/UdpCloseEndpointUnBound/win:Info7
199 Microsoft-Windows-TCPIP/IcmpSendRecv/win:Info8
200 Microsoft-Windows-TCPIP/TcpSendComplete/win:Info57
201 Microsoft-Windows-TCPIP/TcpCubicDataTransferCumAck/win:Info3
202 Microsoft-Windows-TCPIP/IpRouteDGDStateChange/win:Info1
203 Microsoft-Windows-TCPIP/IpRouteRundown/win:Info34
204 Microsoft-Windows-TCPIP/InetInspect/win:Info171
205 Microsoft-Windows-TCPIP/TcpipSourceConstraint/win:Info2
206 Microsoft-Windows-TCPIP/RemoteEndpoint/win:Info26
207Microsoft-Windows-StorPort 15747
208 Microsoft-Windows-StorPort/Port/win:Info2632
209 Microsoft-Windows-StorPort/Port/Dispatch2615
210 Microsoft-Windows-StorPort/Port/Completion2615
211 Microsoft-Windows-StorPort/Port/Queue5265
212 Microsoft-Windows-StorPort/Port/win:Start8
213 Microsoft-Windows-StorPort/Port/win:Stop8
214 Microsoft-Windows-StorPort/Isr/Completion2604
215Microsoft-Windows-Search-Core 39
216 Microsoft-Windows-Search-Core/USN_Notify/win:Info8
217 Microsoft-Windows-Search-Core/Gatherer_OnDataChange_Track_Url/win:Info8
218 Microsoft-Windows-Search-Core/ETWLogging/win:Info9
219 Microsoft-Windows-Search-Core/FileChangeTracker_ProcessUSN/win:Start7
220 Microsoft-Windows-Search-Core/FileChangeTracker_ProcessUSN/win:Stop7
221Microsoft-Windows-ReadyBoostDriverMicrosoft-Windows-ReadyBoostDriver/GlobalStats/win:Info2
222Microsoft-Windows-RPC 2473
223 Microsoft-Windows-RPC/RpcClientCall/win:Start201
224 Microsoft-Windows-RPC/RpcServerCall/win:Start1036
225 Microsoft-Windows-RPC/RpcClientCall/win:Stop199
226 Microsoft-Windows-RPC/RpcServerCall/win:Stop1037
227Microsoft-Windows-ProcessStateManagerMicrosoft-Windows-ProcessStateManager/StateChange/win:Info124
228Microsoft-Windows-Performance-Recorder-Control 96
229 Microsoft-Windows-Performance-Recorder-Control/Perf_LoadProfileFromString/win:Start3
230 Microsoft-Windows-Performance-Recorder-Control/Perf_LoadProfileFromString/win:Stop3
231 Microsoft-Windows-Performance-Recorder-Control/Perf_AddProfileToCollection/win:Start3
232 Microsoft-Windows-Performance-Recorder-Control/Perf_AddProfileToCollection/win:Stop3
233 Microsoft-Windows-Performance-Recorder-Control/Perf_LoadTraceMergePropertiesFromFile/win:Start3
234 Microsoft-Windows-Performance-Recorder-Control/Perf_LoadTraceMergePropertiesFromFile/win:Stop3
235 Microsoft-Windows-Performance-Recorder-Control/Perf_StartProfiles/win:Stop1
236 Microsoft-Windows-Performance-Recorder-Control/Perf_StopProfiles/win:Start1
237 Microsoft-Windows-Performance-Recorder-Control/Perf_QueryProfiles/win:Start2
238 Microsoft-Windows-Performance-Recorder-Control/Perf_QueryProfiles/win:Stop2
239 Microsoft-Windows-Performance-Recorder-Control/Perf_ControlProgressHandlerBegin/win:Start1
240 Microsoft-Windows-Performance-Recorder-Control/Perf_ControlProgressHandlerBegin/win:Stop1
241 Microsoft-Windows-Performance-Recorder-Control/Perf_ControlProgressHandlerUpdate/win:Start34
242 Microsoft-Windows-Performance-Recorder-Control/Perf_ControlProgressHandlerUpdate/win:Stop34
243 Microsoft-Windows-Performance-Recorder-Control/Perf_ControlProgressHandlerEnd/win:Start1
244 Microsoft-Windows-Performance-Recorder-Control/Perf_ControlProgressHandlerEnd/win:Stop1
245Microsoft-Windows-Networking-Correlation 3381
246 Microsoft-Windows-Networking-Correlation//win:Start423
247 Microsoft-Windows-Networking-Correlation//win:Stop376
248 Microsoft-Windows-Networking-Correlation//win:Send2582
249Microsoft-Windows-Kernel-StoreMgrMicrosoft-Windows-Kernel-StoreMgr/StoreRundown/win:Info30
250Microsoft-Windows-Kernel-Processor-Power 190
251 Microsoft-Windows-Kernel-Processor-Power/IdleAccountingRundown/win:Info4
252 Microsoft-Windows-Kernel-Processor-Power/ProcessorFirmwareRundown/win:Info4
253 Microsoft-Windows-Kernel-Processor-Power/PTStateDomainFirmwareRundown/win:Info1
254 Microsoft-Windows-Kernel-Processor-Power/Summary/win:Info4
255 Microsoft-Windows-Kernel-Processor-Power/PerfStatesRundown/win:Info4
256 Microsoft-Windows-Kernel-Processor-Power/BiosPStatesRundown/win:Info4
257 Microsoft-Windows-Kernel-Processor-Power/BiosCStatesRundown/win:Info4
258 Microsoft-Windows-Kernel-Processor-Power/BiosTStatesRundown/win:Info4
259 Microsoft-Windows-Kernel-Processor-Power/LogicalProcessorIdlingRundown/win:Info1
260 Microsoft-Windows-Kernel-Processor-Power/Summary2/win:Info4
261 Microsoft-Windows-Kernel-Processor-Power/PepQueryCapabilities/win:Info4
262 Microsoft-Windows-Kernel-Processor-Power/ProcessorPerformanceRundown/win:Info4
263 Microsoft-Windows-Kernel-Processor-Power/ParkNodeRundown/win:Info1
264 Microsoft-Windows-Kernel-Processor-Power/ProcessorIdleRundown/win:Info4
265 Microsoft-Windows-Kernel-Processor-Power/ProcessorIdRundown/win:Info4
266 Microsoft-Windows-Kernel-Processor-Power/PepGetPlatformIdleStates/win:Info1
267 Microsoft-Windows-Kernel-Processor-Power/PlatformAccountingBucketIntervalsRundown/win:Info1
268 Microsoft-Windows-Kernel-Processor-Power/StaticPolicyRundown/win:Info1
269 Microsoft-Windows-Kernel-Processor-Power/CoordinatedIdleRundown/win:Info1
270 Microsoft-Windows-Kernel-Processor-Power/ProfileRundown/win:Info10
271 Microsoft-Windows-Kernel-Processor-Power/ProfileSettingRundown/win:Info122
272 Microsoft-Windows-Kernel-Processor-Power/ProfileStatusRundown/win:Info1
273 Microsoft-Windows-Kernel-Processor-Power/HeterogeneousPoliciesRundown/win:Info1
274 Microsoft-Windows-Kernel-Processor-Power/QosSupportRundown/win:Info1
275Microsoft-Windows-Kernel-Power 1344
276 Microsoft-Windows-Kernel-Power/SystemTimeResolutionChange/win:Info1046
277 Microsoft-Windows-Kernel-Power/SystemTimeResolutionRundown/win:Info1
278 Microsoft-Windows-Kernel-Power/SystemTimeResolutionRequestRundown/win:Info1
279 Microsoft-Windows-Kernel-Power/SystemTimeResolutionKernelChange/win:Info103
280 Microsoft-Windows-Kernel-Power/PowerRequestRundown/win:Info8
281 Microsoft-Windows-Kernel-Power/SleepDisableReasonRundown/win:Info2
282 Microsoft-Windows-Kernel-Power/AcDcStateRundown/win:Info1
283 Microsoft-Windows-Kernel-Power/SystemTimerResolutionStackRundown/win:Info14
284 Microsoft-Windows-Kernel-Power/FirmwarePlatformRoleRundown/win:Info1
285 Microsoft-Windows-Kernel-Power/DeviceRundown/win:Info116
286 Microsoft-Windows-Kernel-Power/StandbyConnectivityRundown/win:Info1
287 Microsoft-Windows-Kernel-Power/CsComplianceRundown/win:Info5
288 Microsoft-Windows-Kernel-Power/DeepSleepConstraintRundown/win:Info1
289 Microsoft-Windows-Kernel-Power/SystemLatencyRundown/win:Info1
290 Microsoft-Windows-Kernel-Power/DynamicTickStatusRundown/win:Info1
291 Microsoft-Windows-Kernel-Power/PowerStateEventRundown/win:Info42
292Microsoft-Windows-Kernel-EventTracing 1949
293 Microsoft-Windows-Kernel-EventTracing/ETW_TASK_STACK_TRACE/ETW_OPCODE_USER_MODE_STACK_TRACE1109
294 Microsoft-Windows-Kernel-EventTracing/ETW_TASK_LOST_EVENT/win:Info840
295Microsoft-Windows-DxgKrnl 23024
296 Microsoft-Windows-DxgKrnl/VSyncDPC/win:Info425
297 Microsoft-Windows-DxgKrnl/WorkerThread/win:Start178
298 Microsoft-Windows-DxgKrnl/WorkerThread/win:Stop179
299 Microsoft-Windows-DxgKrnl/ChangePriority/win:Info51
300 Microsoft-Windows-DxgKrnl/AttemptPreemption/win:Info75
301 Microsoft-Windows-DxgKrnl/Adapter/win:DC_Start2
302 Microsoft-Windows-DxgKrnl/Device/win:DC_Start38
303 Microsoft-Windows-DxgKrnl/Context/win:DC_Start51
304 Microsoft-Windows-DxgKrnl/AdapterAllocation/win:Start1
305 Microsoft-Windows-DxgKrnl/AdapterAllocation/win:Stop1
306 Microsoft-Windows-DxgKrnl/AdapterAllocation/win:DC_Start979
307 Microsoft-Windows-DxgKrnl/DeviceAllocation/win:Start2
308 Microsoft-Windows-DxgKrnl/DeviceAllocation/win:Stop2
309 Microsoft-Windows-DxgKrnl/DeviceAllocation/win:DC_Start1068
310 Microsoft-Windows-DxgKrnl/TerminateAllocation/win:Info1
311 Microsoft-Windows-DxgKrnl/ProcessTerminateAllocation/win:Info1
312 Microsoft-Windows-DxgKrnl/Lock/win:Info40
313 Microsoft-Windows-DxgKrnl/Unlock/win:Info40
314 Microsoft-Windows-DxgKrnl/ReferenceAllocations/win:Info74
315 Microsoft-Windows-DxgKrnl/PatchLocationList/win:Info87
316 Microsoft-Windows-DxgKrnl/ApertureMapping/win:Info11
317 Microsoft-Windows-DxgKrnl/ApertureUnmapping/win:Info1
318 Microsoft-Windows-DxgKrnl/PagingOpMapApertureSegment/win:Info22
319 Microsoft-Windows-DxgKrnl/PagingOpUnmapApertureSegment/win:Info2
320 Microsoft-Windows-DxgKrnl/Preparation/win:Start74
321 Microsoft-Windows-DxgKrnl/Preparation/win:Info13
322 Microsoft-Windows-DxgKrnl/Preparation/win:Stop74
323 Microsoft-Windows-DxgKrnl/ReserveResource/win:Start11
324 Microsoft-Windows-DxgKrnl/ReserveResource/win:Stop11
325 Microsoft-Windows-DxgKrnl/InnerIteration/win:Start22
326 Microsoft-Windows-DxgKrnl/InnerIteration/win:Stop22
327 Microsoft-Windows-DxgKrnl/AllocationFault/win:Info32
328 Microsoft-Windows-DxgKrnl/MarkAllocation/win:Info1
329 Microsoft-Windows-DxgKrnl/PageInAllocation/win:Info11
330 Microsoft-Windows-DxgKrnl/AddDmaBuffer/win:Start51
331 Microsoft-Windows-DxgKrnl/ReportSegment/win:Info9
332 Microsoft-Windows-DxgKrnl/ReportCommittedAllocation/win:Info43
333 Microsoft-Windows-DxgKrnl/Semaphore/win:DC_Start45
334 Microsoft-Windows-DxgKrnl/Fence/win:Start1
335 Microsoft-Windows-DxgKrnl/Fence/win:Stop1
336 Microsoft-Windows-DxgKrnl/Fence/win:DC_Start57
337 Microsoft-Windows-DxgKrnl/SetDisplayMode/win:Info2
338 Microsoft-Windows-DxgKrnl/BlockThread/win:Info3
339 Microsoft-Windows-DxgKrnl/Profiler/win:Start7151
340 Microsoft-Windows-DxgKrnl/Profiler/win:Stop7150
341 Microsoft-Windows-DxgKrnl/ExtendedProfiler/win:Start189
342 Microsoft-Windows-DxgKrnl/ExtendedProfiler/win:Stop189
343 Microsoft-Windows-DxgKrnl/SetPointerPosition/win:Info190
344 Microsoft-Windows-DxgKrnl/DpiReportAdapter/win:Info3
345 Microsoft-Windows-DxgKrnl/MMIOFlip/win:Info36
346 Microsoft-Windows-DxgKrnl/EtwVersion/win:Stop1
347 Microsoft-Windows-DxgKrnl/Flip/win:Info36
348 Microsoft-Windows-DxgKrnl/Render/win:Info36
349 Microsoft-Windows-DxgKrnl/RenderKm/win:Info38
350 Microsoft-Windows-DxgKrnl/PresentHistory/win:Info37
351 Microsoft-Windows-DxgKrnl/PresentHistory/win:Stop37
352 Microsoft-Windows-DxgKrnl/DmaPacket/win:Start74
353 Microsoft-Windows-DxgKrnl/DmaPacket/win:Stop73
354 Microsoft-Windows-DxgKrnl/DmaPacket/win:Info73
355 Microsoft-Windows-DxgKrnl/QueuePacket/win:Start269
356 Microsoft-Windows-DxgKrnl/QueuePacket/win:Info316
357 Microsoft-Windows-DxgKrnl/QueuePacket/win:Stop267
358 Microsoft-Windows-DxgKrnl/VSyncInterrupt/win:Info425
359 Microsoft-Windows-DxgKrnl/GetDeviceState/win:Info216
360 Microsoft-Windows-DxgKrnl/Present/win:Info36
361 Microsoft-Windows-DxgKrnl/OfferAllocation/win:Start40
362 Microsoft-Windows-DxgKrnl/OfferAllocation/win:Info40
363 Microsoft-Windows-DxgKrnl/OfferAllocation/win:Stop11
364 Microsoft-Windows-DxgKrnl/ReportOfferAllocation/win:Info83
365 Microsoft-Windows-DxgKrnl/ReclaimAllocation/win:Info40
366 Microsoft-Windows-DxgKrnl/PresentHistoryDetailed/win:Start38
367 Microsoft-Windows-DxgKrnl/ReportCommittedGlobalAllocation/win:DC_Start6
368 Microsoft-Windows-DxgKrnl/SignalSynchronizationObject2/win:Info72
369 Microsoft-Windows-DxgKrnl/NodeMetadata/win:Info5
370 Microsoft-Windows-DxgKrnl/VSyncDPCMultiPlane/win:Info425
371 Microsoft-Windows-DxgKrnl/TotalBytesResidentInSegment/win:Info12
372 Microsoft-Windows-DxgKrnl/Brightness/win:Info2
373 Microsoft-Windows-DxgKrnl/BacklightOptimizationLevel/win:Info2
374 Microsoft-Windows-DxgKrnl/VidMmDereferenceObjectAsync/win:Start1
375 Microsoft-Windows-DxgKrnl/VidMmDereferenceObjectAsync/win:Stop1
376 Microsoft-Windows-DxgKrnl/VidMmUnmapViewAsync/win:Start2
377 Microsoft-Windows-DxgKrnl/VidMmUnmapViewAsync/win:Stop2
378 Microsoft-Windows-DxgKrnl/PagingPreparation/win:Start279
379 Microsoft-Windows-DxgKrnl/PagingPreparation/win:Stop279
380 Microsoft-Windows-DxgKrnl/CddStandardAllocation/win:Info1
381 Microsoft-Windows-DxgKrnl/MonitoredFence/win:DC_Start63
382 Microsoft-Windows-DxgKrnl/SignalSynchronizationObjectFromGpu/win:Info72
383 Microsoft-Windows-DxgKrnl/UnwaitCpuWaiter/win:Info19
384 Microsoft-Windows-DxgKrnl/DWMVsyncCountWait/win:Info71
385 Microsoft-Windows-DxgKrnl/DWMVsyncSignal/win:Info425
386 Microsoft-Windows-DxgKrnl/PagingQueuePacket/win:Start21
387 Microsoft-Windows-DxgKrnl/PagingQueuePacket/win:Info21
388 Microsoft-Windows-DxgKrnl/PagingQueuePacket/win:Stop21
389 Microsoft-Windows-DxgKrnl/ClearFlipDevice/win:Info1
390 Microsoft-Windows-DxgKrnl/ExtendedProfiler/win:Info177
391 Microsoft-Windows-DxgKrnl/FlushScheduler/win:Info4
392 Microsoft-Windows-DxgKrnl/LockAllocationBackingStore/win:Info2
393 Microsoft-Windows-DxgKrnl/VidMmProcessBudgetChange/win:Info8
394 Microsoft-Windows-DxgKrnl/VidMmProcessUsageChange/win:Info8
395 Microsoft-Windows-DxgKrnl/VidMmProcessCommitmentChange/win:Info8
396 Microsoft-Windows-DxgKrnl/AssociateDxgSchedulerObject/win:Info33
397 Microsoft-Windows-DxgKrnl/ReportSyncObject/win:Info1
398 Microsoft-Windows-DxgKrnl/ReportSyncObject/win:Start72
399Microsoft-Windows-DotNETRuntimeRundown 4662
400 Microsoft-Windows-DotNETRuntimeRundown/CLRMethodRundown/MethodDCEndVerbose1796
401 Microsoft-Windows-DotNETRuntimeRundown/CLRMethodRundown/DCEndComplete8
402 Microsoft-Windows-DotNETRuntimeRundown/CLRMethodRundown/DCEndInit8
403 Microsoft-Windows-DotNETRuntimeRundown/CLRMethodRundown/MethodDCEndILToNativeMap1676
404 Microsoft-Windows-DotNETRuntimeRundown/CLRLoaderRundown/DomainModuleDCEnd378
405 Microsoft-Windows-DotNETRuntimeRundown/CLRLoaderRundown/ModuleDCEnd386
406 Microsoft-Windows-DotNETRuntimeRundown/CLRLoaderRundown/AssemblyDCEnd386
407 Microsoft-Windows-DotNETRuntimeRundown/CLRLoaderRundown/AppDomainDCEnd16
408 Microsoft-Windows-DotNETRuntimeRundown/CLRRuntimeInformationRundown/win:Start8
409Microsoft-Windows-DotNETRuntime 2584
410 Microsoft-Windows-DotNETRuntime/CLRMethod/MethodUnloadVerbose1796
411 Microsoft-Windows-DotNETRuntime/CLRLoader/ModuleUnload386
412 Microsoft-Windows-DotNETRuntime/CLRLoader/AssemblyUnload386
413 Microsoft-Windows-DotNETRuntime/CLRLoader/AppDomainUnload16
414Microsoft-Windows-Direct3D11 1002
415 Microsoft-Windows-Direct3D11/Name/win:DC_Start237
416 Microsoft-Windows-Direct3D11/Device/win:DC_Start29
417 Microsoft-Windows-Direct3D11/Buffer/win:DC_Start250
418 Microsoft-Windows-Direct3D11/Texture2D/win:Start1
419 Microsoft-Windows-Direct3D11/Texture2D/win:Stop1
420 Microsoft-Windows-Direct3D11/Texture2D/win:DC_Start431
421 Microsoft-Windows-Direct3D11/Texture2D/win:Info31
422 Microsoft-Windows-Direct3D11/JournalEntry/win:Info22
423Microsoft-Windows-DXGI 384
424 Microsoft-Windows-DXGI/Factory/win:DC_Start40
425 Microsoft-Windows-DXGI/Adapter/win:DC_Start51
426 Microsoft-Windows-DXGI/Output/win:DC_Start29
427 Microsoft-Windows-DXGI/SwapChain/win:DC_Start2
428 Microsoft-Windows-DXGI/Present/win:Start64
429 Microsoft-Windows-DXGI/Present/win:Stop64
430 Microsoft-Windows-DXGI/GetFrameStatistics/win:Info64
431 Microsoft-Windows-DXGI/JournalEntry/win:Info70
432Microsoft-JScript 83376
433 Microsoft-JScript/MethodRundown/DCEndInit16
434 Microsoft-JScript/MethodRundown/DCEndComplete16
435 Microsoft-JScript/MethodRundown/MethodDCEnd16156
436 Microsoft-JScript/ScriptContextRundown/ScriptContextDCEnd40
437 Microsoft-JScript/MethodRuntime/MethodLoad67070
438 Microsoft-JScript/ScriptContextRundown/SourceDCEnd78
439ImageId 88017
440 ImageId: Info22513
441 DbgId: None294
442 DbgId: BIN6
443 DbgId: DBG6
444 DbgId: RSDS22207
445 DbgId: ILRSDS258
446 ImageId [Provider]40920
447 ImageId: FileVersion1813
448Image 22520
449 Image: Unload579
450 Image: Start Rundown11227
451 Image: End Rundown10681
452 Image: Load32
453 Image: Kernel Base1
454FileIo 81561
455 Filename: Create152
456 Filename: Delete1680
457 Filename: Rundown9839
458 FileIo: Create1108
459 FileIo: Cleanup900
460 FileIo: Close3113
461 FileIo: Read5286
462 FileIo: Write475
463 FileIo: SetInfo43
464 FileIo: Rename1
465 FileIo: DirEnum222
466 FileIo: Flush7
467 FileIo: QueryInfo23633
468 FileIo: FSCTL155
469 FileIo: OperationEnd34941
470 FileIo: DirNotify5
471 FileIo: RenamePath1
472EventTrace 21
473 EventTrace: Header1
474 EventTrace: Group Masks4
475 EventTrace: Rundown Complete3
476 EventTrace: Group Masks End3
477 EventTrace: DbgId (RSDS)2
478 EventTrace: Build Lab1
479 EventTrace: Binary Path2
480 EventTrace [Provider]5
481EventMetadata 468
482 Event Metadata: Event Info333
483 Event Metadata: Map Info135
484DiskIo 8941
485 DiskIo: Read5329
486 DiskIo: Write438
487 DiskIo: Read Init2994
488 DiskIo: Write Init158
489 DiskIo: Flush18
490 DiskIo: Flush Init4
4913044f61a-99b0-4c21-b203-d39423c73b0030


分析CPU相关

CPU执行的基本单元是线程,线程有三种状态:wait(不可执行且未运行,需要SetEvent或者timer到来)、ready(可执行但未运行,等待执行线程的时间片消耗完)、running(可执行且正在运行)。当然,影响这三个状态的,还有线程优先级,处于ready状态下的高优先线程,会比处于ready状态下的低优先级线程先执行。Foreground Windows线程优先级会被动态提升得很高,且时间片分配得更多。

硬件设备与CPU交互的方式,是中断。当发生中断的时候,当前running的线程会被挂起,然后切换到中断服务线程,执行中断响应。当正在执行中断响应的时候,会阻止其他任何形式的线程切换,中断服务会一直保持执行完成。基于中断服务是原子级别的,这就要求中断服务的执行必须快速完成。为了降低中断执行时间,通常会抛一个DPCs调用,放到系统的DPCs队列,优于其他线程执行,但是能保证中断的切换执行。由于这个高优先级原因,也会影响性能点,可能导致其他线程的执行受到延迟。

如果线程处于同步等待,会影响性能,可能不能充分利用多个CPU核,另外UI线程如果同步等待,会导致UI线程卡顿,界面绘制卡顿。

与CPU相关的视图,有很多个

Power/CPU Idle States

主要是分析CPU每个核心的空闲状态。如果对于一个后台服务,需要CPU尽可能跑满,这里CPU空闲态应该尽可能少。如果分析一个笔记本的CPU运转模式,应该使得空闲尽可能多,尽可能进入省电模式。

Power/CPU Frequency

主要分析CPU每个核心的运转频率情况。之所以频率可变,是因为P-State(Performance)和T-State(Throttle )机制。这里曲线表示的是P-State的频率变化,常规状态下是一条直线,如果发生变化,就是可能有多重不同的P-State在做切换。

Computation/CPU Usage (Sampled)

每1ms对CPU的每一个核做一次采样,获取对应的进程、线程执行情况,统计出执行次数和时间。因为采样间隔为1ms,其实很长了,很多DPCs和ISRs是非常短的,可能都无法采样到。另外,这里由于CPU的状态切换,所以采样计算到的时间并不一定精确,其中weight都是直接采用当前采样时间减去上一次采样时间的。其中分为如下几个子视图:
Utilization by CPU:描述了每个CPU核上跑了哪些任务
Utilization by Priority:描述了高优先级的如何影响低优先级的任务,以及不同优先级任务执行情况
Utilization by Process:描述了哪些进程占用了更多的CPU
Utilization by Process and Thread:描述了哪些进程的那些线程占用了更多的CPU
Utilization by Process,Stacks:描述了进程的哪些栈帧对CPU有更高的占用。这里不同线程可能调用同一个api,有相同的栈帧。
Utilization by Process,Thread,Stacks:描述了进程的哪些线程的哪些栈对CPU有更高的占用
DPC and ISR Usage by Module,Stack:描述了DPC和ISR的原子级别对CPU的占用,某模块(驱动模块)的栈帧级别的CPU占用。过多的占用也是性能影响点之一。

Computation/CPU Usage (Precise)

精确记录了上下文切换的情况,特别适合用于分析父子关系链,追溯源头。例如发现某个线程栈帧大量占用CPU,但是这个不是主动触发的,触发的场景又非常多,需要精确定位到是谁,就需要用这里的精确统计,记录的上下文切换情况来分析看待。
上下文线程切换的事件序列如下图:

jpg

几个概念: New thread:线程切换刚切换进来的线程,也是当前采样点所在的线程,通常以它作为分析核心,围绕着谁把它拉起来的来分析。
NewPrev thread:New thread的上一次切入进来的时刻状态
Readying thread:这个就是唤醒New thread的线程,也可以认为是父关系的线程。这个和New thread常用来作为核心分析对象,指明谁拉起了某个线程(SetEvent之类的,或PostTask之类的)
Old thread:当新线程被切换进入之前被切换出去的线程,这个看起来没啥价值。

在这个视图中,可以看到任意有关上下文的信息。比如将当前线程拉起来的Reading Thread的详细调用栈、起始函数、模块、以及线程退出的原因等等。

(1)Timeline by CPU:标识了每一个CPU核心的整个时间片的消耗序列
(2)Timeline by Process, Thread:进程线程的生命周期。比如有时候分析UI卡顿,在卡顿的那段时间Zoom,可以查看这段时间点的进程在干嘛
(3)Usage by Priority at Context Switch Begin:不同优先级的任务分布
(4)Utilization by CPU:不同CPU核的进程线程切换状态分布
(5)Utilization by Process, Thread:进程线程维度的详细唤醒分布等

剩下其他的,就自由发挥了

分析UI卡顿

首先看UI Delay的情况:

jpg

可以看到该进程有3个线程,每个线程分别卡了4s。这种情况,需要怀疑下是否死锁。再看CPU消耗情况:

jpg

当UI卡的时候,对应进程的CPU消耗为0,这说明卡顿现象,不是UI线程高计算任务导致的。既然跟CPU无关,那可能是在进行同步等待操作,或者死锁之类的。同步等待操作可能是正在进行文件的操作。先怀疑下IO,来看下IO的影响:

jpg

找了一遍,并没有对应进程的文件IO的消耗。再看下磁盘IO,发现也没有

那理论上来说,至少应该跟这些无关才对?回到刚刚CPU的情况,发现一个问题,所有对应的卡顿的UI线程,在CPU消耗里,一个都没有,应该是由于各种sleep或者wait,当前线程挂起,执行权交给别的线程了。那么就来看一下这些挂起的线程的生命周期,以及结束运行时的调用栈:

jpg

我的机器,加载符号有问题。这里大概知道是Win10这种AppCore内某个api的性能问题(内部可能大量的同步等待等等)。

打赏一个呗

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码支持
扫码打赏,你说多少就多少