hotspot/src/os/aix/vm/libperfstat_aix.hpp
author amurillo
Fri, 05 Dec 2014 16:36:07 -0800
changeset 27926 0e2e188ab887
parent 22831 1e2ba1d62103
child 34647 fafb32d71489
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     1
/*
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     2
 * Copyright 2012, 2013 SAP AG. All rights reserved.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     4
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     8
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    13
 * accompanied this code).
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    14
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    18
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    21
 * questions.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    22
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    23
 */
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    24
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    25
// encapsulates the libperfstat library.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    26
//
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    27
// The purpose of this code is to dynamically load the libperfstat library
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    28
// instead of statically linking against it. The libperfstat library is an
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    29
// AIX-specific library which only exists on AIX, not on PASE. If I want to
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    30
// share binaries between AIX and PASE, I cannot directly link against libperfstat.so.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    31
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    32
#ifndef OS_AIX_VM_LIBPERFSTAT_AIX_HPP
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    33
#define OS_AIX_VM_LIBPERFSTAT_AIX_HPP
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    34
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    35
#include <libperfstat.h>
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    36
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    37
class libperfstat {
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    38
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    39
public:
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    40
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    41
  // Load the libperfstat library (must be in LIBPATH).
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    42
  // Returns true if succeeded, false if error.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    43
  static bool init();
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    44
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    45
  // cleanup of the libo4 porting library.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    46
  static void cleanup();
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    47
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    48
  // direct wrappers for the libperfstat functionality. All they do is
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    49
  // to call the functions with the same name via function pointers.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    50
  static int perfstat_cpu_total(perfstat_id_t *name, perfstat_cpu_total_t* userbuff,
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    51
                                int sizeof_userbuff, int desired_number);
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    52
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    53
  static int perfstat_memory_total(perfstat_id_t *name, perfstat_memory_total_t* userbuff,
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    54
                                   int sizeof_userbuff, int desired_number);
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    55
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    56
  static void perfstat_reset();
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    57
};
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    58
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    59
#endif // OS_AIX_VM_LIBPERFSTAT_AIX_HPP