From nobody Mon Feb 9 23:01:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) client-ip=209.85.128.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1603218021; cv=none; d=zohomail.com; s=zohoarc; b=IMcLrkKghGtoVmh3jlaJrJhvnNcrCjL/4rvMoQdEbECRktra9iJA7OyEN4xe3GtkvQijFwkVyOszVzi0xmzD5bzlK2sKcMFfSJJuJfGIn/qkbL3tsKs5nFZIZFSj2xGEdmm8KMkAscvlWW0AdOyKyupTvy7RXkPr5/VHeGUx5nA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603218021; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BzyypNaASWej9ZmqdqMi6vPl5wcM+vKdt8ggZ4Ao8SM=; b=YSwkobbXsYEp5VOA/sRdTRKNnI8IZ0TyGVaM2cx+jh+2Vnkuwes7s6ot9W/D841zXNqjrgq7CbpKXFcDFp0ul6UpO5OVWVLLkyPaPD55B9LwbLYHTcr0xBI6ywvISxyo7Gx9YJ1/+X0etN23B62cDxQAfyf+Qe2eLNhApPNxulc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.zohomail.com with SMTPS id 1603218021460174.11582944044767; Tue, 20 Oct 2020 11:20:21 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id z22so1686468wmi.0 for ; Tue, 20 Oct 2020 11:20:21 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id r1sm4334870wro.18.2020.10.20.11.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 11:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BzyypNaASWej9ZmqdqMi6vPl5wcM+vKdt8ggZ4Ao8SM=; b=RhJLTZejm2gWA9eGOUcqIM2r/w8aepvah0h9G0w3fJNQYUvFupuSiHZJ4tu8sByrGI CqegSXD5jZ3tjSzXLRnIuc+rIKpldSw1FhweAWbVggoYaUmWpJeSFhEjRfgrBqquZozI Ev1QQe5awJJTEkWIZ3GV0jksGmolBwJnZul17cownl+HDM+K0hKTxWCbdzYwqPnn3d4a 7t5oZeRQwEoOLyyVnGUbH7H9KWzKLeF9cKzSbdAPzhLewYSRuybsSnKOfcIv6P8xCYcC rYta/IvP/nIs+9OB5iBPtmFCUd7dJ5j+mf7JhhO9unvVc3pGDDcNKY+aw4Z5qNAFTgk9 8tmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BzyypNaASWej9ZmqdqMi6vPl5wcM+vKdt8ggZ4Ao8SM=; b=ka6HHI0sFdTsaIpuKTbIBi/Uq3d3Qx0M4y4DC2rCyq8l2ffWaoJjVxHyJkJK9sljUM VllOjK16MLb07VISkqBaTHr9O3bprpxHwNlD7fopLd9j+RQ6bhbMb62S2EphjIYI/7B1 7vUzDgRaCVbNDAKhnYd05Gd0/VTbRJ6bhLVkzuRvcDTh5ThxKoBSY6Ydo4lxEFBjeaxV 2FN/xd3mLw3uUpsI+IsEh2VArWokiUrf+xBJf1zkY6XtbAArFyP3+3qE5r3bLdWlfQIs gedMIdkW92MSx2I0YoYkntrkJmrLdMCu7I8pty1eU0S4U4rv94C13rmhcLPS0gQnYTXi TkbA== X-Gm-Message-State: AOAM531Lm2vPWJG9o0nWB7tbdejNcl9qsT8cO9mJbhkgxDLbmpIQo/yp RaqSFzEhZJ3JqaEwLC0mttA= X-Google-Smtp-Source: ABdhPJyXxKnhC3yc7AHjoNry4FEVDcg/tefmGklGRGk32fXmUDSPwAGNKv4APV2vDLL6mfUaQ4GhmA== X-Received: by 2002:a7b:c350:: with SMTP id l16mr4392111wmj.135.1603218020008; Tue, 20 Oct 2020 11:20:20 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Peter Maydell , Luc Michel , Damien Hedde , Eduardo Habkost , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Luc Michel , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/4] hw/core/clock: trace clock values in Hz instead of ns Date: Tue, 20 Oct 2020 20:20:06 +0200 Message-Id: <20201020182008.2240590-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201020182008.2240590-1-f4bug@amsat.org> References: <20201020182008.2240590-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) From: Luc Michel The nanosecond unit greatly limits the dynamic range we can display in clock value traces, for values in the order of 1GHz and more. The internal representation can go way beyond this value and it is quite common for today's clocks to be within those ranges. For example, a frequency between 500MHz+ and 1GHz will be displayed as 1ns. Beyond 1GHz, it will show up as 0ns. Replace nanosecond periods traces with frequencies in the Hz unit to have more dynamic range in the trace output. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Damien Hedde Signed-off-by: Luc Michel Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20201010135759.437903-3-luc@lmichel.fr> [PMD: Replace CLOCK_PERIOD_TO_HZ() by clock_get_hz()] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/clock.c | 8 +++++--- hw/core/trace-events | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/core/clock.c b/hw/core/clock.c index f866717a835..5cc9599ba3a 100644 --- a/hw/core/clock.c +++ b/hw/core/clock.c @@ -51,12 +51,14 @@ void clock_clear_callback(Clock *clk) =20 bool clock_set(Clock *clk, uint64_t period) { + uint64_t old_hz; + if (clk->period =3D=3D period) { return false; } - trace_clock_set(CLOCK_PATH(clk), CLOCK_PERIOD_TO_NS(clk->period), - CLOCK_PERIOD_TO_NS(period)); + old_hz =3D clock_get_hz(clk); clk->period =3D period; + trace_clock_set(CLOCK_PATH(clk), old_hz, clock_get_hz(clk)); =20 return true; } @@ -69,7 +71,7 @@ static void clock_propagate_period(Clock *clk, bool call_= callbacks) if (child->period !=3D clk->period) { child->period =3D clk->period; trace_clock_update(CLOCK_PATH(child), CLOCK_PATH(clk), - CLOCK_PERIOD_TO_NS(clk->period), + clock_get_hz(clk), call_callbacks); if (call_callbacks && child->callback) { child->callback(child->callback_opaque); diff --git a/hw/core/trace-events b/hw/core/trace-events index 1ac60ede6b7..7b2869cbaab 100644 --- a/hw/core/trace-events +++ b/hw/core/trace-events @@ -31,6 +31,6 @@ resettable_transitional_function(void *obj, const char *o= bjtype) "obj=3D%p(%s)" # clock.c clock_set_source(const char *clk, const char *src) "'%s', src=3D'%s'" clock_disconnect(const char *clk) "'%s'" -clock_set(const char *clk, uint64_t old, uint64_t new) "'%s', ns=3D%"PRIu6= 4"->%"PRIu64 +clock_set(const char *clk, uint64_t old, uint64_t new) "'%s', %"PRIu64" Hz= -> %"PRIu64" Hz" clock_propagate(const char *clk) "'%s'" -clock_update(const char *clk, const char *src, uint64_t val, int cb) "'%s'= , src=3D'%s', ns=3D%"PRIu64", cb=3D%d" +clock_update(const char *clk, const char *src, uint64_t hz, int cb) "'%s',= src=3D'%s', val=3D%"PRIu64" Hz cb=3D%d" --=20 2.26.2