LCOV - code coverage report
Current view: top level - lib/pmu - pmu_private.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 6 0.0 %
Date: 2025-12-01 19:08:10 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 12 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2025 Marvell
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef PMU_PRIVATE_H
       6                 :            : #define PMU_PRIVATE_H
       7                 :            : 
       8                 :            : #include <rte_log.h>
       9                 :            : 
      10                 :            : extern int rte_pmu_logtype;
      11                 :            : #define RTE_LOGTYPE_PMU rte_pmu_logtype
      12                 :            : 
      13                 :            : #define PMU_LOG(level, ...) \
      14                 :            :         RTE_LOG_LINE(level, PMU, ## __VA_ARGS__)
      15                 :            : 
      16                 :            : /**
      17                 :            :  * Structure describing architecture specific PMU operations.
      18                 :            :  */
      19                 :            : struct pmu_arch_ops {
      20                 :            :         int (*init)(void);
      21                 :            :         void (*fini)(void);
      22                 :            :         void (*fixup_config)(uint64_t config[3]);
      23                 :            : };
      24                 :            : 
      25                 :            : extern const struct pmu_arch_ops *arch_ops;
      26                 :            : 
      27                 :            : #define PMU_SET_ARCH_OPS(ops) \
      28                 :            :         RTE_INIT(rte_pmu_set_arch_ops) \
      29                 :            :         { \
      30                 :            :                 arch_ops = &(ops); \
      31                 :            :         }
      32                 :            : 
      33                 :            : /**
      34                 :            :  * Architecture-specific PMU init callback.
      35                 :            :  *
      36                 :            :  * @return
      37                 :            :  *   0 in case of success, negative value otherwise.
      38                 :            :  */
      39                 :            : static inline int
      40                 :            : pmu_arch_init(void)
      41                 :            : {
      42   [ #  #  #  # ]:          0 :         if (arch_ops != NULL && arch_ops->init != NULL)
      43                 :          0 :                 return arch_ops->init();
      44                 :            : 
      45                 :            :         return 0;
      46                 :            : }
      47                 :            : 
      48                 :            : /**
      49                 :            :  * Architecture-specific PMU cleanup callback.
      50                 :            :  */
      51                 :            : static inline void
      52                 :            : pmu_arch_fini(void)
      53                 :            : {
      54   [ #  #  #  # ]:          0 :         if (arch_ops != NULL && arch_ops->fini != NULL)
      55                 :          0 :                 arch_ops->fini();
      56                 :            : }
      57                 :            : 
      58                 :            : /**
      59                 :            :  * Apply architecture-specific settings to config before passing it to syscall.
      60                 :            :  *
      61                 :            :  * @param config
      62                 :            :  *   Architecture-specific event configuration.
      63                 :            :  *   Consult kernel sources for available options.
      64                 :            :  */
      65                 :            : static inline void
      66                 :            : pmu_arch_fixup_config(uint64_t config[3])
      67                 :            : {
      68   [ #  #  #  # ]:          0 :         if (arch_ops != NULL && arch_ops->fixup_config != NULL)
      69                 :          0 :                 arch_ops->fixup_config(config);
      70                 :            : }
      71                 :            : 
      72                 :            : #endif /* PMU_PRIVATE_H */

Generated by: LCOV version 1.14