1PAPI_set_domain(3) PAPI PAPI_set_domain(3)
2
3
4
6 PAPI_set_domain - set the default counting domain for new event sets
7 bound to the cpu component
8 PAPI_set_cmp_domain - set the default counting domain for new event
9 sets bound to the specified component
10
11
13 C Interface
14 #include <papi.h>
15 int PAPI_set_domain(int domain);
16 int PAPI_set_cmp_domain(int domain, int cidx);
17 Fortran Interface
18 #include fpapi.h
19 PAPIF_set_domain(C_INT domain, C_INT check)
20 PAPIF_set_event_domain(C_INT EventSet, C_INT domain, C_INT check)
21
22
24 PAPI_set_domain sets the default counting domain for all new event sets
25 created by PAPI_create_eventset(3) in all threads. This call implicitly
26 sets the domain for the cpu component (component 0) and is included to
27 preserve backward compatibility.
28
29 PAPI_set_cmp_domain sets the default counting domain for all new event
30 sets in all threads, and requires an explicit component argument.
31 Event sets that are already in existence are not affected. To change
32 the domain of an existing event set, please see the PAPI_set_opt(3) man
33 page.The reader should note that the domain of an event set affects
34 only the mode in which the counter continues to run. Counts are still
35 aggregated for the current process, and not for any other processes in
36 the system. Thus when requesting PAPI_DOM_KERNEL, the user is asking
37 for events that occur on behalf of the process, inside the kernel.
38
39
41 cidx -- An integer identifier for a component. By convention, component
42 0 is always the cpu component.
43
44 domain -- one of the following constants as defined in the papi.h
45 header file:
46
47
48 ┌────────────────────┬───────────────────────────────────────┐
49 │PAPI_DOM_USER │ User context counted │
50 ├────────────────────┼───────────────────────────────────────┤
51 │PAPI_DOM_KERNEL │ Kernel/OS context counted │
52 ├────────────────────┼───────────────────────────────────────┤
53 │PAPI_DOM_OTHER │ Exception/transient mode counted │
54 ├────────────────────┼───────────────────────────────────────┤
55 │PAPI_DOM_SUPERVISOR │ Supervisor/hypervisor context counted │
56 ├────────────────────┼───────────────────────────────────────┤
57 │PAPI_DOM_ALL │ All above contexts counted │
58 ├────────────────────┼───────────────────────────────────────┤
59 │PAPI_DOM_MIN │ The smallest available context │
60 ├────────────────────┼───────────────────────────────────────┤
61 │PAPI_DOM_MAX │ The largest available context │
62 └────────────────────┴───────────────────────────────────────┘
63
65 On success, this function returns PAPI_OK.
66 On error, a non-zero error code is returned.
67
68
70 PAPI_EINVAL
71 One or more of the arguments is invalid.
72
73 PAPI_ENOEVST
74 The event set specified does not exist.
75
76 PAPI_ENOCMP
77 The argument cidx is not a valid component.
78
79 PAPI_EISRUN
80 The event set is currently counting events.
81
82
84 int retval;
85
86 /* Initialize the library */
87
88 retval = PAPI_library_init(PAPI_VER_CURRENT);
89
90 if (retval > 0 && retval != PAPI_VER_CURRENT) {
91 fprintf(stderr,"PAPI library version mismatch!0);
92 exit(1); }
93
94 if (retval < 0)
95 handle_error(retval);
96
97 /* Set the default domain for the cpu component */
98
99 if ((retval = PAPI_set_cmp_domain(PAPI_DOM_KERNEL,0)) != PAPI_OK)
100 handle_error(retval);
101
102 if ((retval = PAPI_create_eventset(&EventSet)) != PAPI_OK)
103 handle_error(retval);
104
105
107 This function has no known bugs.
108
109
111 PAPI_set_granularity(3), PAPI_set_opt(3), PAPI_get_opt(3)
112
113
114
115PAPI Programmer's Reference September, 2004 PAPI_set_domain(3)