Damjan Marion | 47d165e | 2019-01-28 13:27:31 +0100 | [diff] [blame] | 1 | /* |
| 2 | *------------------------------------------------------------------ |
| 3 | * Copyright (c) 2019 Cisco and/or its affiliates. |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at: |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | *------------------------------------------------------------------ |
| 16 | */ |
| 17 | |
| 18 | #ifndef _PERFMON_INTEL_H_ |
| 19 | #define _PERFMON_INTEL_H_ |
| 20 | |
| 21 | #include <vppinfra/clib.h> |
| 22 | #include <vppinfra/format.h> |
| 23 | |
| 24 | typedef struct |
| 25 | { |
| 26 | u8 event_code[2]; |
| 27 | u8 umask; |
Tom Seidenberg | 6c81f5a | 2020-07-10 15:49:03 +0000 | [diff] [blame] | 28 | u8 cmask; |
| 29 | u8 inv; |
| 30 | u8 anyt; |
| 31 | u8 edge; |
Damjan Marion | 47d165e | 2019-01-28 13:27:31 +0100 | [diff] [blame] | 32 | char *event_name; |
| 33 | } perfmon_intel_pmc_event_t; |
| 34 | |
| 35 | typedef struct |
| 36 | { |
| 37 | u8 model; |
| 38 | u8 stepping; |
| 39 | u8 has_stepping; |
| 40 | } perfmon_intel_pmc_cpu_model_t; |
| 41 | |
| 42 | typedef struct |
| 43 | { |
| 44 | perfmon_intel_pmc_event_t *events; |
| 45 | perfmon_intel_pmc_cpu_model_t *models; |
| 46 | u32 n_events; |
| 47 | u32 n_models; |
| 48 | } perfmon_intel_pmc_registration_t; |
| 49 | |
| 50 | |
| 51 | void |
| 52 | perfmon_register_intel_pmc (perfmon_intel_pmc_cpu_model_t * m, int n_models, |
| 53 | perfmon_intel_pmc_event_t * e, int n_events); |
| 54 | |
| 55 | #define PERFMON_REGISTER_INTEL_PMC(m, e) \ |
| 56 | static void __clib_constructor \ |
| 57 | perfmon_register_intel_pmc_constructor() \ |
| 58 | { \ |
| 59 | perfmon_register_intel_pmc (m, ARRAY_LEN(m), e, ARRAY_LEN (e)); \ |
| 60 | } |
| 61 | |
| 62 | #endif /* _PERFMON_INTEL_H_ */ |
| 63 | |
| 64 | /* |
| 65 | * fd.io coding-style-patch-verification: ON |
| 66 | * |
| 67 | * Local Variables: |
| 68 | * eval: (c-set-style "gnu") |
| 69 | * End: |
| 70 | */ |