Skip to content

Inconsistency: PerfmonDisabled check missing from FFM perfmon drivers #3261

Description

@dbwiddis

Problem

JNA perfmon drivers check PerfmonDisabled.PERF_*_DISABLED and return empty collections when perfmon is disabled:

// PhysicalDiskJNA.java
public static Pair<List<String>, Map<PhysicalDiskProperty, List<Long>>> queryDiskCounters() {
    if (PerfmonDisabled.PERF_DISK_DISABLED) {
        return new Pair<>(Collections.emptyList(), Collections.emptyMap());
    }
    return PerfCounterWildcardQuery.queryInstancesAndValues(...);
}

FFM perfmon drivers skip this check entirely:

// PhysicalDiskFFM.java
public static Pair<List<String>, Map<PhysicalDiskProperty, List<Long>>> queryDiskCounters() {
    return PerfCounterWildcardQueryFFM.queryInstancesAndValues(...);
}

Impact

FFM may attempt perfmon queries that are known to be disabled by configuration, potentially causing unnecessary errors or performance overhead.

Proposal

Unify the behavior by either:

  1. Moving the PerfmonDisabled check into a common PerfCounterQuery abstraction (see Reduce duplication: introduce common PerfCounterQuery interface #3258), or
  2. Adding the check to the FFM drivers for parity.

Option 1 is preferred as it also addresses the broader duplication issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions