netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Keller, Jacob E" <jacob.e.keller@intel.com>
To: David Ahern <dsahern@gmail.com>,
	"netdev@vger.kernel.org" <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: Mon, 12 Oct 2020 17:30:13 +0000	[thread overview]
Message-ID: <e039e78a96c7442aa542f4bac60eb186@intel.com> (raw)
In-Reply-To: <5ebd3324-1acc-8d9b-2f45-7c4878ad7acc@gmail.com>



> -----Original Message-----
> From: David Ahern <dsahern@gmail.com>
> Sent: Tuesday, October 06, 2020 10:56 PM
> To: Keller, Jacob E <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
> 
> 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.
> 

Ah. Good point. This should use CLOCK_MONOTONIC instead, right?

> > +
> >  		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);
> > +

  reply	other threads:[~2020-10-12 17:30 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
2020-10-12 17:30   ` Keller, Jacob E [this message]
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=e039e78a96c7442aa542f4bac60eb186@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=dsahern@gmail.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).