Bug 41294

Summary: Some Mono threadpool performance counters return 0
Product: [Mono] Runtime Reporter: Christopher Swiedler <cswiedler>
Component: GeneralAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: enhancement CC: alexrp, ludovic, mono-bugs+mono, mono-bugs+runtime
Priority: Normal    
Version: master   
Target Milestone: Future Cycle (TBD)   
Hardware: PC   
OS: All   
Tags: bugpool-archive Is this bug a regression?: ---
Last known good build:
Attachments: Sample code showing zeroed performance counters

Description Christopher Swiedler 2016-05-24 16:33:18 UTC
Created attachment 16091 [details]
Sample code showing zeroed performance counters

Some of the threadpool counters at http://www.mono-project.com/archived/mono_performance_counters/#category-mono-threadpool always return zero values. I can create the performance counters, but they never return correct values. The ones I've gotten this with are:

Work Items Added
Work Items Added/Sec
IO Work Items Added
IO Work Items Added/Sec

Sample code attached. Under mono 3.12, the work items added counter returns 10. Under mono 4.2.3, it returns 0.
Comment 1 Alex Rønne Petersen 2016-08-29 09:08:17 UTC
I can confirm that these counters don't get incremented. Probably an oversight when switching to the Microsoft thread pool code. Repro:

> using System;
> using System.Diagnostics;
> using System.Threading;
> class Program {
>     static void Main () {
>         var ctr = new PerformanceCounter ("Mono Threadpool", "Work Items Added");
>         for (var i = 0; i < 1024; i++)
>             ThreadPool.QueueUserWorkItem (_ => {});
>         Console.WriteLine (ctr.NextValue ());
>     }
> }


NEW -> ASSIGNED as Ludovic is assigned.
Comment 2 Ludovic Henry 2017-02-08 20:55:22 UTC
We acknowledge this enhancement request, therefore marked it as CONFIRMED.
However this does not necessarily mean we will take actions on it as we still need to discuss its feasibility internally and make sure it is not conflicting with other features.