LCOV - code coverage report
Current view: top level - lib/stack - rte_stack_pile.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 18 18 100.0 %
Date: 2026-11-01 19:11:22 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 4 100.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2026 SmartShare Systems
       3                 :            :  */
       4                 :            : 
       5                 :            : #include "rte_stack.h"
       6                 :            : 
       7                 :            : void
       8                 :          3 : rte_stack_pile_init(struct rte_stack *s, unsigned int count)
       9                 :            : {
      10                 :          3 :         unsigned int bulk = (count + RTE_STACK_PILE_BULK_SIZE - 1) / RTE_STACK_PILE_BULK_SIZE;
      11                 :          3 :         struct rte_stack_pile_bulk_elem *bulk_elems =
      12                 :            :                         (struct rte_stack_pile_bulk_elem *)(s->stack_pile.elems);
      13                 :          3 :         struct rte_stack_lf_elem *solo_elems = (struct rte_stack_lf_elem *)&bulk_elems[bulk];
      14                 :            :         unsigned int i;
      15                 :            : 
      16         [ +  + ]:       4131 :         for (i = 0; i < bulk; i++)
      17                 :       4128 :                 __rte_stack_pile_bulk_push_elems(&s->stack_pile.free_bulk,
      18                 :       4128 :                                           &bulk_elems[i], &bulk_elems[i], 1);
      19         [ +  + ]:     132099 :         for (i = 0; i < count; i++)
      20                 :     132096 :                 __rte_stack_lf_push_elems(&s->stack_pile.free_solo,
      21                 :     132096 :                                           &solo_elems[i], &solo_elems[i], 1);
      22                 :          3 : }
      23                 :            : 
      24                 :            : ssize_t
      25                 :          5 : rte_stack_pile_get_memsize(unsigned int count)
      26                 :            : {
      27                 :          5 :         unsigned int bulk = (count + RTE_STACK_PILE_BULK_SIZE - 1) / RTE_STACK_PILE_BULK_SIZE;
      28                 :            :         ssize_t sz = offsetof(struct rte_stack, stack_pile.elems);
      29                 :          5 :         sz += bulk * sizeof(struct rte_stack_pile_bulk_elem);
      30                 :          5 :         sz += count * sizeof(struct rte_stack_lf_elem);
      31                 :          5 :         sz = RTE_CACHE_LINE_ROUNDUP(sz);
      32                 :          5 :         sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;
      33                 :            : 
      34                 :          5 :         return sz;
      35                 :            : }

Generated by: LCOV version 1.14