Community
cancel
Showing results for 
Search instead for 
Did you mean: 
beachbear
Beginner
41 Views

What are the steps to attach and profile my windows service?

What are the steps to attach and profile my windows service?

I get the following error:

Error: Failed to attach to the process with the specified PID. Specify another PID and try attaching again.Error: System error 0x0 : OpenProcess : The operation completed successfully.Pin is exiting due to fatal error

I tried changing the service's logonfrom SYSTEM to my account. Nothing helps.
Is it possible at all with that product?

Thank you.

0 Kudos
2 Replies
Peter_W_Intel
Employee
41 Views

Please use my test scenario: (under Windows 7, target pid "2172" is McAfeeframework in my system)

1. Open cmd as "administrator"

2. Run amplxe-vars.bat from C:\Program Files (x86)\Intel\VTune Amplifier XE 2011

3. (You have to give up this step, since it is user-mode data collection and cannot attach system service)
amplxe-cl -collect hotspots -duration 5 -target-pid 2172
Error: Failed to attach to the process with the specified PID. Specify another P
ID and try attaching again.
Error: System error 0x0 : OpenProcess : The operation completed successfully.Pin
is exiting due to fatal error

4. (You have to use lightweight-hotspots, it works on tool's driver)
C:\temp>amplxe-cl -collect lightweight-hotspots -duration 5 -target-pid 2172
Using result path `C:\temp\r015lh'
Executing actions 75 % Generating a report
Summary
-------

Elapsed Time: 4.868
Executing actions 100 % done

5.Display results
C:\temp>amplxe-cl -report hw-events
Using result path `C:\temp\r015lh'
Executing actions 75 % Generating a report
Function Module CPU_CLK_UNHALTED.THREAD:H
ardware Event Count CPU_CLK_UNHALTED.REF_TSC:Hardware Event Count INST_RETIRED
.ANY:Hardware Event Count
------------------------------------- -------------- -------------------------
------------------- --------------------------------------------- ------------
-------------------------
SeAccessCheckWithHint ntoskrnl.exe 4000000
12000000 2000000
CpuSimulate wow64cpu.dll 2000000
0 0
KeAcquireSpinLockAtDpcLevel ntoskrnl.exe 2000000
2000000 0
KeDelayExecutionThread ntoskrnl.exe 2000000
4000000 2000000
KeSynchronizeExecution ntoskrnl.exe 2000000
2000000 0
RtlEqualUnicodeString ntoskrnl.exe 2000000
0 2000000
SleepEx kernelbase.dll 2000000
4000000 0
DllUnregisterServer scheduler.dll 0
2000000 0
IoAttachDeviceByPointer ntoskrnl.exe 0
2000000 0
IsNLSDefinedString kernelbase.dll 0
2000000 0
KeInterlockedClearProcessorAffinityEx ntoskrnl.exe 0
2000000 0
KeInterlockedSetProcessorAffinityEx ntoskrnl.exe 0
2000000 0
KeSetTimer ntoskrnl.exe 0
2000000 2000000
NtDelayExecution ntdll.dll 0
4000000 0
Sleep kernel32.dll 0
2000000 0
Sleep kernelbase.dll 0
2000000 0
TurboDispatchJumpAddressEnd wow64cpu.dll 0
4000000 2000000
[intelppm.sys] intelppm.sys 0
2000000 0
Executing actions 100 % done


Regards, Peter

Kirill_R_Intel
Employee
41 Views

Beachbear,

Please also refer to this article:
http://software.intel.com/en-us/articles/profiling-windows-service/

Regards,
Kirill
Reply