* [PATCH v2] docs: pt_BR: Translate admin-guide/cpu-load.rst
@ 2026-12-04 1:09 Efraim E. Vander
0 siblings, 0 replies; only message in thread
From: Efraim E. Vander @ 2026-12-04 1:09 UTC (permalink / raw)
To: Daniel Pereira, Jonathan Corbet
Cc: Shuah Khan, Randy Dunlap, linux-doc, linux-kernel, Efraim E . Vander
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-04 1:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-04 1:09 [PATCH v2] docs: pt_BR: Translate admin-guide/cpu-load.rst Efraim E. Vander
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®