DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: "David Harton (dharton)" <dharton@cisco.com>,
	Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Future Direction for rte_eth_stats_get()
Date: Fri, 22 Jan 2016 16:41:32 +0000	[thread overview]
Message-ID: <E923DB57A917B54B9182A2E928D00FA612861846@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <78791945dbf442b291adb72df8ec09f3@XCH-RCD-016.cisco.com>

+Jay, (@all, please keep everybody in the CCs :)

> From: David Harton (dharton) [mailto:dharton@cisco.com]
> To: Van Haaren, Harry <harry.van.haaren@intel.com>; Thomas Monjalon
> > > xstats are driver agnostic and have a well-defined naming scheme.
> >
> > Indeed, described here:
> > http://dpdk.org/doc/guides/prog_guide/poll_mode_drv.html#extended-
> > statistics-api
> 
> Thanks for sharing.  I do think what is in the link is well thought out but it also may
> not match how the application would choose to represent that stat (capitalization,
> abbreviation, etc).

Welcome. Sure, an application can match any xstats string to its "Display" counterpart,
or a few simple translations actually make (almost) all of them human readable. Translating
an _ to space, capitalize first letter of description items, and remove the unit at the end).
This use-case was considered when detailing the naming scheme.


> > The "rules" of encoding a statistic as an xstats string are pretty simple,
> > and if any PMD breaks the rules, it should be considered broken and fixed.
> 
> I understand it may be broken, but that doesn't help finding them and ensuring they aren't
> broken to begin with.  What regression/automation is in place to ensure drivers aren't
> broken?

Currently nothing automated - patch review on the mailing list. I'm open to ideas on this,
if you have suggestions.


> > Do you see a fundamental problem with parsing the strings to retrieve
> > values?
> 
> I think parsing strings is expensive CPU wise

Parsing the strings can be done once at startup, and the index of the statistics in the
array cached. When actually reading statistics, access of the array of statistics at the
previously cached index will return the same statistic. It is not needed to do strcmp()
per statistic per read.


> That's why I was wondering if a binary id could be generated instead.

I've worked with such a system before, it dynamically registered string->int mappings at
runtime, and allowed "reverse" mapping them too. Its workable, and I'm not opposed to it
if the conclusion is that it really is necessary, but I'm not sure about that.


> The API
> would be very similar to the current xstats API except it would pass id/value pairs
> instead of string/value pairs.  This avoids string comparisons to figure out while still
> allowing flexibility between drivers.

Apart from a once-off scan at startup, xstats achieves this. 


>  It would also 100% guarantee that any strings
> returned by "const char* rte_eth_xstats_str_get(uint32_t stat_id)" are consistent across
> devices.

Yes - that is a nice feature that xstats (in its current form) doesn't have.
But what price is there to pay for this?
We need to map an ID for each stat that exists.

How and where will this mapping happen? Perhaps would you expand a little on how
you see this working? 

> I also think there is less chance for error if drivers assign their stats to ID versus
> constructing a string. 

Have a look in how the mapping is done in the xstats implementation for ixgbe for example:
http://dpdk.org/browse/dpdk/tree/drivers/net/ixgbe/ixgbe_ethdev.c#n540

It's a pretty simple  {"string stat name" -> offsetof( stuct hw, register_var_name )}


> I haven't checked my application, but I wonder if the binary size
> would actually be smaller if all the stats strings were centrally located versus
> distributed across binaries (highly dependent on the linker and optimization level).

Sounds like optimizing the wrong thing to me.


> > If you like I could code up a minimal sample-app that only pulls
> > statistics, and you can show "interest" in various statistics for printing
> > / monitoring?
> 
> Appreciate the offer.  I actually understand what's is available.  And, BTW, I apologize
> for being late to the game (looks like this was discussed last summer) but I'm just now
> getting looped in and following the mailer but I'm just wondering if something that is
> performance friendly for the user/application and flexible for the drivers is possible.

We're all looking for the same thing - just different approaches that's all :)


RE: Thomas asking about performance numbers:
I can scrape together some raw tsc data on Monday and post to list, and we can discuss it more then.


Regards, -Harry

  parent reply	other threads:[~2016-01-22 16:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 17:18 David Harton (dharton)
2016-01-22 11:07 ` Tahhan, Maryam
2016-01-22 13:40   ` David Harton (dharton)
2016-01-22 14:18     ` Tahhan, Maryam
2016-01-22 14:40       ` David Harton (dharton)
2016-01-22 14:48         ` Thomas Monjalon
2016-01-22 15:22           ` Van Haaren, Harry
2016-01-22 15:53             ` Jay Rolette
2016-01-22 16:04             ` David Harton (dharton)
2016-01-22 16:37               ` Thomas Monjalon
2016-01-22 16:41               ` Van Haaren, Harry [this message]
2016-01-22 19:26                 ` David Harton (dharton)
2016-01-28  9:37                   ` Van Haaren, Harry
2016-02-01 16:47                   ` David Harton (dharton)
2016-02-01 21:23                     ` Matthew Hall
2016-02-02 11:40                     ` Van Haaren, Harry
2016-02-05 21:16                       ` David Harton (dharton)
2016-02-19  8:59                         ` Tahhan, Maryam
2016-01-22 14:44       ` Thomas Monjalon
2016-01-22 14:48         ` Tahhan, Maryam
2016-01-22 15:02         ` Igor Ryzhov
2016-01-22 20:48           ` Matthew Hall
2016-02-02 12:44             ` Tahhan, Maryam
2016-02-02 13:47               ` Kyle Larose

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=E923DB57A917B54B9182A2E928D00FA612861846@IRSMSX102.ger.corp.intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.org \
    --cc=dharton@cisco.com \
    --cc=thomas.monjalon@6wind.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 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).