Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to identify the ProcessId (PID) in which a test is running ?
eric-b
#1 Posted : Tuesday, September 2, 2014 4:13:47 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/29/2014(UTC)
Posts: 8
Location: France

Hi,

Is there an easy way to identify the PID for a given test, while it is executing ?

I wish to attach the performance profiler when I break into a test...

Thanks.
Remco
#2 Posted : Tuesday, September 2, 2014 11:23:08 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi,

At the moment NCrunch doesn't have this feature. There may be a way you can work around this. Try the following:

1. At the start of the test you wish to profile, add the following line of code:

var myPid = System.Diagnostics.Process.GetCurrentProcess().Id;

2. Fire up a debugging session for this test. Break just under the new line of code
3. Check the PID using the debugger
4. Attach the performance profiler to the .EXE with the PID

Other than blind guessing or trying to deductively terminate other test processes, at the moment I'm not sure if there is an easier way to do this.
eric-b
#3 Posted : Wednesday, September 3, 2014 6:04:11 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/29/2014(UTC)
Posts: 8
Location: France

Ok, actually I use a similar technique with process explorer to identify Ncrunch process when it starts (PE highlights new processes in green).

I expected to find the pid in the Process Queue or Tests window.

Thanks
Remco
#4 Posted : Wednesday, September 3, 2014 7:12:26 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
When support for task termination was added in V2, there were actually plans to add the PID to a column inside the Processing Queue or Tests Window.

Unfortunately, this proved to be somewhat more challenging when working with the grid processing, so the design was changed to use an internal ID instead.

I'd be happy to revisit this with a bit more determination if there is enough interest in it. You're welcome to request it as a feature if you like.
eric-b
#5 Posted : Wednesday, September 3, 2014 9:07:54 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/29/2014(UTC)
Posts: 8
Location: France

Ok, I created it: https://ncrunch.uservoic...which-a-test-is-running

Is it possible to break into a test with grid processing ? Because the only relevant case in which it's usefull in my opinion is when we break into a test via NCrunch debugging feature. But even in that case, I understand that it can be challenging.
Remco
#6 Posted : Wednesday, September 3, 2014 9:20:32 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Quote:
Is it possible to break into a test with grid processing ? Because the only relevant case in which it's usefull in my opinion is when we break into a test via NCrunch debugging feature. But even in that case, I understand that it can be challenging.


Unfortunately not. Breaking into code on a grid node requires remote debugging, which is very challenging to set up and integrate with (if it's actually possible at all).

The problems around providing the process ID for remote processing were down to the details of how the protocol works and the steps involved during the data exchange. A possible solution would be to simply ignore the PID for remotely executing tasks, showing them as (remote) instead.
eric-b
#7 Posted : Wednesday, September 3, 2014 9:53:48 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/29/2014(UTC)
Posts: 8
Location: France

Remote debugging would be a very cool feature but in my case, I don't use processing grid feature.

So, having a PID if test runners are local is just fine for me.

Thanks for your answers.

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.049 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download