LCOV - code coverage report
Current view: top level - lib/eal/common - eal_common_cpuflags.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 5 9 55.6 %
Date: 2025-05-01 17:49:45 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 6 66.7 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2010-2014 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <stdio.h>
       6                 :            : 
       7                 :            : #include <eal_export.h>
       8                 :            : #include <rte_common.h>
       9                 :            : #include <rte_cpuflags.h>
      10                 :            : 
      11                 :            : RTE_EXPORT_SYMBOL(rte_cpu_is_supported)
      12                 :            : int
      13                 :        251 : rte_cpu_is_supported(void)
      14                 :            : {
      15                 :            :         /* This is generated at compile-time by the build system */
      16                 :            :         static const enum rte_cpu_flag_t compile_time_flags[] = {
      17                 :            :                         RTE_COMPILE_TIME_CPUFLAGS
      18                 :            :         };
      19                 :            :         unsigned count = RTE_DIM(compile_time_flags), i;
      20                 :            :         int ret;
      21                 :            : 
      22         [ +  + ]:       4518 :         for (i = 0; i < count; i++) {
      23                 :       4267 :                 ret = rte_cpu_get_flag_enabled(compile_time_flags[i]);
      24                 :            : 
      25         [ -  + ]:       4267 :                 if (ret < 0) {
      26                 :          0 :                         fprintf(stderr,
      27                 :            :                                 "ERROR: CPU feature flag lookup failed with error %d\n",
      28                 :            :                                 ret);
      29                 :          0 :                         return 0;
      30                 :            :                 }
      31         [ -  + ]:       4267 :                 if (!ret) {
      32                 :          0 :                         fprintf(stderr,
      33                 :            :                                 "ERROR: This system does not support \"%s\".\n"
      34                 :            :                                 "Please check that RTE_MACHINE is set correctly.\n",
      35                 :            :                                 rte_cpu_get_flag_name(compile_time_flags[i]));
      36                 :          0 :                         return 0;
      37                 :            :                 }
      38                 :            :         }
      39                 :            : 
      40                 :            :         return 1;
      41                 :            : }

Generated by: LCOV version 1.14