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-01-02 22:41:34 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 <rte_common.h>
       8                 :            : #include <rte_cpuflags.h>
       9                 :            : 
      10                 :            : int
      11                 :        250 : rte_cpu_is_supported(void)
      12                 :            : {
      13                 :            :         /* This is generated at compile-time by the build system */
      14                 :            :         static const enum rte_cpu_flag_t compile_time_flags[] = {
      15                 :            :                         RTE_COMPILE_TIME_CPUFLAGS
      16                 :            :         };
      17                 :            :         unsigned count = RTE_DIM(compile_time_flags), i;
      18                 :            :         int ret;
      19                 :            : 
      20         [ +  + ]:       4483 :         for (i = 0; i < count; i++) {
      21                 :       4234 :                 ret = rte_cpu_get_flag_enabled(compile_time_flags[i]);
      22                 :            : 
      23         [ -  + ]:       4233 :                 if (ret < 0) {
      24                 :          0 :                         fprintf(stderr,
      25                 :            :                                 "ERROR: CPU feature flag lookup failed with error %d\n",
      26                 :            :                                 ret);
      27                 :          0 :                         return 0;
      28                 :            :                 }
      29         [ -  + ]:       4233 :                 if (!ret) {
      30                 :          0 :                         fprintf(stderr,
      31                 :            :                                 "ERROR: This system does not support \"%s\".\n"
      32                 :            :                                 "Please check that RTE_MACHINE is set correctly.\n",
      33                 :            :                                 rte_cpu_get_flag_name(compile_time_flags[i]));
      34                 :          0 :                         return 0;
      35                 :            :                 }
      36                 :            :         }
      37                 :            : 
      38                 :            :         return 1;
      39                 :            : }

Generated by: LCOV version 1.14