LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
Boot time on record: lord-sessiond logs the seconds from the kernel's start to the first frame with the version and build, and keeps every boot in /var/lib/lordos/boot-times.jsonl (last 200); About LordOS shows this boot's Startup time; collect.sh saves the history; RESULTS.md explains how anyone can check and compare boots; LordBench gets a Boot category
Federico Pereirabd8799861663
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d98fbb8..f153aa3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,10 +12,12 @@ of the matching [GitHub release](https://github.com/lordbasex/LordOS/releases),### Added-- **A boot timer.** The boot splash shows the time since it started, in seconds and milliseconds, in- the bottom right corner, and the log records when the desktop's first frame reached the screen,- counted from the kernel's start (`first frame on the monitor 7.267 s after the kernel started`), for- comparing versions and machines.+- **Boot time, on the screen and on record.** The boot splash shows the time since it started, in+ seconds and milliseconds, in the bottom right corner. About LordOS → Startup time shows how long this+ boot took from the kernel's start to the login screen (or, with automatic login, the desktop). Every+ boot is logged with the LordOS version and build (`journalctl -b -u lordos | grep "first frame"`) and+ kept in `/var/lib/lordos/boot-times.jsonl` (the last 200 boots), so boots and versions can be compared;+ `docs/RESULTS.md` explains how to check and compare them.- **`lordos-fetch`.** Type it in a terminal to see the LordOS crown beside a summary of yourcomputer: system, kernel, CPU, GPU, display, memory, disk, packages and how apps are isolated.`lordos-fetch --share` leaves out your user and computer names, for a screenshot you'll post.diff --git a/apps/about/index.jsx b/apps/about/index.jsxindex 297da7f..997f8b8 100644--- a/apps/about/index.jsx+++ b/apps/about/index.jsx@@ -69,6 +69,9 @@ export default function About() {<InfoRow k={tr('about.cpu')} v={tr('about.cpuValue', { cpu: cpu.slice(0, 34) || tr('about.cpuUnknown'), count: info.cores })} /><InfoRow k={tr('about.memory')} v={tr('shell.cc.memDetail', { used: formatBytes((info.memTotalKB - info.memAvailableKB) * 1024), total: formatBytes(info.memTotalKB * 1024) })} /><InfoRow k={tr('about.uptime')} v={formatDuration(info.uptime)} />+ {info.bootSeconds > 0 ? (+ <InfoRow k={tr('about.bootTime')} v={tr(info.bootShown === 'session' ? 'about.bootToDesktop' : 'about.bootToLogin', { s: formatNumber(info.bootSeconds, 3) })} />+ ) : null}<View style={{ height: 1, backgroundColor: t.separator, marginVertical: 8, marginHorizontal: 24 }} /><InfoRow k={tr('about.server')} v="lord-server (C · DRM/KMS · evdev)" /><InfoRow k={tr('about.engine')} v={`QuickJS + React ${reactVersion}`} />diff --git a/assets/locales/en/about.json b/assets/locales/en/about.jsonindex 8c5eb4d..53b6799 100644--- a/assets/locales/en/about.json+++ b/assets/locales/en/about.json@@ -1,4 +1,7 @@{+ "bootTime": "Startup time",+ "bootToDesktop": "{s} s to the desktop",+ "bootToLogin": "{s} s to the login screen","build": "Build {b}","buildLabel": "Build","channelAlpha": "Alpha",diff --git a/assets/locales/es/about.json b/assets/locales/es/about.jsonindex 6a8237f..8484fd2 100644--- a/assets/locales/es/about.json+++ b/assets/locales/es/about.json@@ -1,4 +1,7 @@{+ "bootTime": "Tiempo de inicio",+ "bootToDesktop": "{s} s hasta el escritorio",+ "bootToLogin": "{s} s hasta la pantalla de inicio","build": "Compilación {b}","buildLabel": "Compilación","channelAlpha": "Alfa",diff --git a/assets/locales/pt/about.json b/assets/locales/pt/about.jsonindex 8245aa9..e4a7da1 100644--- a/assets/locales/pt/about.json+++ b/assets/locales/pt/about.json@@ -1,4 +1,7 @@{+ "bootTime": "Tempo de inicialização",+ "bootToDesktop": "{s} s até a área de trabalho",+ "bootToLogin": "{s} s até a tela de login","build": "Compilação {b}","buildLabel": "Compilação","channelAlpha": "Alfa",diff --git a/docs/BENCHMARK.md b/docs/BENCHMARK.mdindex eee3c5f..eaf41f1 100644--- a/docs/BENCHMARK.md+++ b/docs/BENCHMARK.md@@ -156,6 +156,7 @@ A versioned JSON (`schema: 1`) and a Markdown summary, saved to `~/Documents`:| Compositor | `lord-server`'s own frame counters during a scripted window drag, CPU path and GPU path || Video | short test clips we generate (H.264, HEVC, VP9, AV1; 1080p and 4K) decoded in `lord-media`, hardware and software; the remote desktop's encoders || Storage | sequential and random I/O on a size-limited temporary file (Full only, with a warning on SD cards) |+| Boot | the seconds from the kernel's start to the first frame on the monitor, recorded by `lord-sessiond` on every boot with the version and build (`/var/lib/lordos/boot-times.jsonl`, built in 0.8.5; [RESULTS.md](RESULTS.md), "Boot time"): LordBench reads that history, shows each version's median and spread over its boots (the first boot after an update apart: it builds caches), and with the user's consent can reboot N times in a row to measure it || Sustained | several minutes of all-core load (Full only) |### Frame times against the refresh budgetdiff --git a/docs/RESULTS.md b/docs/RESULTS.mdindex f664a2b..8849567 100644--- a/docs/RESULTS.md+++ b/docs/RESULTS.md@@ -23,6 +23,43 @@ folder; run it as the user inside a LordOS session, and with `sudo` to include rlist. Fill in the conditions in its README before committing. Each release attaches its `results/<version>`folder to the GitHub release (`docs/RELEASING.md`).+## Boot time: check it yourself++LordOS measures every boot the same way, on any machine, with no tool to install:++- **On the screen.** The boot splash shows a timer in its bottom right corner, in seconds and+ milliseconds, from the moment the splash starts. About LordOS → **Startup time** shows this boot's+ result: the seconds from the kernel's start to the first frame on the monitor, and whether that frame+ was the login screen or, with automatic login, the desktop.+- **In the log.** `lord-sessiond` writes one line per boot when the first frame reaches the monitor:++ ```sh+ journalctl -b -u lordos | grep "first frame"+ # first frame on the monitor 7.224 s after the kernel started (LordOS 0.8.5~rc1-beta, build 20261026, session)+ ```++ `-b -1`, `-b -2`… give the previous boots while the journal keeps them.+- **The history.** Every boot is also appended to `/var/lib/lordos/boot-times.jsonl` (root's, readable by+ everyone, the last 200 boots), one JSON object a line, so boots and versions can be compared after the+ journal is gone:++ ```sh+ cat /var/lib/lordos/boot-times.jsonl+ # {"bootId":"e519ea86-…","at":1793052001,"seconds":7.224,"shown":"session","version":"0.8.5~rc1-beta","build":"20261026","kernel":"6.12.113+deb13-amd64"}+ python3 -c 'import json; [print(f"{d[\"version\"]:>16} {d[\"seconds\"]:7.3f} s {d[\"shown\"]}") for d in map(json.loads, open("/var/lib/lordos/boot-times.jsonl"))]'+ ```++ `seconds` counts from the kernel's start (`CLOCK_BOOTTIME`), so the firmware and the boot loader are not+ included; `shown` is `login` (the login screen), `session` (automatic login) or `none` (no monitor).+- **The pieces.** `systemd-analyze` splits the boot into kernel and userspace, and+ `systemd-analyze critical-chain lordos.service` shows what LordOS waited for. The splash's own timer+ starts when Plymouth starts, a little after the kernel: `journalctl -b -o short-monotonic | grep -E+ "kernel: Linux version|Started plymouth-start"` gives both moments, and the difference.+- **Comparing fairly.** The same machine, the same settings (automatic login on or off changes what the+ first frame is), several boots of each version (the first boot after an update or a new kernel is+ slower: it builds caches); report the median. `tools/results/collect.sh` saves all of the above in+ `boot.txt` and `boot-times.jsonl`.+## Memory: two magnitudes`free`'s "used" is the whole system's memory (kernel, Debian's services, LordOS's services, thediff --git a/docs/SESSIONS.md b/docs/SESSIONS.mdindex 7841447..a791925 100644--- a/docs/SESSIONS.md+++ b/docs/SESSIONS.md@@ -183,6 +183,16 @@ greeter (JS) → RP_GREETER → lord-sessiond (root), over the login screen's soFailed attempts on the monitor are counted per user (`monitor:<user>`). The first two don't wait;after that the wait is 1, 2, 4… seconds, up to 5 minutes.+### Boot time++When the first frame of a boot reaches the monitor, `lord-sessiond` logs the seconds since the kernel+started (`CLOCK_BOOTTIME`) with the LordOS version and build, and appends the same as one JSON line to+`/var/lib/lordos/boot-times.jsonl` (`record_boot_time`: root's, 0644, written whole and renamed, the last+200 boots, no user or host names). About LordOS shows this boot's line, found by the kernel's boot id+(`boot_time_load` in `ui/js_sys.c`: the file must be root's and not writable by others). The boot splash+shows its own timer (`tools/boot/plymouth/lordos/lordos.script`). How to check and compare boots:+[RESULTS.md](RESULTS.md), "Boot time: check it yourself".+### Lock, switch user and log out**The login screen runs only when it is shown (0.8.5).** It used to stay running behind the sessiondiff --git a/server/src/remote/sessiond.c b/server/src/remote/sessiond.cindex 56a4fba..291ff74 100644--- a/server/src/remote/sessiond.c+++ b/server/src/remote/sessiond.c@@ -31,6 +31,7 @@#include "../sec/cgroup.h"#include "proto.h"#include "rsec.h"+#include "lord_version.h" /* build/gen: version, channel and build (Makefile) */#include <ctype.h>#include <dirent.h>@@ -58,6 +59,7 @@#include <sys/stat.h>#include <sys/wait.h>#include <time.h>+#include <sys/utsname.h>#include <unistd.h>#include <openssl/err.h>#include <openssl/evp.h>@@ -655,16 +657,65 @@ static int splash_up(void) {return stat(SD_FIRST_FRAME, &st) != 0;}+/* Every boot's time to the first frame, kept across reboots to compare boots and versions:+ * /var/lib/lordos/boot-times.jsonl (root's, 0644), one JSON object a line, the last BOOT_TIMES_MAX.+ * Only values LordOS produces itself: no user or host names. About LordOS shows this boot's line+ * (js_sys.c, matched by bootId). */+#define BOOT_TIMES SD_STATE_DIR "/boot-times.jsonl"+#define BOOT_TIMES_MAX 200+static void record_boot_time(double secs, const char *what) {+ char id[40] = "";+ FILE *b = fopen("/proc/sys/kernel/random/boot_id", "re");+ if (b) { if (!fgets(id, sizeof id, b)) id[0] = 0; fclose(b); }+ id[strspn(id, "0123456789abcdef-")] = 0;+ struct utsname u;+ if (uname(&u)) u.release[0] = 0;+ char rel[65];+ snprintf(rel, sizeof rel, "%s", u.release);+ for (char *q = rel; *q; q++) if (!isalnum((unsigned char)*q) && !strchr(".+~-_", *q)) *q = '_';+ char line[400];+ snprintf(line, sizeof line, "{\"bootId\":\"%s\",\"at\":%lld,\"seconds\":%.3f,\"shown\":\"%s\",\"version\":\"%s%s%s\",\"build\":\"%s\",\"kernel\":\"%s\"}\n",+ id, (long long)time(NULL), secs, what, LORD_VERSION, LORD_CHANNEL[0] ? "-" : "", LORD_CHANNEL, LORD_BUILD, rel);+ /* the older lines, at most BOOT_TIMES_MAX - 1, then this one; written whole and renamed */+ static char old[BOOT_TIMES_MAX * 400];+ size_t n = 0;+ int fd = open(BOOT_TIMES, O_RDONLY | O_CLOEXEC | O_NOFOLLOW);+ if (fd >= 0) {+ ssize_t r;+ while (n < sizeof old - 1 && (r = read(fd, old + n, sizeof old - 1 - n)) > 0) n += (size_t)r;+ close(fd);+ }+ old[n] = 0;+ int lines = 0;+ for (size_t i = 0; i < n; i++) if (old[i] == '\n') lines++;+ char *keep = old;+ while (lines >= BOOT_TIMES_MAX && (keep = strchr(keep, '\n'))) { keep++; lines--; }+ if (!keep) keep = old + n;+ mkdir(SD_STATE_DIR, 0755);+ char tmp[] = SD_STATE_DIR "/.boot-times.XXXXXX";+ int t = mkostemp(tmp, O_CLOEXEC);+ if (t < 0) { sd_log("warning: %s: %s", BOOT_TIMES, strerror(errno)); return; }+ size_t kl = strlen(keep);+ int ok = (kl == 0 || write(t, keep, kl) == (ssize_t)kl) && write(t, line, strlen(line)) == (ssize_t)strlen(line);+ ok = fchmod(t, 0644) == 0 && ok;+ ok = close(t) == 0 && ok;+ if (!ok || rename(tmp, BOOT_TIMES)) { unlink(tmp); sd_log("warning: could not write %s", BOOT_TIMES); }+}+static void first_frame(void) {if (!splash_up()) return;int f = open(SD_FIRST_FRAME, O_WRONLY | O_CREAT | O_CLOEXEC | O_NOFOLLOW, 0644);if (f < 0) { sd_log("warning: %s: %s", SD_FIRST_FRAME, strerror(errno)); return; }close(f);- /* the boot time to the desktop, from the kernel's start (CLOCK_BOOTTIME), for the logs and the- * results (docs/RESULTS.md) */+ /* the boot time to the screen, from the kernel's start (CLOCK_BOOTTIME), for the log, About and+ * the results (docs/RESULTS.md) */struct timespec bt;clock_gettime(CLOCK_BOOTTIME, &bt);- sd_log("first frame on the monitor %.3f s after the kernel started: the boot splash can go", bt.tv_sec + bt.tv_nsec / 1e9);+ double secs = bt.tv_sec + bt.tv_nsec / 1e9;+ const char *what = !has_monitor ? "none" : shown == 'u' ? "session" : "login"; /* autologin, login screen, no monitor */+ sd_log("first frame on the monitor %.3f s after the kernel started (LordOS %s%s%s, build %s, %s): the boot splash can go",+ secs, LORD_VERSION, LORD_CHANNEL[0] ? "-" : "", LORD_CHANNEL, LORD_BUILD, what);+ record_boot_time(secs, what);}/* No card with KMS (0.8.1): before this, the boot ended on a silent black screen. The message goesdiff --git a/server/src/remote/sessiond.h b/server/src/remote/sessiond.hindex 2f109c4..fe69ee4 100644--- a/server/src/remote/sessiond.h+++ b/server/src/remote/sessiond.h@@ -24,6 +24,7 @@#define SD_FIRST_FRAME SD_RUN_DIR "/first-frame"#define SD_GREETER_RUN SD_RUN_DIR "/greeter" /* XDG_RUNTIME_DIR of the login screen */#define SD_SESSION_CONF "/etc/lordos/session.conf" /* AUTOLOGIN=user (empty: login screen) */+#define SD_STATE_DIR "/var/lib/lordos" /* boot-times.jsonl (docs/SESSIONS.md, "Boot time") */#define SD_USERS_DIR "/var/lib/lordos/users" /* avatars: <user>.json and <user>.png */#define SD_GREETER_USER "lordos-greeter"#define RD_DEFAULT_PORT 5673 /* "LORD" on a phone keypad */diff --git a/server/src/ui/js_sys.c b/server/src/ui/js_sys.cindex 9329a81..9e17339 100644--- a/server/src/ui/js_sys.c+++ b/server/src/ui/js_sys.c@@ -230,6 +230,46 @@ void js_sys_cpu_name(char *out, size_t size) {free(txt);}+/* This boot's time to the first frame, from lord-sessiond's /var/lib/lordos/boot-times.jsonl (root's,+ * one JSON object a line, matched by this boot's id; docs/SESSIONS.md, "Boot time"). Read until found,+ * then kept: it doesn't change during a boot. -1 if there's none (no lord-sessiond, an old one). */+static double boot_secs = -1;+static char boot_shown[12];+static void boot_time_load(void) {+ if (boot_secs >= 0) return;+ char *id = read_small("/proc/sys/kernel/random/boot_id", 64, NULL);+ if (!id) return;+ id[strspn(id, "0123456789abcdef-")] = 0;+ struct stat st;+ int fd = open("/var/lib/lordos/boot-times.jsonl", O_RDONLY | O_CLOEXEC | O_NOFOLLOW);+ if (fd < 0 || fstat(fd, &st) || !S_ISREG(st.st_mode) || st.st_uid != 0 || (st.st_mode & 022) || st.st_size > 256 * 1024 || !id[0]) {+ if (fd >= 0) close(fd);+ free(id);+ return;+ }+ char *txt = malloc((size_t)st.st_size + 1);+ ssize_t n = txt ? read(fd, txt, (size_t)st.st_size) : -1;+ close(fd);+ if (n > 0) {+ txt[n] = 0;+ char key[64];+ snprintf(key, sizeof key, "{\"bootId\":\"%s\",", id);+ char *line = NULL;+ for (char *q = txt; (q = strstr(q, key)); q++) if (q == txt || q[-1] == '\n') line = q; /* the last one */+ char *sec = line ? strstr(line, "\"seconds\":") : NULL, *sh = line ? strstr(line, "\"shown\":\"") : NULL;+ char *eol = line ? strchr(line, '\n') : NULL;+ if (sec && (!eol || sec < eol)) {+ double v = atof(sec + 10);+ if (v > 0 && v < 3600) {+ boot_secs = v;+ if (sh && (!eol || sh < eol)) { sh += 9; size_t k = strspn(sh, "abcdefghijklmnopqrstuvwxyz"); if (k < sizeof boot_shown) { memcpy(boot_shown, sh, k); boot_shown[k] = 0; } }+ }+ }+ }+ free(txt);+ free(id);+}+static JSValue f_sys_info(JSContext *c, JSValueConst this_val, int argc, JSValueConst *argv) {(void)this_val; (void)argc; (void)argv;struct utsname u;@@ -264,6 +304,10 @@ static JSValue f_sys_info(JSContext *c, JSValueConst this_val, int argc, JSValueJS_SetPropertyStr(c, o, "memTotalKB", JS_NewFloat64(c, mem_total));JS_SetPropertyStr(c, o, "memAvailableKB", JS_NewFloat64(c, mem_avail));JS_SetPropertyStr(c, o, "uptime", JS_NewFloat64(c, uptime));+ /* this boot: seconds from the kernel's start to the first frame on the monitor, and what it showed */+ boot_time_load();+ JS_SetPropertyStr(c, o, "bootSeconds", JS_NewFloat64(c, boot_secs));+ JS_SetPropertyStr(c, o, "bootShown", JS_NewString(c, boot_shown));/* LordOS itself: package.json's version and channel ("beta"; empty for a stable release) and the build */JS_SetPropertyStr(c, o, "version", JS_NewString(c, LORD_VERSION));JS_SetPropertyStr(c, o, "channel", JS_NewString(c, LORD_CHANNEL));diff --git a/tools/results/collect.sh b/tools/results/collect.shindex b6c7530..2241963 100755--- a/tools/results/collect.sh+++ b/tools/results/collect.sh@@ -10,6 +10,7 @@# memory.txt whole system (`free -m`) and per process (PSS from /proc/<pid>/smaps_rollup); with# sudo, root's processes too# boot.txt systemd-analyze, and the time to the desktop's first frame from the kernel's start+# boot-times.jsonl every recorded boot on this machine: seconds to the first frame, version, kernel# README.md when, what version, the conditions to fill in, and these exact commands# The version is the installed one (software.lordos in the report); --version names it for a development# build, e.g. 0.8.5-dev.@@ -72,6 +73,8 @@ J() { if sudo -n true 2>/dev/null; then sudo -n journalctl "$@"; else journalctlJ -b -o short-monotonic --no-pager 2>/dev/null | awk '/kernel: Linux version/ && !k { print; k = 1 } /Started plymouth-start.service/ && !p { print; p = 1 }' |sed -E 's/^(\[[^]]*\]) [^ ]+ /\1 /' || true # without the host name: results are published} > "$D/boot.txt"+# every boot's time to the first frame on this machine, with its version (lord-sessiond; no names)+[ -r /var/lib/lordos/boot-times.jsonl ] && cp /var/lib/lordos/boot-times.jsonl "$D/boot-times.jsonl"cat > "$D/README.md" <<MD# $M — LordOS $V