Bug 59209 - Custom (user defined) Performance Counter is not accessible from another process
Summary: Custom (user defined) Performance Counter is not accessible from another process
Alias: None
Product: Runtime
Classification: Mono
Component: Interop ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-09-04 13:20 UTC by ivanov.niko.v
Modified: 2017-09-11 13:22 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 59209 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description ivanov.niko.v 2017-09-04 13:20:04 UTC
I need to create custom performance counter(s) in my application and use it from another application. But i can not to access to custom performance counter form another process. What am I doing wrong? Does Mono supports access to user defines counters from another process?

Process #1 (creating custom performance counters)
var CategoryName = "TestCategory";

            if (PerformanceCounterCategory.Exists(CategoryName))
                Console.WriteLine(string.Format("Category '{0}' already exists", CategoryName));
                Console.WriteLine(string.Format("Category '{0}' has been deleted", CategoryName));

            string CategoryDescription = "Test category description";
            var CCDC = new CounterCreationDataCollection();

            var CounterData = new CounterCreationData
                CounterName = "TestCounter",
                CounterType = PerformanceCounterType.NumberOfItems64,
                CounterHelp = "Test counter description"


			PerformanceCounterCategory.Create(CategoryName, CategoryDescription, PerformanceCounterCategoryType.SingleInstance, CCDC);

Process #2 (access to counters from Process #1)
var categories = PerformanceCounterCategory.GetCategories();
            var CategoryName = "TestCategory";
            categories = PerformanceCounterCategory.GetCategories(".");
            var found = categories.FirstOrDefault(c => c.CategoryName == CategoryName); //HERE found is null
            Console.WriteLine("Category '{0}' {1}", CategoryName, found != null ? "exists" : "not found");
var CounterName = "TestCounter";
                PerformanceCounter pc = new PerformanceCounter(CategoryName, CounterName, false);
                Console.WriteLine("pc.CategoryName={0}, pc.CounterName={1}, pc.CounterType={2}, pc.InstanceName= {3}, pc.MachineName={4}, pc.ReadOnly={5}, pc.CounterHelp={6}, pc.RawValue={7}",                             pc.CategoryName, pc.CounterName, pc.CounterType, pc.InstanceName, pc.MachineName,                             pc.ReadOnly, pc.CounterHelp, pc.RawValue);
Comment 1 ivanov.niko.v 2017-09-04 16:07:40 UTC
I am using Mono 4.6.1 in OpenSUSE.
Comment 2 Marek Safar 2017-09-11 13:22:22 UTC
Performance counter are in shared momo memory but this does not seem to work