Mercurial > hg > truffle
annotate src/os/aix/vm/libperfstat_aix.hpp @ 21523:4b3b38415adf
make GraalRuntime::parse_argument public to avoid needing the firend declaration
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Thu, 28 May 2015 18:06:26 +0200 |
parents | 666e6ce3976c |
children |
rev | line source |
---|---|
14415
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
1 /* |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
2 * Copyright 2012, 2013 SAP AG. All rights reserved. |
666e6ce3976c
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. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
4 * |
666e6ce3976c
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 |
666e6ce3976c
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 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
8 * |
666e6ce3976c
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 |
666e6ce3976c
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 |
666e6ce3976c
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 |
666e6ce3976c
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 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
13 * accompanied this code). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
14 * |
666e6ce3976c
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 |
666e6ce3976c
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, |
666e6ce3976c
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. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
18 * |
666e6ce3976c
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 |
666e6ce3976c
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 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
21 * questions. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
22 * |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
23 */ |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
24 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
25 // encapsulates the libperfstat library. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
26 // |
666e6ce3976c
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 |
666e6ce3976c
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 |
666e6ce3976c
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 |
666e6ce3976c
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. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
31 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
32 #ifndef OS_AIX_VM_LIBPERFSTAT_AIX_HPP |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
33 #define OS_AIX_VM_LIBPERFSTAT_AIX_HPP |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
34 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
35 #include <libperfstat.h> |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
36 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
37 class libperfstat { |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
38 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
39 public: |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
40 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
41 // Load the libperfstat library (must be in LIBPATH). |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
42 // Returns true if succeeded, false if error. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
43 static bool init(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
44 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
45 // cleanup of the libo4 porting library. |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
46 static void cleanup(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
47 |
666e6ce3976c
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 |
666e6ce3976c
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. |
666e6ce3976c
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, |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
51 int sizeof_userbuff, int desired_number); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
52 |
666e6ce3976c
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, |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
54 int sizeof_userbuff, int desired_number); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
55 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
56 static void perfstat_reset(); |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
57 }; |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
58 |
666e6ce3976c
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
59 #endif // OS_AIX_VM_LIBPERFSTAT_AIX_HPP |