|
|
0459e1 |
From 9fd52d5705fad70c0cb4ad8d508596a488262acf Mon Sep 17 00:00:00 2001
|
|
|
0459e1 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
0459e1 |
Date: Mon, 13 Jul 2020 09:24:35 +0200
|
|
|
0459e1 |
Subject: [PATCH] Use kibibytes instead of kilobytes in a documentation
|
|
|
0459e1 |
MIME-Version: 1.0
|
|
|
0459e1 |
Content-Type: text/plain; charset=UTF-8
|
|
|
0459e1 |
Content-Transfer-Encoding: 8bit
|
|
|
0459e1 |
|
|
|
0459e1 |
This patch does not changes any output of the time program. It only
|
|
|
0459e1 |
clarifies a manual and the comments.
|
|
|
0459e1 |
|
|
|
0459e1 |
<https://lists.gnu.org/archive/html/bug-time/2020-07/msg00000.html>
|
|
|
0459e1 |
|
|
|
0459e1 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
0459e1 |
---
|
|
|
0459e1 |
configure.ac | 6 +++---
|
|
|
0459e1 |
doc/time.texi | 12 ++++++------
|
|
|
0459e1 |
src/rusage-kb.c | 4 ++--
|
|
|
0459e1 |
src/rusage-kb.h | 10 +++++-----
|
|
|
0459e1 |
src/time.c | 6 +++---
|
|
|
0459e1 |
tests/time-max-rss.sh | 4 ++--
|
|
|
0459e1 |
6 files changed, 21 insertions(+), 21 deletions(-)
|
|
|
0459e1 |
|
|
|
0459e1 |
diff --git a/configure.ac b/configure.ac
|
|
|
0459e1 |
index d2950bd..67738b5 100644
|
|
|
0459e1 |
--- a/configure.ac
|
|
|
0459e1 |
+++ b/configure.ac
|
|
|
0459e1 |
@@ -90,7 +90,7 @@ if test -z "$time_getrusage_mem_units" ; then
|
|
|
0459e1 |
|
|
|
0459e1 |
solaris*) time_getrusage_mem_units=pages ;;
|
|
|
0459e1 |
|
|
|
0459e1 |
- # As a fallback, assume KB (the most common value).
|
|
|
0459e1 |
+ # As a fallback, assume KiB (the most common value).
|
|
|
0459e1 |
# Set the 'warn' variable to warn the user at the end
|
|
|
0459e1 |
# of ./configure
|
|
|
0459e1 |
*) time_getrusage_mem_units=kb
|
|
|
0459e1 |
@@ -104,7 +104,7 @@ case $time_getrusage_mem_units in
|
|
|
0459e1 |
kb)
|
|
|
0459e1 |
AC_DEFINE([GETRUSAGE_RETURNS_KB],[1],
|
|
|
0459e1 |
[Define to 1 if getrusage(2) on this systems returns
|
|
|
0459e1 |
- ru_maxrss in kilobytes])
|
|
|
0459e1 |
+ ru_maxrss in kibibytes])
|
|
|
0459e1 |
;;
|
|
|
0459e1 |
|
|
|
0459e1 |
bytes)
|
|
|
0459e1 |
@@ -140,7 +140,7 @@ AC_OUTPUT
|
|
|
0459e1 |
# Warn the user if getrusage(2) behaviour on this OS is unknown
|
|
|
0459e1 |
if test "$warn_getrusage_mem_units" ; then
|
|
|
0459e1 |
AC_MSG_WARN([unknown getrusage behavior on operating system '$host_os'.
|
|
|
0459e1 |
- Assuming Kilobytes.
|
|
|
0459e1 |
+ Assuming kibibytes.
|
|
|
0459e1 |
please report this with the output of 'uname -a' to
|
|
|
0459e1 |
bug-time@gnu.org])
|
|
|
0459e1 |
fi
|
|
|
0459e1 |
diff --git a/doc/time.texi b/doc/time.texi
|
|
|
0459e1 |
index dac65b4..3a05ed9 100644
|
|
|
0459e1 |
--- a/doc/time.texi
|
|
|
0459e1 |
+++ b/doc/time.texi
|
|
|
0459e1 |
@@ -241,22 +241,22 @@ times divied by the total running time.
|
|
|
0459e1 |
@table @code
|
|
|
0459e1 |
@item M
|
|
|
0459e1 |
Maximum resident set size of the process during its lifetime, in
|
|
|
0459e1 |
-Kilobytes.
|
|
|
0459e1 |
+kibibytes.
|
|
|
0459e1 |
|
|
|
0459e1 |
@item t
|
|
|
0459e1 |
-Average resident set size of the process, in Kilobytes.
|
|
|
0459e1 |
+Average resident set size of the process, in kibibytes.
|
|
|
0459e1 |
|
|
|
0459e1 |
@item K
|
|
|
0459e1 |
-Average total (data+stack+text) memory use of the process, in Kilobytes.
|
|
|
0459e1 |
+Average total (data+stack+text) memory use of the process, in kibibytes.
|
|
|
0459e1 |
|
|
|
0459e1 |
@item D
|
|
|
0459e1 |
-Average size of the process's unshared data area, in Kilobytes.
|
|
|
0459e1 |
+Average size of the process's unshared data area, in kibibytes.
|
|
|
0459e1 |
|
|
|
0459e1 |
@item p
|
|
|
0459e1 |
-Average size of the process's unshared stack, in Kilobytes.
|
|
|
0459e1 |
+Average size of the process's unshared stack, in kibibytes.
|
|
|
0459e1 |
|
|
|
0459e1 |
@item X
|
|
|
0459e1 |
-Average size of the process's shared text, in Kilobytes.
|
|
|
0459e1 |
+Average size of the process's shared text, in kibibytes.
|
|
|
0459e1 |
|
|
|
0459e1 |
@item Z
|
|
|
0459e1 |
System's page size, in bytes. This is a per-system constant, but
|
|
|
0459e1 |
diff --git a/src/rusage-kb.c b/src/rusage-kb.c
|
|
|
0459e1 |
index aad06b8..04352cd 100644
|
|
|
0459e1 |
--- a/src/rusage-kb.c
|
|
|
0459e1 |
+++ b/src/rusage-kb.c
|
|
|
0459e1 |
@@ -25,8 +25,8 @@
|
|
|
0459e1 |
#include <limits.h>
|
|
|
0459e1 |
#include <unistd.h>
|
|
|
0459e1 |
|
|
|
0459e1 |
-/* Return the number of kilobytes corresponding to a number of pages PAGES.
|
|
|
0459e1 |
- (Actually, we use it to convert pages*ticks into kilobytes*ticks.)
|
|
|
0459e1 |
+/* Return the number of kibibytes corresponding to a number of pages PAGES.
|
|
|
0459e1 |
+ (Actually, we use it to convert pages*ticks into kibibytes*ticks.)
|
|
|
0459e1 |
|
|
|
0459e1 |
Try to do arithmetic so that the risk of overflow errors is minimized.
|
|
|
0459e1 |
This is funky since the pagesize could be less than 1K.
|
|
|
0459e1 |
diff --git a/src/rusage-kb.h b/src/rusage-kb.h
|
|
|
0459e1 |
index 4a53515..b7b1155 100644
|
|
|
0459e1 |
--- a/src/rusage-kb.h
|
|
|
0459e1 |
+++ b/src/rusage-kb.h
|
|
|
0459e1 |
@@ -19,7 +19,7 @@
|
|
|
0459e1 |
#ifndef _RUSAGE_KB_
|
|
|
0459e1 |
#define _RUSAGE_KB_
|
|
|
0459e1 |
|
|
|
0459e1 |
-/* As of 2017, most kernels' getrusage(2) returns ru_maxrss in kilobytes:
|
|
|
0459e1 |
+/* As of 2017, most kernels' getrusage(2) returns ru_maxrss in kibibytes:
|
|
|
0459e1 |
Linux, Hurd, Free/Open/Net-BSD, MINIX, AIX7
|
|
|
0459e1 |
|
|
|
0459e1 |
OpenSolaris's getrusage(2) documents a return value in pages,
|
|
|
0459e1 |
@@ -32,20 +32,20 @@
|
|
|
0459e1 |
|
|
|
0459e1 |
#if GETRUSAGE_RETURNS_KB
|
|
|
0459e1 |
|
|
|
0459e1 |
-/* define as no-op, as RUSAGE values are already in KB */
|
|
|
0459e1 |
+/* define as no-op, as RUSAGE values are already in KiB */
|
|
|
0459e1 |
#define RUSAGE_MEM_TO_KB(x) (x)
|
|
|
0459e1 |
|
|
|
0459e1 |
#elif GETRUSAGE_RETURNS_BYTES
|
|
|
0459e1 |
|
|
|
0459e1 |
-/* Convert bytes to kilobytes */
|
|
|
0459e1 |
+/* Convert bytes to kibibytes */
|
|
|
0459e1 |
#define RUSAGE_MEM_TO_KB(x) ((x)/1024)
|
|
|
0459e1 |
|
|
|
0459e1 |
#elif GETRUSAGE_RETURNS_PAGES
|
|
|
0459e1 |
|
|
|
0459e1 |
-/* Convert bytes to kilobytes */
|
|
|
0459e1 |
+/* Convert bytes to kibibytes */
|
|
|
0459e1 |
#define RUSAGE_MEM_TO_KB(x) (ptok (x))
|
|
|
0459e1 |
|
|
|
0459e1 |
-/* A function to get the system's page size and convert pages to KB */
|
|
|
0459e1 |
+/* A function to get the system's page size and convert pages to KiB */
|
|
|
0459e1 |
unsigned long
|
|
|
0459e1 |
ptok (unsigned long pages);
|
|
|
0459e1 |
|
|
|
0459e1 |
diff --git a/src/time.c b/src/time.c
|
|
|
0459e1 |
index 7e07995..f76265a 100644
|
|
|
0459e1 |
--- a/src/time.c
|
|
|
0459e1 |
+++ b/src/time.c
|
|
|
0459e1 |
@@ -108,8 +108,8 @@ typedef RETSIGTYPE (*sighandler) ();
|
|
|
0459e1 |
and 100 on the sun4.
|
|
|
0459e1 |
|
|
|
0459e1 |
Some manuals have an apparent error, claiming that units for average
|
|
|
0459e1 |
- sizes are kb*sec. Judging by the contents of `struct rusage', it
|
|
|
0459e1 |
- looks like it should be kb*ticks, like on SunOS. Ticks/sec seems
|
|
|
0459e1 |
+ sizes are KiB*sec. Judging by the contents of `struct rusage', it
|
|
|
0459e1 |
+ looks like it should be KiB*ticks, like on SunOS. Ticks/sec seems
|
|
|
0459e1 |
to be (empirically):
|
|
|
0459e1 |
50 Mt. Xinu
|
|
|
0459e1 |
250 Ultrix (mips)
|
|
|
0459e1 |
@@ -412,7 +412,7 @@ linear_argv (argv)
|
|
|
0459e1 |
x == exit status of command
|
|
|
0459e1 |
|
|
|
0459e1 |
Various memory usages are found by converting from page-seconds
|
|
|
0459e1 |
- to kbytes by multiplying by the page size, dividing by 1024,
|
|
|
0459e1 |
+ to kibibytes by multiplying by the page size, dividing by 1024,
|
|
|
0459e1 |
and dividing by elapsed real time.
|
|
|
0459e1 |
|
|
|
0459e1 |
FP is the stream to print to.
|
|
|
0459e1 |
diff --git a/tests/time-max-rss.sh b/tests/time-max-rss.sh
|
|
|
0459e1 |
index 0adda5c..5ecd3f2 100755
|
|
|
0459e1 |
--- a/tests/time-max-rss.sh
|
|
|
0459e1 |
+++ b/tests/time-max-rss.sh
|
|
|
0459e1 |
@@ -27,7 +27,7 @@ fail=
|
|
|
0459e1 |
# The auxiliary program should be built and runnable
|
|
|
0459e1 |
time-aux || framework_failure_ "time-aux is missing/not runnable"
|
|
|
0459e1 |
|
|
|
0459e1 |
-# Get the baseline number of MAX-RSS kilobytes
|
|
|
0459e1 |
+# Get the baseline number of MAX-RSS kibibytes
|
|
|
0459e1 |
# use by the program when not allocating any extra memory
|
|
|
0459e1 |
env time -o mem-baseline -f "%M" time-aux \
|
|
|
0459e1 |
|| framework_failure_ "failed to run time/time-aux (baseline max-rss)"
|
|
|
0459e1 |
@@ -49,7 +49,7 @@ test "$b" -eq "0" && test "$c" -eq 0 \
|
|
|
0459e1 |
# There could be alot of variation between each invocation,
|
|
|
0459e1 |
# accept a reasonable range
|
|
|
0459e1 |
if test "$d" -ge 5000 && test "$d" -le 6000 ; then
|
|
|
0459e1 |
- : # acceptable values: 5000-6000 KB
|
|
|
0459e1 |
+ : # acceptable values: 5000-6000 KiB
|
|
|
0459e1 |
else
|
|
|
0459e1 |
cat<<EOF>&2
|
|
|
0459e1 |
time(1) failed to detect 5MB allcoation.
|
|
|
0459e1 |
--
|
|
|
0459e1 |
2.25.4
|
|
|
0459e1 |
|