HPCToolkit
perf_event_open.c
Go to the documentation of this file.
1
// -*-Mode: C++;-*- // technically C99
2
3
// * BeginRiceCopyright *****************************************************
4
//
5
// --------------------------------------------------------------------------
6
// Part of HPCToolkit (hpctoolkit.org)
7
//
8
// Information about sources of support for research and development of
9
// HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
10
// --------------------------------------------------------------------------
11
//
12
// Copyright ((c)) 2002-2019, Rice University
13
// All rights reserved.
14
//
15
// Redistribution and use in source and binary forms, with or without
16
// modification, are permitted provided that the following conditions are
17
// met:
18
//
19
// * Redistributions of source code must retain the above copyright
20
// notice, this list of conditions and the following disclaimer.
21
//
22
// * Redistributions in binary form must reproduce the above copyright
23
// notice, this list of conditions and the following disclaimer in the
24
// documentation and/or other materials provided with the distribution.
25
//
26
// * Neither the name of Rice University (RICE) nor the names of its
27
// contributors may be used to endorse or promote products derived from
28
// this software without specific prior written permission.
29
//
30
// This software is provided by RICE and contributors "as is" and any
31
// express or implied warranties, including, but not limited to, the
32
// implied warranties of merchantability and fitness for a particular
33
// purpose are disclaimed. In no event shall RICE or contributors be
34
// liable for any direct, indirect, incidental, special, exemplary, or
35
// consequential damages (including, but not limited to, procurement of
36
// substitute goods or services; loss of use, data, or profits; or
37
// business interruption) however caused and on any theory of liability,
38
// whether in contract, strict liability, or tort (including negligence
39
// or otherwise) arising in any way out of the use of this software, even
40
// if advised of the possibility of such damage.
41
//
42
// ******************************************************* EndRiceCopyright *
43
44
#include <unistd.h>
// pid_t
45
#include <asm/unistd.h>
// __NR_perf_event_open
46
#include <linux/perf_event.h>
// perf data structure
47
48
//----------------------------------------------------------
49
// create a new event
50
//----------------------------------------------------------
51
52
long
53
perf_event_open
(
struct
perf_event_attr *hw_event, pid_t
pid
,
54
int
cpu
,
int
group_fd,
unsigned
long
flags)
55
{
56
int
ret;
57
58
ret = syscall(__NR_perf_event_open, hw_event, pid, cpu, group_fd, flags);
59
return
ret;
60
}
61
pid
static __thread u32 pid
Definition:
kernel_blocking.c:97
perf_event_open
long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags)
Definition:
perf_event_open.c:53
cpu
static __thread u32 cpu
Definition:
kernel_blocking.c:96
src
tool
hpcrun
sample-sources
perf
perf_event_open.c
Generated by
1.8.13