FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
pmc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef included_clib_pmc_h
17 #define included_clib_pmc_h
18 
19 #if defined (__x86_64__)
20 
22 clib_rdpmc (int counter_id)
23 {
24  u32 a, d;
25 
26  asm volatile ("rdpmc":"=a" (a), "=d" (d):"c" (counter_id));
27  return (u64) a + ((u64) d << (u64) 32);
28 }
29 
30 #else
32 clib_rdpmc (int counter_id)
33 {
34  return 0ULL;
35 }
36 #endif /* __aarch64__ */
37 
38 #endif /* included_clib_pmc_h */
39 
40 /*
41  * fd.io coding-style-patch-verification: ON
42  *
43  * Local Variables:
44  * eval: (c-set-style "gnu")
45  * End:
46  */
a
Definition: bitmap.h:538
unsigned long u64
Definition: types.h:89
#define always_inline
Definition: clib.h:98
unsigned int u32
Definition: types.h:88
static u64 clib_rdpmc(int counter_id)
Definition: pmc.h:22