From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <sdf.kernel@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com
Subject: Re: [RFC net-next v2 1/5] selftests: net: py: add timestamped metric output
Date: Fri, 16 Oct 2026 09:52:01 -0700 [thread overview]
Message-ID: <20261016095201.0f5686f6@kernel.org> (raw)
In-Reply-To: <20261005201115.2690830-2-sdf@fomichev.me>
On Mon, 5 Oct 2026 13:11:10 -0700 Stanislav Fomichev wrote:
> +ksft_metric()
> +~~~~~~~~~~~~~
> +
> +Use ``ksft_metric()`` to report a numeric measurement for the current test
> +case. The helper records the time relative to the start of the case and emits
> +each observation immediately before the test result as compact JSON. For
> +example::
> +
> + ksft_metric("throughput", 100.5, kind="scalar")
> +
> +emits output similar to::
> +
> + # ktap-metric-json: {"name":"throughput","time":1.234,"type":"scalar","value":100.5}
Should time be optional? In case some test wants to report single metric
not value over time? Maybe just mention that it's an option if someone
needs it in the future?
> +When ``run_kselftest.sh`` nests the test output, its diagnostic prefix makes
> +this ``# # ktap-metric-json: <json>``.
This sentence needs to go, it's out of place and obvious to anyone who
worked with ksft.
> A background sampler can call
> +``ksft_metric()`` repeatedly. Pass ``kind`` explicitly; it is emitted as the
> +``type`` field. Supported kinds are ``scalar`` for one numeric value and
> +``per-cpu`` for an array indexed by CPU number, with ``None`` for a missing or
> +offline CPU::
> +
> + ksft_metric("cpu.utilization", [75.0, 22.0, None, 100.0],
> + kind="per-cpu", host="local")
Should we say something about what the values for "kind" are?
Or should this be internal - IOW create ksft_metric_X for supported
types, like ksft_metric_scalar, which would be more self-documenting?
> +The helper does not infer the kind from the Python value, since an array may
> +represent something other than per-CPU data. Metrics are measurements only and
> +do not affect the pass or fail result.
next prev parent reply other threads:[~2026-10-16 16:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 20:11 [RFC net-next v2 0/5] selftests: net: add performance metric reporting Stanislav Fomichev
2026-10-05 20:11 ` [RFC net-next v2 1/5] selftests: net: py: add timestamped metric output Stanislav Fomichev
2026-10-16 16:52 ` Jakub Kicinski [this message]
2026-10-05 20:11 ` [RFC net-next v2 2/5] selftests: net: py: add metric policy output Stanislav Fomichev
2026-10-16 16:59 ` Jakub Kicinski
2026-10-05 20:11 ` [RFC net-next v2 3/5] selftests: drv-net: add an iperf performance test Stanislav Fomichev
2026-10-16 17:03 ` Jakub Kicinski
2026-10-05 20:11 ` [RFC net-next v2 4/5] selftests: drv-net: add a kperf runner Stanislav Fomichev
2026-10-16 17:05 ` Jakub Kicinski
2026-10-05 20:11 ` [RFC net-next v2 5/5] selftests: drv-net: measure devmem performance with kperf Stanislav Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261016095201.0f5686f6@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.