Linux Documentation
 help / color / mirror / Atom feed
From: "Efraim E. Vander" <efraimvander64@gmail.com>
To: Daniel Pereira <danielmaraboo@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Efraim E . Vander" <efraimvander64@gmail.com>
Subject: [PATCH v2] docs: pt_BR: Translate admin-guide/cpu-load.rst
Date: Fri,  4 Dec 2026 01:09:42 +0000	[thread overview]
Message-ID: <20261204010943.65069-1-efraimvander64@gmail.com> (raw)

Add the Brazilian Portuguese translation of the CPU load
documentation.

Update the admin-guide index to include the translated
document and remove it from the translation TODO list.

Signed-off-by: Efraim E. Vander <efraimvander64@gmail.com>
---
Changes in v2:
- Add cpu-load to the admin-guide toctree.
- Remove cpu-load from the translation TODO list.

 .../pt_BR/admin-guide/cpu-load.rst            | 119 ++++++++++++++++++
 .../translations/pt_BR/admin-guide/index.rst  |   2 +-
 2 files changed, 120 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/translations/pt_BR/admin-guide/cpu-load.rst

diff --git a/Documentation/translations/pt_BR/admin-guide/cpu-load.rst b/Documentation/translations/pt_BR/admin-guide/cpu-load.rst
new file mode 100644
index 000000000..56ef8d658
--- /dev/null
+++ b/Documentation/translations/pt_BR/admin-guide/cpu-load.rst
@@ -0,0 +1,119 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=============
+Carga da CPU
+=============
+
+O Linux exporta diversas informações por meio de ``/proc/stat`` e
+``/proc/uptime``, que ferramentas do espaço do usuário, como ``top(1)``,
+utilizam para calcular o tempo médio que o sistema passou em determinado
+estado, por exemplo::
+
+    $ iostat
+    Linux 2.6.18.3-exp (linmac)     02/20/2007
+
+    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
+              10.01    0.00    2.92    5.44    0.00   81.63
+
+    ...
+
+Nesse caso, o sistema considera que, durante o período de amostragem
+padrão, passou 10,01% do tempo executando tarefas no espaço do usuário,
+2,92% no kernel e permaneceu ocioso durante 81,63% do tempo.
+
+Na maioria dos casos, as informações de ``/proc/stat`` refletem a
+realidade com bastante precisão. No entanto, devido à forma e ao momento
+em que o kernel coleta esses dados, às vezes não se pode confiar neles.
+
+Então, como essas informações são coletadas? Sempre que uma interrupção
+do temporizador é sinalizada, o kernel verifica que tipo de tarefa
+estava em execução naquele momento e incrementa o contador correspondente
+ao tipo/estado dessa tarefa. O problema é que o sistema pode ter alternado
+entre vários estados diversas vezes entre duas interrupções do
+temporizador, mas o contador é incrementado apenas para o último estado.
+
+Exemplo
+-------
+
+Imagine um sistema com uma única tarefa que consome ciclos de CPU
+periodicamente da seguinte maneira::
+
+     Linha do tempo entre duas interrupções do temporizador
+    |--------------------------------------|
+     ^                                    ^
+     |_ algo começa a trabalhar          |
+                                          |_ algo entra em suspensão
+                                         (mas é despertado pouco depois)
+
+Na situação acima, a carga do sistema será de 0% de acordo com
+``/proc/stat`` (pois a interrupção do temporizador sempre ocorrerá
+quando o sistema estiver executando a rotina de ociosidade), mas,
+na realidade, a carga estará mais próxima de 99%.
+
+É possível imaginar muitas outras situações em que esse comportamento
+do kernel levará a informações bastante inconsistentes em ``/proc/stat``::
+
+
+	/* gcc -o hog smallhog.c */
+	#include <time.h>
+	#include <limits.h>
+	#include <signal.h>
+	#include <sys/time.h>
+	#define HIST 10
+
+	static volatile sig_atomic_t stop;
+
+	static void sighandler(int signr)
+	{
+		(void) signr;
+		stop = 1;
+	}
+
+	static unsigned long hog (unsigned long niters)
+	{
+		stop = 0;
+		while (!stop && --niters);
+		return niters;
+	}
+
+	int main (void)
+	{
+		int i;
+		struct itimerval it = {
+			.it_interval = { .tv_sec = 0, .tv_usec = 1 },
+			.it_value    = { .tv_sec = 0, .tv_usec = 1 } };
+		sigset_t set;
+		unsigned long v[HIST];
+		double tmp = 0.0;
+		unsigned long n;
+		signal(SIGALRM, &sighandler);
+		setitimer(ITIMER_REAL, &it, NULL);
+
+		hog (ULONG_MAX);
+		for (i = 0; i < HIST; ++i) v[i] = ULONG_MAX - hog(ULONG_MAX);
+		for (i = 0; i < HIST; ++i) tmp += v[i];
+		tmp /= HIST;
+		n = tmp - (tmp / 3.0);
+
+		sigemptyset(&set);
+		sigaddset(&set, SIGALRM);
+
+		for (;;) {
+			hog(n);
+			sigwait(&set, &i);
+		}
+		return 0;
+	}
+
+
+Referências
+-----------
+
+- https://lore.kernel.org/r/loom.20070212T063225-663@post.gmane.org
+- Documentation/filesystems/proc.rst (1.8)
+
+
+Agradecimentos
+--------------
+
+Con Kolivas, Pavel Machek
diff --git a/Documentation/translations/pt_BR/admin-guide/index.rst b/Documentation/translations/pt_BR/admin-guide/index.rst
index cb5a64f82..2195b6a99 100644
--- a/Documentation/translations/pt_BR/admin-guide/index.rst
+++ b/Documentation/translations/pt_BR/admin-guide/index.rst
@@ -26,6 +26,7 @@ etc.
 
    README
    devices
+   cpu-load
    features
 
 Uma grande parte da interface administrativa do kernel são os sistemas de
@@ -109,7 +110,6 @@ Todolist:
 *   cgroup-v2
 *   cgroup-v1/index
 *   cpu-isolation
-*   cpu-load
 *   mm/index
 *   module-signing
 *   namespaces/index
-- 
2.43.0


                 reply	other threads:[~2026-12-04  1:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261204010943.65069-1-efraimvander64@gmail.com \
    --to=efraimvander64@gmail.com \
    --cc=corbet@lwn.net \
    --cc=danielmaraboo@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /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