Red Gate forums :: View topic - Profiling a powershell module
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
ANTS Performance Profiler 6
ANTS Performance Profiler 6 forum

Profiling a powershell module

Search in ANTS Performance Profiler 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
sh54



Joined: 24 Oct 2011
Posts: 2

PostPosted: Mon Oct 24, 2011 9:45 am    Post subject: Profiling a powershell module Reply with quote

I have tried to profile a powershell module compiled as a 32-bit c# dotnet 3.5 library by choosing ".NET executable" where the executable is "C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe" and giving it arguments: noexit -command Import-Module "C:/xyz/MY-MODULE.dll"

However, whilst I get to see a graph of the CPU, I cannot inspect which methods take a long time. All the time used is placed under a row labeled "(Waiting for synchronization)".

I have no trouble attaching the Visual Studio debugger directly to powershell.exe and stepping through my source code.

Is there any specific settings I should be using to get profiling working correctly?
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6649

PostPosted: Mon Oct 24, 2011 10:25 am    Post subject: Reply with quote

What does the Import-Module command do? Doesn't it just load the module into Powershell? Then you're not actually running any managed code, so no, you shouldn't expect to see any results.

You'll need to call some code in the DLL.
Back to top
View user's profile Send private message
sh54



Joined: 24 Oct 2011
Posts: 2

PostPosted: Mon Oct 24, 2011 11:12 am    Post subject: Reply with quote

My apologies! I just was not looking hard enough in the call tree (and forgot to mention I was calling a method in my dll from powershell).
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6649

PostPosted: Mon Oct 24, 2011 11:27 am    Post subject: Reply with quote

If you are invoking some code then this is probably the same common problem of not getting results regardless of the kind of app.

You can try the usual first steps - show all methods (vs just the ones that have source), show all threads, and uncheck "hide insignificant methods".
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6649

PostPosted: Tue Oct 25, 2011 11:02 am    Post subject: Reply with quote

Just checking - did turning some of those filters off get the methods to show in the results?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group