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