From: David Ahern <dsahern@gmail.com>
To: Jacob Keller <jacob.e.keller@intel.com>,
netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Shannon Nelson <snelson@pensando.io>
Subject: Re: [iproute2-next v2 1/1] devlink: display elapsed time during flash update
Date: Tue, 6 Oct 2020 22:56:15 -0700 [thread overview]
Message-ID: <5ebd3324-1acc-8d9b-2f45-7c4878ad7acc@gmail.com> (raw)
In-Reply-To: <20200930234012.137020-1-jacob.e.keller@intel.com>
On 9/30/20 4:40 PM, Jacob Keller wrote:
> @@ -3124,12 +3140,19 @@ static int cmd_dev_flash_status_cb(const struct nlmsghdr *nlh, void *data)
> done = mnl_attr_get_u64(tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE]);
> if (tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL])
> total = mnl_attr_get_u64(tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL]);
> + if (tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT])
> + ctx->status_msg_timeout = mnl_attr_get_u64(tb[DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT]);
> + else
> + ctx->status_msg_timeout = 0;
>
> if (!nullstrcmp(msg, ctx->last_msg) &&
> !nullstrcmp(component, ctx->last_component) &&
> ctx->last_pc && ctx->not_first) {
> pr_out_tty("\b\b\b\b\b"); /* clean percentage */
> } else {
> + /* only update the last status timestamp if the message changed */
> + gettimeofday(&ctx->time_of_last_status, NULL);
gettimeofday/REALCLOCK should not be used for measuring time differences.
> +
> if (ctx->not_first)
> pr_out("\n");
> if (component) {
> @@ -3155,11 +3178,72 @@ static int cmd_dev_flash_status_cb(const struct nlmsghdr *nlh, void *data)
> return MNL_CB_STOP;
> }
>
> +static void cmd_dev_flash_time_elapsed(struct cmd_dev_flash_status_ctx *ctx)
> +{
> + struct timeval now, res;
> +
> + gettimeofday(&now, NULL);
> + timersub(&now, &ctx->time_of_last_status, &res);
> +
next prev parent reply other threads:[~2020-10-07 5:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 23:40 [iproute2-next v2 1/1] devlink: display elapsed time during flash update Jacob Keller
2020-10-01 2:18 ` Shannon Nelson
2020-10-01 7:17 ` Jiri Pirko
2020-10-07 5:56 ` David Ahern [this message]
2020-10-12 17:30 ` Keller, Jacob E
2020-10-13 18:24 ` David Ahern
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=5ebd3324-1acc-8d9b-2f45-7c4878ad7acc@gmail.com \
--to=dsahern@gmail.com \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=snelson@pensando.io \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).