aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-14 02:43:58 +0200
committerRichard Henderson <richard.henderson@linaro.org>2022-06-21 09:24:34 -0700
commit3f42906c9ab2c777a895b48b87b8107167e4a275 (patch)
treecec32653c9fb4186f83926f26fac3489fc815aca /util
parent18b8c47f8e66c1c45a0fb59cfd6ed4dfeb25c6f6 (diff)
downloadqemu-3f42906c9ab2c777a895b48b87b8107167e4a275.zip
qemu-3f42906c9ab2c777a895b48b87b8107167e4a275.tar.gz
qemu-3f42906c9ab2c777a895b48b87b8107167e4a275.tar.bz2
qemu-timer: Skip empty timer lists before locking in qemu_clock_deadline_ns_all
This decreases qemu_clock_deadline_ns_all's share from 23.2% to 13% in a profile of icount-enabled aarch64-softmmu. Signed-off-by: Idan Horowitz <idan.horowitz@gmail.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220114004358.299534-2-idan.horowitz@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-timer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index a670a57..6a0de33 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -261,6 +261,9 @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
}
QLIST_FOREACH(timer_list, &clock->timerlists, list) {
+ if (!qatomic_read(&timer_list->active_timers)) {
+ continue;
+ }
qemu_mutex_lock(&timer_list->active_timers_lock);
ts = timer_list->active_timers;
/* Skip all external timers */