Options

Profiling a powershell module

sh54sh54 Posts: 3
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?

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    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).
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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".
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Just checking - did turning some of those filters off get the methods to show in the results?
Sign In or Register to comment.