aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Diagnostics
diff options
context:
space:
mode:
authorFICTURE7 <FICTURE7@gmail.com>2022-09-09 03:14:08 +0400
committerGitHub <noreply@github.com>2022-09-08 20:14:08 -0300
commitee1825219b8ccca13df7198d4e9ffb966e44c883 (patch)
tree5d44ffc535393b574ab45c3e206264af948f3f6c /ARMeilleure/Diagnostics
parent7baa08dcb4b38fe36bb19bf84b3fcd386d143463 (diff)
Clean up rejit queue (#2751)
Diffstat (limited to 'ARMeilleure/Diagnostics')
-rw-r--r--ARMeilleure/Diagnostics/EventSources/AddressTableEventSource.cs51
-rw-r--r--ARMeilleure/Diagnostics/TranslatorEventSource.cs67
2 files changed, 67 insertions, 51 deletions
diff --git a/ARMeilleure/Diagnostics/EventSources/AddressTableEventSource.cs b/ARMeilleure/Diagnostics/EventSources/AddressTableEventSource.cs
deleted file mode 100644
index 201a2562..00000000
--- a/ARMeilleure/Diagnostics/EventSources/AddressTableEventSource.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System.Diagnostics.Tracing;
-
-namespace ARMeilleure.Diagnostics.EventSources
-{
- [EventSource(Name = "ARMeilleure")]
- class AddressTableEventSource : EventSource
- {
- public static readonly AddressTableEventSource Log = new();
-
- private ulong _size;
- private ulong _leafSize;
- private PollingCounter _sizeCounter;
- private PollingCounter _leafSizeCounter;
-
- public AddressTableEventSource()
- {
- _sizeCounter = new PollingCounter("addr-tab-alloc", this, () => _size / 1024d / 1024d)
- {
- DisplayName = "AddressTable Total Bytes Allocated",
- DisplayUnits = "MB"
- };
-
- _leafSizeCounter = new PollingCounter("addr-tab-leaf-alloc", this, () => _leafSize / 1024d / 1024d)
- {
- DisplayName = "AddressTable Total Leaf Bytes Allocated",
- DisplayUnits = "MB"
- };
- }
-
- public void Allocated(int bytes, bool leaf)
- {
- _size += (uint)bytes;
-
- if (leaf)
- {
- _leafSize += (uint)bytes;
- }
- }
-
- protected override void Dispose(bool disposing)
- {
- _leafSizeCounter.Dispose();
- _leafSizeCounter = null;
-
- _sizeCounter.Dispose();
- _sizeCounter = null;
-
- base.Dispose(disposing);
- }
- }
-}
diff --git a/ARMeilleure/Diagnostics/TranslatorEventSource.cs b/ARMeilleure/Diagnostics/TranslatorEventSource.cs
new file mode 100644
index 00000000..a0456e98
--- /dev/null
+++ b/ARMeilleure/Diagnostics/TranslatorEventSource.cs
@@ -0,0 +1,67 @@
+using System.Diagnostics.Tracing;
+using System.Threading;
+
+namespace ARMeilleure.Diagnostics
+{
+ [EventSource(Name = "ARMeilleure")]
+ class TranslatorEventSource : EventSource
+ {
+ public static readonly TranslatorEventSource Log = new();
+
+ private int _rejitQueue;
+ private ulong _funcTabSize;
+ private ulong _funcTabLeafSize;
+ private PollingCounter _rejitQueueCounter;
+ private PollingCounter _funcTabSizeCounter;
+ private PollingCounter _funcTabLeafSizeCounter;
+
+ public TranslatorEventSource()
+ {
+ _rejitQueueCounter = new PollingCounter("rejit-queue-length", this, () => _rejitQueue)
+ {
+ DisplayName = "Rejit Queue Length"
+ };
+
+ _funcTabSizeCounter = new PollingCounter("addr-tab-alloc", this, () => _funcTabSize / 1024d / 1024d)
+ {
+ DisplayName = "AddressTable Total Bytes Allocated",
+ DisplayUnits = "MB"
+ };
+
+ _funcTabLeafSizeCounter = new PollingCounter("addr-tab-leaf-alloc", this, () => _funcTabLeafSize / 1024d / 1024d)
+ {
+ DisplayName = "AddressTable Total Leaf Bytes Allocated",
+ DisplayUnits = "MB"
+ };
+ }
+
+ public void RejitQueueAdd(int count)
+ {
+ Interlocked.Add(ref _rejitQueue, count);
+ }
+
+ public void AddressTableAllocated(int bytes, bool leaf)
+ {
+ _funcTabSize += (uint)bytes;
+
+ if (leaf)
+ {
+ _funcTabLeafSize += (uint)bytes;
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ _rejitQueueCounter.Dispose();
+ _rejitQueueCounter = null;
+
+ _funcTabLeafSizeCounter.Dispose();
+ _funcTabLeafSizeCounter = null;
+
+ _funcTabSizeCounter.Dispose();
+ _funcTabSizeCounter = null;
+
+ base.Dispose(disposing);
+ }
+ }
+}