I'm trying to use a Performance Counter do determine how many bytes my application has sent or received. I followed the suggested solution found here: Calculating Bandwidth, but the instance of my application doesn’t show up in the “.NET CLR Networking” category. Exception message:
"Instance 'ApplicationName[8824]' does not exist in the specified Category"
(I have added <performanceCounters enabled="true"/>
in my App.config and it still it cannot be found after some networking activities)
So I started Performance Monitor so see the error with my own eyes. As expected, my application doesn't show up in the .NET CLR Networking category, but it can luckily be found in the .NET CLR Networking 4.0.0.0 category.
However, my problem is that I cannot figure out how instance name is generated. Here is the name of the instance I see in the Performance Monitor: ApplicationName.exe_p4952_r15_ad1
.
So far I have figured out that the first parts must be made of ProcessName and PID, but I have no clue what the last two ("r15" and "ad1") pieces come from.
Does somebody have a clue what the last two pieces could be?
One solution would be to enumerate all the instances found in the “.NET CLR Networking 4.0.0.0” category and search for ApplicationName.exe_PID*, but would prefer to look for the correct name directly (if possible).