lkml.org 
[lkml]   [2020]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 7/7] [not for merge] netstats: example use of stats_fs API
From
Date

Hi Andrew

> How do you atomically get and display a group of statistics?
>
> If you look at how the netlink socket works, you will see code like:
>
> do {
> start = u64_stats_fetch_begin_irq(&cpu_stats->syncp);
> rx_packets = cpu_stats->rx_packets;
> rx_bytes = cpu_stats->rx_bytes;
> ....
> } while (u64_stats_fetch_retry_irq(&cpu_stats->syncp, start));
>
> It will ensure that rx_packets and rx_bytes are consistent with each
> other. If the value of the sequence counter changes while inside the
> loop, the loop so repeated until it does not change.
>
> In general, hardware counters in NICs are the same. You tell it to
> take a snapshot of the statistics counters, and then read them all
> back, to give a consistent view across all the statistics.
>
> I've not looked at this new code in detail, but it looks like you have
> one file per statistic, and assume each statistic is independent of
> every other statistic. This independence can limit how you use the
> values, particularly when debugging. The netlink interface we use does
> not have this limitation.

You're right, statistics are treated independently so what you describe
is currently not supported.

In KVM the utilization is more qualitative, so there isn't such problem.
But as long as the interface is based on file access, the possibility of
snapshotting might not be useful; however, it could still be considered
to be added later together with the binary access.

Jonathan, how is your metricfs handling this case?

Thank you,
Emanuele

\
 
 \ /
  Last update: 2020-05-26 17:45    [W:2.563 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site