diff mbox series

runqueue: show the current pressure as debug messages

Message ID 20250701-pressure-messages-v1-1-bebffe123676@bootlin.com
State New
Headers show
Series runqueue: show the current pressure as debug messages | expand

Commit Message

Antonin Godard July 1, 2025, 9:53 a.m. UTC
The current pressure logic only prints pressure information when the
limits set by BB_PRESSURE_* variables are exceeded. But in order to
determine the best pressure limits for a given host, it can be useful to
monitor pressure information after setting BB_PRESSURE_* to the maximum
(1000000) and get a sense of how high the pressure can be.

Add three bb.debug() calls showing that information.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 lib/bb/runqueue.py | 3 +++
 1 file changed, 3 insertions(+)


---
base-commit: f68b513c38fa33c89236efbaab2674a25983d5e1
change-id: 20250701-pressure-messages-b47c882bca4a

Best regards,
--  
Antonin Godard <antonin.godard@bootlin.com>

Comments

Richard Purdie July 1, 2025, 9:23 p.m. UTC | #1
On Tue, 2025-07-01 at 11:53 +0200, Antonin Godard via lists.openembedded.org wrote:
> The current pressure logic only prints pressure information when the
> limits set by BB_PRESSURE_* variables are exceeded. But in order to
> determine the best pressure limits for a given host, it can be useful to
> monitor pressure information after setting BB_PRESSURE_* to the maximum
> (1000000) and get a sense of how high the pressure can be.
> 
> Add three bb.debug() calls showing that information.
> 
> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> ---
>  lib/bb/runqueue.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
> index 80f3d3282f..cae4bfa3e5 100644
> --- a/lib/bb/runqueue.py
> +++ b/lib/bb/runqueue.py
> @@ -206,6 +206,9 @@ class RunQueueScheduler(object):
>                  cpu_pressure = (float(curr_cpu_pressure) - float(self.prev_cpu_pressure)) / tdiff
>                  io_pressure = (float(curr_io_pressure) - float(self.prev_io_pressure)) / tdiff
>                  memory_pressure = (float(curr_memory_pressure) - float(self.prev_memory_pressure)) / tdiff
> +                bb.debug(3, f"Current CPU pressure: {cpu_pressure}")
> +                bb.debug(3, f"Current IO pressure: {io_pressure}")
> +                bb.debug(3, f"Current Memory pressure: {memory_pressure}")
>                  exceeds_cpu_pressure =  self.rq.max_cpu_pressure and cpu_pressure > self.rq.max_cpu_pressure
>                  exceeds_io_pressure =  self.rq.max_io_pressure and io_pressure > self.rq.max_io_pressure
>                  exceeds_memory_pressure =  self.rq.max_memory_pressure and memory_pressure > self.rq.max_memory_pressure
> 

I'm torn on this, debug messages aren't without their overhead even if
not printed. How often do these end up outputted? If nothing else there
should be one bb.debug call and not 3...

Cheers,

Richard
diff mbox series

Patch

diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 80f3d3282f..cae4bfa3e5 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -206,6 +206,9 @@  class RunQueueScheduler(object):
                 cpu_pressure = (float(curr_cpu_pressure) - float(self.prev_cpu_pressure)) / tdiff
                 io_pressure = (float(curr_io_pressure) - float(self.prev_io_pressure)) / tdiff
                 memory_pressure = (float(curr_memory_pressure) - float(self.prev_memory_pressure)) / tdiff
+                bb.debug(3, f"Current CPU pressure: {cpu_pressure}")
+                bb.debug(3, f"Current IO pressure: {io_pressure}")
+                bb.debug(3, f"Current Memory pressure: {memory_pressure}")
                 exceeds_cpu_pressure =  self.rq.max_cpu_pressure and cpu_pressure > self.rq.max_cpu_pressure
                 exceeds_io_pressure =  self.rq.max_io_pressure and io_pressure > self.rq.max_io_pressure
                 exceeds_memory_pressure =  self.rq.max_memory_pressure and memory_pressure > self.rq.max_memory_pressure