View Javadoc
1   /*
2    * Copyright 2020-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.driver.unix.aix.perfstat;
6   
7   import com.sun.jna.platform.unix.aix.Perfstat;
8   import com.sun.jna.platform.unix.aix.Perfstat.perfstat_partition_config_t;
9   
10  import oshi.annotation.concurrent.ThreadSafe;
11  
12  /**
13   * Utility to query partition config
14   */
15  @ThreadSafe
16  public final class PerfstatConfig {
17  
18      private static final Perfstat PERF = Perfstat.INSTANCE;
19  
20      private PerfstatConfig() {
21      }
22  
23      /**
24       * Queries perfstat_partition_config for config
25       *
26       * @return usage statistics
27       */
28      public static perfstat_partition_config_t queryConfig() {
29          perfstat_partition_config_t config = new perfstat_partition_config_t();
30          int ret = PERF.perfstat_partition_config(null, config, config.size(), 1);
31          if (ret > 0) {
32              return config;
33          }
34          return new perfstat_partition_config_t();
35      }
36  }