Profiling app_server

I have a nice modern HP laptop, and I would like to use Haiku on it. Unfortunately, Haiku turns my laptop into a battery draining heater.

Haiku has a power saving mode that helps a little bit, though makes both touchpad and keyboard unusable (they simply stop working). But even in power saving mode power usage is rather high.

I looked at processes and found out, that app_server offscreen team uses a lot of CPU on rendering related tasks. For example, when I open ActivityMonitor, app_server uses about 30% of a core to draw the line plot. Moving windows around also causes CPU usage spikes.

My natural desire is to profile app_server and investigate that makes it so power hungry.

On Linux, there is a tool called Perf which can be attached to a process to collect detailed statistics about program execution. It is very useful for investigating various kinds of performance issues

On Haiku, the only tool I could find is profile. Unfortunately, it does not support attaching to a process, and results of system-wide profiling seem to be to coarse to be useful.

What’s the status for profiling tools in Haiku? I looked into kernel source code to find any mentions of hardware performance counters, but there seem to be no relevant mentions.

2 Likes

Look: [GSOC 2024] Interest in kernel power management

1 Like

I don’t think there is much more than the “profile” tool. That may also explain why these things have been not so well researched.

Just in case, are you using the 32bit version of Haiku? In this case, it is a known problem that gcc2 does not do a great job of optimizing the AGG library code used in app_server for most drawing operations. In the 64bit versio nwhere it’s compiled with a modern gcc, things are a bit better.

The fact that the “power saving” mode stops your mouse and keyboard from working hints at something being wrong in the deeper levels of the system, however. This setting should just change the process scheduler configuration to make it try to keep CPU cores asleep as much as possible, where in the default mode it tries to run all tasks as fast as possible even if that involves waking up a CPU core for it.

So, in your case, there’s probably something not working well with interrupts routing or some other thing like that in the kernel.

Would you want to try underclocking?

Just in case, are you using the 32bit version of Haiku?

No, I’m using x64 nightly Haiku.

This setting should just change the process scheduler configuration to make it try to keep CPU cores asleep as much as possible, where in the default mode it tries to run all tasks as fast as possible even if that involves waking up a CPU core for it.

I suspect input devices also go asleep, but never wake up.

Would underclocking shut the fan up? Personally, I’m getting sick of the fan. It’s better than it was a few years ago but it’s still putting me off using Haiku. Is underclocking easy to do?