-
|
I have a simple shell script that controls brightness of monitor, bound to hotkey to increase/decrease brightness by a set interval. Performance is not great, trying to see if I can get noticeably improved performance. Taking a look at https://www.ddcutil.com/performance_options/, still trying to figure out which makes sense. Noob questions:
Right now I have |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
The only information stored in a monitor are the values of persistent features, e.g. brightness. In general a DDC/CI operation takes one of two forms: (a) send a request packet to the monitor, and after a specified delay read a response packet, or (b) send a request packet and delay a specified time before initiating another operation. The purpose of the delay is to give the monitor sufficient time to process the request and possibly create a response. If ddcutil simply follows the DDC/CI specification, approximately 90% of its estimated time is spent sleeping to allow for the required delays. The processors in monitors have in general gotten much, much faster in the years since the DDC/CI spec was published, and it is usually possible to use significantly shorter delays, reducing the time ddcutil spends sleeping. That's the purpose of the sleep multiplier. The sleep multiplier can be specified explicitly using option --sleep-multiplier. That requires some trial and error to find a value that works best. The newer --enable-dynamic-sleep lets ddcutil find an optimal value by slowly adjusting the sleep-multiplier down and up, based on data from prior requests. It requires data accumulated over many operations. If the cache file doesn't exist, the dynamic sleep adjustments start with a value of 1.0. So erasing the cache with each boot essentially makes makes dynamic sleep useless. I suggest that you --disable-dynamic-sleep and instead experiment to find a --sleep-multiplier value that works best for you. Option --lazy-sleep improves performance by causing ddcutil to sleep not immediately after an operation, but instead prior to the next operation on the monitor, taking into account the time that has elapsed. As practical matter the performance gains turn out to be minor. Without --bus and --skip-ddc-checks each ddcutil invocation essentially performs a full dectect operation. Especially with multiple monitors, more time is spent in the detection phase than actually performing the requested operation. ddcutil is extensively instrumented. Option --stats lets you see the effect of the options you've set. |
Beta Was this translation helpful? Give feedback.
-
|
There are 4 cases: --sleep-multiplier not specified, with --enable-dynamic-sleep: The accumulated statistics are used to calculate a sleep multiplier.; the current execution adds to the stats. --sleep-multiplier specified, with --disable-dynamic-sleep: The specified sleep multiplier is used for the command. The previously accumulated statistics are preserved. New stats are not accumulated. --sleep-multiplier specified with --enable-dynamic-sleep. Existing stats are discarded. Dynamic sleep starts with the specified value, and new stats are accumulated --sleep-multiplier specified with --disable-dynamic-sleep. The specified sleep-multiplier value is used, existing stats are not erased. New stats are not accumulated. Option --discard-dynamic-sleep-cache forces existing stats to be erased at the start of a command. The page you reference does mention that --dsa is a synonym for --enable-dynamic-sleep. That was the initial name for the option. As the number of options has grown, I've generally transitioned to using --enable-XXX and --disable-XXX for symmetry. However, the old name is still valid in case it is still being used. Option --help reports a reduced set of options in an attempt to be less overwhelming. It reports the favored names --enable-dynamic-sleep and --disable-dynamic-sleep. Option --hh on the other hand reports the full set of options recognized by the parser, including deprecated variants such as --dsa. The man page generally only reports the reduced set of options. Finally, when ddcutil starts it looks for monitors and tests whether they support DDC. Those tests are expensive, and there's no point in doing them over and over again if we know the monitor supports DDC. Hence --skip-ddc-checks. Note however that if you set an overly low sleep-multiplier, whether or not you specify --skip-ddc-checks DDC operations will fail. |
Beta Was this translation helpful? Give feedback.
-
|
@rieje just FYI I was pondering with pretty much the same issues as you, so ended up writing a trivial python daemon to take care of brightness control that depends on ddcutil for external displays: https://github.com/laur89/bctl Doesn't depend on desktop environment, in fact it has no GUI component to it; also controls laptop displays. It has a daemon service that caches current brightness values in memory, so bumping brightness up or down is less Quick start: $ pipx install bctl
# start the daemon
$ bctld
# bump up brightness:
$ killall -s SIGUSR1 bctldIf you bind your brightness change keys to the killall commands sending SIGUSR1 & SIGUSR2 signals, it's safe to spam them. Events are consumed within |
Beta Was this translation helpful? Give feedback.
The only information stored in a monitor are the values of persistent features, e.g. brightness.
In general a DDC/CI operation takes one of two forms: (a) send a request packet to the monitor, and after a specified delay read a response packet, or (b) send a request packet and delay a specified time before initiating another operation. The purpose of the delay is to give the monitor sufficient time to process the request and possibly create a response.
If ddcutil simply follows the DDC/CI specification, approximately 90% of its estimated time is spent sleeping to allow for the required delays. The processors in monitors have in general gotten much, much faster in the years since the DDC/C…