PAPI 7.1.0.0
Loading...
Searching...
No Matches
pfmlib_os_linux.c
Go to the documentation of this file.
1/*
2 * pfmlib_os.c: set of functions OS dependent functions
3 *
4 * Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P.
5 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11 * of the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24#ifndef _GNU_SOURCE
25#define _GNU_SOURCE /* for getline */
26#endif
27#include <sys/types.h>
28#include <stdint.h>
29#include <stdio.h>
30#include <stdarg.h>
31#include <string.h>
32#include <stdlib.h>
33#include <unistd.h>
34#include <errno.h>
35#include <sys/utsname.h>
36#include <perfmon/perfmon.h>
37
38#include <perfmon/pfmlib.h>
39#include "pfmlib_priv.h"
40
41int _pfmlib_sys_base; /* syscall base */
42int _pfmlib_major_version; /* kernel perfmon major version */
43int _pfmlib_minor_version; /* kernel perfmon minor version */
44
45/*
46 * helper function to retrieve one value from /proc/cpuinfo
47 * for internal libpfm use only
48 * attr: the attribute (line) to look for
49 * ret_buf: a buffer to store the value of the attribute (as a string)
50 * maxlen : number of bytes of capacity in ret_buf
51 *
52 * ret_buf is null terminated.
53 *
54 * Return:
55 * 0 : attribute found, ret_buf populated
56 * -1: attribute not found
57 */
58int
59__pfm_getcpuinfo_attr(const char *attr, char *ret_buf, size_t maxlen)
60{
61
62 int ret = 0;
63 return ret;
64}
65
67{
68}
69
70static void
72{
73}
74
75static int
77{
78}
79static int
81{
82}
83
84
85void
87{
88}
uint8_t version
static int pfm_init_version_sysfs(void)
static void adjust__pfmlib_sys_base(int version)
int __pfm_getcpuinfo_attr(const char *attr, char *ret_buf, size_t maxlen)
void pfm_init_syscalls(void)
static void pfm_init_syscalls_hardcoded(void)
int _pfmlib_sys_base
static int pfm_init_syscalls_sysfs(void)
int _pfmlib_major_version
int _pfmlib_minor_version