From 729ba8e2be340cec640ac23f651f14495222ef89 Mon Sep 17 00:00:00 2001 From: marc-adaptive Date: Thu, 19 Dec 2024 14:19:52 -0500 Subject: [PATCH] Allow disabling duty cycle trackers --- .../java/uk/co/real_logic/artio/FixCounters.java | 15 +++++++++++++++ .../artio/engine/EngineConfiguration.java | 4 ++-- .../artio/library/LibraryConfiguration.java | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/artio-core/src/main/java/uk/co/real_logic/artio/FixCounters.java b/artio-core/src/main/java/uk/co/real_logic/artio/FixCounters.java index 44e78761a8..bcc892c40f 100644 --- a/artio-core/src/main/java/uk/co/real_logic/artio/FixCounters.java +++ b/artio-core/src/main/java/uk/co/real_logic/artio/FixCounters.java @@ -159,6 +159,11 @@ public AtomicCounter negativeTimestamps() public DutyCycleTracker getFramerDutyCycleTracker(final long threshold) { + if (threshold == 0) + { + return new DutyCycleTracker(); + } + return new DutyCycleStallTracker( newCounter(FRAMER_MAX_CYCLE_TIME_TYPE_ID.id(), "framer max cycle time in ns"), newCounter(FRAMER_CYCLE_TIME_THRESHOLD_EXCEEDED_TYPE_ID.id(), @@ -169,6 +174,11 @@ public DutyCycleTracker getFramerDutyCycleTracker(final long threshold) public DutyCycleTracker getIndexerDutyCycleTracker(final long threshold) { + if (threshold == 0) + { + return new DutyCycleTracker(); + } + return new DutyCycleStallTracker( newCounter(INDEXER_MAX_CYCLE_TIME_TYPE_ID.id(), "indexer max cycle time in ns"), newCounter(INDEXER_CYCLE_TIME_THRESHOLD_EXCEEDED_TYPE_ID.id(), @@ -179,6 +189,11 @@ public DutyCycleTracker getIndexerDutyCycleTracker(final long threshold) public DutyCycleTracker getLibraryDutyCycleTracker(final int libraryId, final long threshold) { + if (threshold == 0) + { + return new DutyCycleTracker(); + } + return new DutyCycleStallTracker( newCounter(LIBRARY_MAX_CYCLE_TIME_TYPE_ID.id(), "library " + libraryId + " max cycle time in ns"), newCounter(LIBRARY_CYCLE_TIME_THRESHOLD_EXCEEDED_TYPE_ID.id(), diff --git a/artio-core/src/main/java/uk/co/real_logic/artio/engine/EngineConfiguration.java b/artio-core/src/main/java/uk/co/real_logic/artio/engine/EngineConfiguration.java index a2dd42f242..de71b37d56 100644 --- a/artio-core/src/main/java/uk/co/real_logic/artio/engine/EngineConfiguration.java +++ b/artio-core/src/main/java/uk/co/real_logic/artio/engine/EngineConfiguration.java @@ -1300,7 +1300,7 @@ public EngineConfiguration cancelOnDisconnectTimeoutWindowInMs(final int cancelO * Set a threshold for the framer work cycle time which when exceeded it will increment the * framer cycle time exceeded count. * - * @param framerCycleThresholdNs value in nanoseconds + * @param framerCycleThresholdNs value in nanoseconds. The value 0 will disable duty cycle tracking on the framer. * @return this for fluent API. */ public EngineConfiguration framerCycleThresholdNs(final long framerCycleThresholdNs) @@ -1313,7 +1313,7 @@ public EngineConfiguration framerCycleThresholdNs(final long framerCycleThreshol * Set a threshold for the indexer work cycle time which when exceeded it will increment the * indexer cycle time exceeded count. * - * @param indexerCycleThresholdNs value in nanoseconds + * @param indexerCycleThresholdNs value in nanoseconds. The value 0 will disable duty cycle tracking on the indexer. * @return this for fluent API. */ public EngineConfiguration indexerCycleThresholdNs(final long indexerCycleThresholdNs) diff --git a/artio-core/src/main/java/uk/co/real_logic/artio/library/LibraryConfiguration.java b/artio-core/src/main/java/uk/co/real_logic/artio/library/LibraryConfiguration.java index fa2c9919c9..827f708237 100644 --- a/artio-core/src/main/java/uk/co/real_logic/artio/library/LibraryConfiguration.java +++ b/artio-core/src/main/java/uk/co/real_logic/artio/library/LibraryConfiguration.java @@ -292,7 +292,7 @@ public LibraryConfiguration reproduceInbound( * Set a threshold for the library work cycle time which when exceeded it will increment the * library cycle time exceeded count. * - * @param libraryCycleThresholdNs value in nanoseconds + * @param libraryCycleThresholdNs value in nanoseconds. The value 0 will disable duty cycle tracking on the library. * @return this for fluent API. */ public LibraryConfiguration libraryCycleThresholdNs(final long libraryCycleThresholdNs)