Locked How to check stack size of process node


chetan bhasin
 

Hi vpp-team,


Could you please provide a way via which a process node stack size can be calculated. We are creating a process node, how to figure out the value of process_log2_n_stack_bytes??

Thanks,


chetan bhasin
 

Hi,

Please share any thoughts on this.

Thanks,


On Sat, Mar 18, 2023, 13:18 chetan bhasin via lists.fd.io <chetan.bhasin017=gmail.com@...> wrote:
Hi vpp-team,


Could you please provide a way via which a process node stack size can be calculated. We are creating a process node, how to figure out the value of process_log2_n_stack_bytes??

Thanks,





Dave Barach
 

Find the current process index: vlib_node_main_t *nm = &vm->node_main; current_process_index = nm->current_process_index;

 

Find the process object:   vlib_process_t *p = vec_elt (nm->processes, current_process_index);

 

Find the stack base: p->stack

 

Take the address of a local variable in a function at what you think is the maximum stack depth, and subtract. That’s the instantaneous stack depth.

 

You can sprinkle “stack_depth_now = p->stack - &foo; if (stack_depth_now > max_stack_depth) max = now” cookies in various places.

 

HTH...

 

From: vpp-dev@... <vpp-dev@...> On Behalf Of chetan bhasin
Sent: Friday, March 24, 2023 9:24 AM
To: vpp-dev <vpp-dev@...>
Subject: Re: [vpp-dev] How to check stack size of process node

 

Hi,

 

Please share any thoughts on this.

 

Thanks,

 

On Sat, Mar 18, 2023, 13:18 chetan bhasin via lists.fd.io <chetan.bhasin017=gmail.com@...> wrote:

Hi vpp-team,

 

 

Could you please provide a way via which a process node stack size can be calculated. We are creating a process node, how to figure out the value of process_log2_n_stack_bytes??

 

Thanks,

 




chetan bhasin
 

Thanks a lot Dave!


On Sat, Mar 25, 2023, 19:45 Dave Barach <vpp@...> wrote:

Find the current process index: vlib_node_main_t *nm = &vm->node_main; current_process_index = nm->current_process_index;

 

Find the process object:   vlib_process_t *p = vec_elt (nm->processes, current_process_index);

 

Find the stack base: p->stack

 

Take the address of a local variable in a function at what you think is the maximum stack depth, and subtract. That’s the instantaneous stack depth.

 

You can sprinkle “stack_depth_now = p->stack - &foo; if (stack_depth_now > max_stack_depth) max = now” cookies in various places.

 

HTH...

 

From: vpp-dev@... <vpp-dev@...> On Behalf Of chetan bhasin
Sent: Friday, March 24, 2023 9:24 AM
To: vpp-dev <vpp-dev@...>
Subject: Re: [vpp-dev] How to check stack size of process node

 

Hi,

 

Please share any thoughts on this.

 

Thanks,

 

On Sat, Mar 18, 2023, 13:18 chetan bhasin via lists.fd.io <chetan.bhasin017=gmail.com@...> wrote:

Hi vpp-team,

 

 

Could you please provide a way via which a process node stack size can be calculated. We are creating a process node, how to figure out the value of process_log2_n_stack_bytes??

 

Thanks,