Translated all files to ENG (#5)
Reviewed-on: #5 Co-authored-by: Finn <fwaggoner@nmfpgt.de> Co-committed-by: Finn <fwaggoner@nmfpgt.de>
This commit was merged in pull request #5.
This commit is contained in:
+23
-23
@@ -1,26 +1,26 @@
|
||||
/*
|
||||
* openuf - sysinfo.c
|
||||
*
|
||||
* Lee estadísticas del sistema para el payload inform.
|
||||
* Reads system statistics for the inform payload.
|
||||
*
|
||||
* ── CPU: /proc/stat ──────────────────────────────────────────────────
|
||||
*
|
||||
* Formato: cpu user nice system idle iowait irq softirq steal
|
||||
* Format: cpu user nice system idle iowait irq softirq steal
|
||||
*
|
||||
* El uso se calcula con dos snapshots separados en el tiempo:
|
||||
* activo = user + nice + system + irq + softirq + steal
|
||||
* total = activo + idle + iowait
|
||||
* uso % = (Δactivo / Δtotal) × 100
|
||||
* Usage is calculated with two snapshots taken at different times:
|
||||
* active = user + nice + system + irq + softirq + steal
|
||||
* total = active + idle + iowait
|
||||
* usage % = (Δactive / Δtotal) × 100
|
||||
*
|
||||
* ── Memoria: /proc/meminfo ───────────────────────────────────────────
|
||||
* ── Memory: /proc/meminfo ────────────────────────────────────────────
|
||||
*
|
||||
* MemTotal, MemFree, Buffers, Cached
|
||||
* used = total - free - buffers - cached
|
||||
*
|
||||
* ── Interfaces: /proc/net/dev + /sys/class/net/<iface>/ ─────────────
|
||||
*
|
||||
* /proc/net/dev → contadores acumulados rx/tx
|
||||
* /sys/class/net/speed → velocidad negociada (Mbps)
|
||||
* /proc/net/dev → cumulative rx/tx counters
|
||||
* /sys/class/net/speed → negotiated speed (Mbps)
|
||||
* /sys/class/net/duplex → "full" / "half"
|
||||
* /sys/class/net/operstate → "up" / "down" / "unknown"
|
||||
* /sys/class/net/address → MAC
|
||||
@@ -28,8 +28,8 @@
|
||||
*
|
||||
* ── Radio: iw dev <iface> info + survey dump ─────────────────────────
|
||||
*
|
||||
* info: canal actual, potencia TX
|
||||
* survey dump: active/busy/tx/rx time → calcular % utilización
|
||||
* info: current channel, TX power
|
||||
* survey dump: active/busy/tx/rx time → calculate % utilization
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
@@ -47,7 +47,7 @@
|
||||
#include "sysinfo.h"
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════
|
||||
Memoria
|
||||
Memory
|
||||
═══════════════════════════════════════════════════════════════════ */
|
||||
int sysinfo_mem(mem_stats_t *out)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ int sysinfo_cpu_percent(void)
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════
|
||||
Interfaz de red
|
||||
Network interface
|
||||
═══════════════════════════════════════════════════════════════════ */
|
||||
static int read_sysfs_str(const char *iface, const char *file,
|
||||
char *out, size_t sz)
|
||||
@@ -167,7 +167,7 @@ int sysinfo_iface(const char *ifname, iface_stats_t *out)
|
||||
/* IP */
|
||||
read_ip_ioctl(ifname, out->ip, sizeof(out->ip));
|
||||
|
||||
/* Contadores de /proc/net/dev */
|
||||
/* Counters of /proc/net/dev */
|
||||
FILE *f = fopen("/proc/net/dev", "r");
|
||||
if (!f) return 0;
|
||||
|
||||
@@ -179,7 +179,7 @@ int sysinfo_iface(const char *ifname, iface_stats_t *out)
|
||||
char *colon = strchr(line, ':');
|
||||
if (!colon) continue;
|
||||
|
||||
/* Extraer nombre de interfaz (puede tener espacios al inicio) */
|
||||
/* Extract interface name (may have leading spaces) */
|
||||
size_t end = colon - line;
|
||||
while (end > 0 && line[end-1] == ' ') end--;
|
||||
size_t start = 0;
|
||||
@@ -210,24 +210,24 @@ int sysinfo_iface(const char *ifname, iface_stats_t *out)
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════
|
||||
Radio WiFi
|
||||
WiFi Radio
|
||||
═══════════════════════════════════════════════════════════════════
|
||||
|
||||
1. iw dev wlan0 info → canal y potencia
|
||||
Ejemplo:
|
||||
1. iw dev wlan0 info → channel and power
|
||||
Example:
|
||||
Interface wlan0
|
||||
channel 6 (2437 MHz), width: 20 MHz
|
||||
txpower 20.00 dBm
|
||||
|
||||
2. iw dev wlan0 survey dump → utilización del canal
|
||||
Buscamos el bloque con "[in use]":
|
||||
2. iw dev wlan0 survey dump → channel utilization
|
||||
We look for the block with "[in use]":
|
||||
frequency: 2437 MHz [in use]
|
||||
channel active time: 12345 ms
|
||||
channel busy time: 987 ms
|
||||
channel transmit time: 456 ms
|
||||
channel receive time: 321 ms
|
||||
|
||||
Calculamos:
|
||||
We calculate:
|
||||
cu_total = busy/active × 100
|
||||
cu_self_tx = transmit/active × 100
|
||||
cu_self_rx = receive/active × 100
|
||||
@@ -268,7 +268,7 @@ int sysinfo_radio(const char *iface, radio_stats_t *out)
|
||||
in_use = 1; active=busy=tx_t=rx_t=0; continue;
|
||||
}
|
||||
if (!in_use) continue;
|
||||
/* Nueva frecuencia sin [in use] resetea el bloque */
|
||||
/* New frequency without [in use] resets the block */
|
||||
if (strstr(line, "frequency:") && !strstr(line, "[in use]")) {
|
||||
in_use = 0; continue;
|
||||
}
|
||||
@@ -287,7 +287,7 @@ int sysinfo_radio(const char *iface, radio_stats_t *out)
|
||||
out->cu_self_rx = (int)(rx_t * 100 / active);
|
||||
}
|
||||
|
||||
/* Número de clientes asociados */
|
||||
/* Number of associated clients */
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"iw dev %s station dump 2>/dev/null | grep -c '^Station'",
|
||||
iface);
|
||||
|
||||
Reference in New Issue
Block a user