diff mbox series

[7/7] docs: proc.rst: stat: Note the interrupt counter wrap-around

Message ID 20210911034808.24252-8-me@ilammy.net (mailing list archive)
State Superseded, archived
Headers show
Series proc/stat: Maintain monotonicity of "intr" and "softirq" | expand

Commit Message

Alexei Lozovsky Sept. 11, 2021, 3:48 a.m. UTC
Let's make wrap-around documented behavior so that userspace has no
excuses for not handling it properly if they want accurate values.

Both "intr" and "softirq" counters (as well as many others, actually)
can and will wrap-around, given enough time since boot.

Signed-off-by: Alexei Lozovsky <me@ilammy.net>
---
 Documentation/filesystems/proc.rst | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Randy Dunlap Sept. 11, 2021, 3:59 a.m. UTC | #1
On 9/10/21 8:48 PM, Alexei Lozovsky wrote:
> Let's make wrap-around documented behavior so that userspace has no
> excuses for not handling it properly if they want accurate values.
> 
> Both "intr" and "softirq" counters (as well as many others, actually)
> can and will wrap-around, given enough time since boot.
> 
> Signed-off-by: Alexei Lozovsky <me@ilammy.net>
> ---
>   Documentation/filesystems/proc.rst | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst
> index 042c418f4090..06a0e3aa2e0e 100644
> --- a/Documentation/filesystems/proc.rst
> +++ b/Documentation/filesystems/proc.rst
> @@ -1513,6 +1513,13 @@ interrupts serviced  including  unnumbered  architecture specific  interrupts;
>   each  subsequent column is the  total for that particular numbered interrupt.
>   Unnumbered interrupts are not shown, only summed into the total.
>   
> +.. note::
> +
> +   Interrupt counters on most platforms are 32-bit, including the total count.
> +   Depending on the system load, ths values will sooner or later wrap around.

                                     these

> +   If you want accurate accouting of the rate and *real* number of interrupts

                            accounting

> +   serviced, you should monitor the value closely and handle wrap-arounds.
> +
>   The "ctxt" line gives the total number of context switches across all CPUs.
>   
>   The "btime" line gives  the time at which the  system booted, in seconds since
> 

thanks.
diff mbox series

Patch

diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst
index 042c418f4090..06a0e3aa2e0e 100644
--- a/Documentation/filesystems/proc.rst
+++ b/Documentation/filesystems/proc.rst
@@ -1513,6 +1513,13 @@  interrupts serviced  including  unnumbered  architecture specific  interrupts;
 each  subsequent column is the  total for that particular numbered interrupt.
 Unnumbered interrupts are not shown, only summed into the total.
 
+.. note::
+
+   Interrupt counters on most platforms are 32-bit, including the total count.
+   Depending on the system load, ths values will sooner or later wrap around.
+   If you want accurate accouting of the rate and *real* number of interrupts
+   serviced, you should monitor the value closely and handle wrap-arounds.
+
 The "ctxt" line gives the total number of context switches across all CPUs.
 
 The "btime" line gives  the time at which the  system booted, in seconds since