Skip to content

armgit / PS5LM

Public Imported from GitHub
0

llama.cpp on a jailbroken PS5: run any GGUF model natively on the console, starting with Qwen 3.8

v0.4.0: USAGE and POWER cards, live speed during long replies

Abhiram761a54750b37
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a58c72..a848a89 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,24 @@ v0.1.x are the upstream payload releases by cobanov.
## [Unreleased]
+## [0.4.0] - 2026-10-10
+
+### Added
+- POWER card: the SoC's power (CPU, GPU and memory together), its history,
+ energy used this session and joules per generated token; expanded, min,
+ average and max, fan duty and every temperature sensor. The reading is
+ `sceKernelGetSocPowerConsumption`'s low 32 bits in milliwatts (22 W idle,
+ 86 W while the 27B generates), through ps5-exporter.
+- USAGE card: GPU and CPU on one chart; expanded, GPU, CPU, memory, storage
+ and the models on disk.
+
+### Changed
+- USAGE replaces the GPU and CPU tiles; THERMALS shows the hottest sensor.
+
+### Fixed
+- Speed and GPU use during a long reply: llama-server's counters move only
+ when a request ends, so the live figures come from the slot's token count.
+
## [0.3.0] - 2026-10-10
### Added
diff --git a/README.md b/README.md
index 1a6f04c..cf6a329 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ For comparison, the 27B on the CPU as a payload, streamed from disk, made about
</tr>
</table>
-- **Dashboard:** generation speed, how busy the GPU is, CPU use and clock, the memory pool and how the model, KV cache and the rest split it, context in use, storage, temperatures and fan, the loaded model (Cross for every argument it runs with), and load progress.
+- **Dashboard:** generation speed, GPU and CPU use (one USAGE card, Cross for the full view), SoC power with energy per token (POWER card, Cross for min/avg/max and every temperature sensor), the CPU clock, the memory pool and how the model, KV cache and the rest split it, context in use, storage, temperatures and fan, the loaded model (Cross for every argument it runs with), and load progress.
- **Pages on L1/R1:** Settings (load a model at launch, which one, the longest context, KV cache type, sounds; kept in `settings.json`) and Logs (`app.log` and `llama.log`, with an errors-only filter).
- **Sensors:** a title may not read the temperature and fan sensors, so the app carries [ps5-exporter](https://github.com/Marice/ps5-exporter) (Marice, GPL-3.0) and hands it to elfldr when it is not running. Without elfldr the THERMALS tile stays empty.
- **Model library:** every `.gguf` in `/data/PS5LM/models` and in `PS5LM/models` on a USB drive, in two sections. Cross loads or unloads. A model on USB loads straight from the drive.
diff --git a/docs/plans/README.md b/docs/plans/README.md
index 6fc2b2d..e3b9c27 100644
--- a/docs/plans/README.md
+++ b/docs/plans/README.md
@@ -6,10 +6,10 @@ and bumps the version in `ps5/app/version.hpp` with a CHANGELOG entry.
| Order | Branch | Plan | Version |
|---|---|---|---|
-| 1 | `feature/dashboard-pages` | [Dashboard pages](dashboard-pages.md): widgets, model details, Settings and Logs pages on L1/R1 | 0.3.0 |
-| 2 | `feature/cli-access` | [CLI access](cli-access.md): opencode, codex, Claude Code and others against the console | 0.4.0 |
-| 3 | `feature/chat-tools` | [Chat tools](chat-tools.md): tools, files, images in the browser chat; a scratch folder with a size warning | 0.5.0 |
-| 4 | `feature/model-market` | [Model market](model-market.md): search and download from Hugging Face, with fit shown | 0.6.0 |
+| 1 | `feature/dashboard-pages`, `feature/power-usage` | [Dashboard pages](dashboard-pages.md): widgets, model details, Settings and Logs pages on L1/R1; USAGE and POWER cards | 0.3.0, 0.4.0 (released) |
+| 2 | `feature/cli-access` | [CLI access](cli-access.md): opencode, codex, Claude Code and others against the console | 0.5.0 |
+| 3 | `feature/chat-tools` | [Chat tools](chat-tools.md): tools, files, images in the browser chat; a scratch folder with a size warning | 0.6.0 |
+| 4 | `feature/model-market` | [Model market](model-market.md): search and download from Hugging Face, with fit shown | 0.7.0 |
`main` is this fork's integration branch. Upstream pull requests go from a
branch cut from `cobanov/PS5LM:main` with only the commits meant for it.
diff --git a/ps5/app/dashboard.cpp b/ps5/app/dashboard.cpp
index 6e98f86..c8a3f41 100644
--- a/ps5/app/dashboard.cpp
+++ b/ps5/app/dashboard.cpp
@@ -51,7 +51,7 @@ constexpr float kLabelY = 46.0f, kLabelSize = 17.0f, kLift = 0.02f;
constexpr float kTau = 6.2831853f;
constexpr const char * kDash = "\xE2\x80\x94";
-enum Tile : int { kSpeed, kGpu, kCpu, kMemory, kContext, kStorage, kThermals, kModel };
+enum Tile : int { kSpeed, kUsage, kPower, kMemory, kContext, kStorage, kThermals, kModel };
struct TileSpec {
const char * label;
@@ -62,8 +62,8 @@ struct TileSpec {
// In reading order: ties in the navigation go to the earlier tile.
constexpr TileSpec kSpec[Dashboard::kTiles] = {
{ "GENERATION", 0, 0, 6, 2, 0x4fe0ff },
- { "GPU", 6, 0, 3, 2, 0x4fe0ff },
- { "CPU", 9, 0, 3, 2, 0xb8f26b },
+ { "USAGE", 6, 0, 3, 2, 0x4fe0ff },
+ { "POWER", 9, 0, 3, 2, 0xffd166 },
{ "MEMORY", 0, 2, 6, 1, 0xffc24a },
{ "CONTEXT", 0, 3, 3, 1, 0x8288f0 },
{ "STORAGE", 3, 3, 3, 1, 0xff6f9c },
@@ -272,7 +272,7 @@ void Dashboard::update(const hui::InputFrame & input, float dt, ui::Feedback & f
void Dashboard::update_dashboard(const hui::InputFrame & input, ui::Feedback & feedback) {
const int rows = (int) live_.models.size();
if (details_open_) {
- if (input.is_pressed(Action::north)) {
+ if (input.is_pressed(Action::north) && detail_tile_ == kModel) {
details_open_ = false;
open_library();
feedback.play(hui::audio::Cue::open);
@@ -337,6 +337,13 @@ void Dashboard::update_dashboard(const hui::InputFrame & input, ui::Feedback & f
refusal_y_ = input.nav == Direction::down ? 1.0f : input.nav == Direction::up ? -1.0f : 0.0f;
}
}
+ // USAGE and POWER expand on Cross.
+ if ((focus_ == kUsage || focus_ == kPower) && input.is_pressed(Action::confirm)) {
+ details_open_ = true;
+ detail_tile_ = focus_;
+ feedback.play(hui::audio::Cue::open);
+ return;
+ }
// The Model tile: Cross shows the loaded model's details (or the library
// when nothing is loaded), Triangle the library.
if (focus_ == kModel && input.is_pressed(Action::north)) {
@@ -347,6 +354,7 @@ void Dashboard::update_dashboard(const hui::InputFrame & input, ui::Feedback & f
open_library();
} else {
details_open_ = true;
+ detail_tile_ = kModel;
}
feedback.play(hui::audio::Cue::open);
}
@@ -698,22 +706,46 @@ void Dashboard::draw_content(gfx::DrawList & list, int tile, const Rect & r, flo
caps(list, f, "PROMPT", r.x + r.w - kPad - uw - pw - 26, r.y + 352, 15, kInk.with_alpha(kMuted), gfx::Align::right);
break;
}
- case kGpu: {
- const float gw = number(list, f, serving, "%.0f", L.gpu_busy * 100.0f * up, r.x + kPad, r.y + 118, 60, kInk);
- ui::text(list, f.regular, "% busy computing", r.x + kPad + gw + 10, r.y + 118, 22, kInk.with_alpha(kMuted));
- ui::text(list, f.regular, "PlayStation 5 GPU, Vulkan (RADV)", r.x + kPad, r.y + 152, 20, kInk.with_alpha(kFaint));
- history(list, L.gpu_history, { r.x + kPad, r.y + 196, r.w - 2 * kPad, 156 }, 1.0f, kCyan, t);
+ case kUsage: {
+ // The GPU and the CPU side by side over one chart: cyan the GPU,
+ // lime the app's CPUs.
+ const float half = (r.w - 2 * kPad) * 0.5f;
+ caps(list, f, "GPU", r.x + kPad, r.y + 86, 15, kCyan);
+ caps(list, f, "CPU", r.x + kPad + half, r.y + 86, 15, kLime);
+ float w = number(list, f, serving, "%.0f", L.gpu_busy * 100.0f * up, r.x + kPad, r.y + 140, 52, kInk);
+ ui::text(list, f.regular, "%", r.x + kPad + w + 6, r.y + 140, 22, kInk.with_alpha(kMuted));
+ w = number(list, f, true, "%.0f", L.cpu_use * 100.0f * up, r.x + kPad + half, r.y + 140, 52, kInk);
+ ui::text(list, f.regular, "%", r.x + kPad + half + w + 6, r.y + 140, 22, kInk.with_alpha(kMuted));
+ const Rect g{ r.x + kPad, r.y + 170, r.w - 2 * kPad, 110 };
+ history(list, L.cpu_history, g, 1.0f, kLime, t);
+ history(list, L.gpu_history, g, 1.0f, kCyan, t);
+ list.rounded_rect({ r.x + kPad, r.y + 300, r.w - 2 * kPad, 1 }, 0, kInk.with_alpha(0.1f));
+ caps(list, f, "CLOCK", r.x + kPad, r.y + 338, 15, kInk.with_alpha(kMuted));
+ std::snprintf(text, sizeof(text), "%d CPUs, %.1f GHz", L.cpus, L.cpu_ghz);
+ ui::text(list, f.mono, L.cpu_ghz > 0 ? text : kDash, r.x + r.w - kPad, r.y + 340, 22, kInk, gfx::Align::right);
break;
}
- case kCpu: {
- const float cw = number(list, f, true, "%.0f", L.cpu_use * 100.0f * up, r.x + kPad, r.y + 118, 60, kInk);
- std::snprintf(text, sizeof(text), "%% of %d CPUs", L.cpus);
- ui::text(list, f.regular, text, r.x + kPad + cw + 10, r.y + 118, 22, kInk.with_alpha(kMuted));
- ui::text(list, f.regular, "Zen 2, the app's share", r.x + kPad, r.y + 152, 20, kInk.with_alpha(kFaint));
- history(list, L.cpu_history, { r.x + kPad, r.y + 186, r.w - 2 * kPad, 90 }, 1.0f, kLime, t);
+ case kPower: {
+ const bool known = L.soc_power_w > 0;
+ const float pw = number(list, f, known, "%.0f", L.soc_power_w * up, r.x + kPad, r.y + 118, 60, kInk);
+ ui::text(list, f.regular, "W, the SoC", r.x + kPad + pw + 10, r.y + 118, 22, kInk.with_alpha(kMuted));
+ if (known && L.state == ServerState::generating && L.gen_tps > 0) {
+ std::snprintf(text, sizeof(text), "%.1f J per token", L.soc_power_w / L.gen_tps);
+ } else if (known) {
+ std::snprintf(text, sizeof(text), "CPU, GPU and memory together");
+ } else {
+ std::snprintf(text, sizeof(text), "Load ps5-exporter to read it");
+ }
+ ui::text(list, f.regular, text, r.x + kPad, r.y + 152, 20, kInk.with_alpha(kFaint));
+ float peak = 60;
+ for (float v : L.power_history) {
+ peak = std::max(peak, v);
+ }
+ history(list, L.power_history, { r.x + kPad, r.y + 186, r.w - 2 * kPad, 90 }, peak * 1.15f,
+ Color::rgb(0xffd166), t);
list.rounded_rect({ r.x + kPad, r.y + 300, r.w - 2 * kPad, 1 }, 0, kInk.with_alpha(0.1f));
- caps(list, f, "CLOCK", r.x + kPad, r.y + 338, 15, kInk.with_alpha(kMuted));
- number(list, f, L.cpu_ghz > 0, "%.1f GHz", L.cpu_ghz, r.x + r.w - kPad, r.y + 340, 24, kInk, gfx::Align::right);
+ caps(list, f, "THIS SESSION", r.x + kPad, r.y + 338, 15, kInk.with_alpha(kMuted));
+ number(list, f, L.energy_wh > 0, "%.2f Wh", L.energy_wh, r.x + r.w - kPad, r.y + 340, 22, kInk, gfx::Align::right);
break;
}
case kMemory: {
@@ -813,9 +845,19 @@ void Dashboard::draw_content(gfx::DrawList & list, int tile, const Rect & r, flo
ui::text(list, f.regular, text, r.x + kPad, r.y + 152, 20, kInk.with_alpha(kFaint));
history(list, L.temp_history, { r.x + kPad, r.y + 186, r.w - 2 * kPad, 90 }, 100.0f, kHeat, t);
list.rounded_rect({ r.x + kPad, r.y + 300, r.w - 2 * kPad, 1 }, 0, kInk.with_alpha(0.1f));
- caps(list, f, "SOC POWER", r.x + kPad, r.y + 338, 15, kInk.with_alpha(kMuted));
- number(list, f, L.soc_power_w > 0, "%.0f W", L.soc_power_w, r.x + r.w - kPad, r.y + 340, 24, kInk,
- gfx::Align::right);
+ // The hottest sensor, so a hot spot shows without opening POWER.
+ const std::pair<std::string, float> * hot = nullptr;
+ for (const auto & tp : L.temps) {
+ if (!hot || tp.second > hot->second) {
+ hot = &tp;
+ }
+ }
+ caps(list, f, "HOTTEST", r.x + kPad, r.y + 338, 15, kInk.with_alpha(kMuted));
+ if (hot) {
+ const std::string who = hot->first == "cpu" ? std::string("CPU") : "SoC " + hot->first.substr(3);
+ std::snprintf(text, sizeof(text), "%s, %.0f \xC2\xB0" "C", who.c_str(), hot->second);
+ }
+ ui::text(list, f.mono, hot ? text : kDash, r.x + r.w - kPad, r.y + 340, 22, kInk, gfx::Align::right);
break;
}
default: { // kModel
@@ -1046,6 +1088,16 @@ void Dashboard::draw_details(gfx::DrawList & list, std::uint32_t glass) const {
if (glass) {
list.glass(glass, panel, 40, Color::rgb(0xffffff));
}
+ if (detail_tile_ == kUsage || detail_tile_ == kPower) {
+ draw_panel(list, panel, 40, 1.0f, accent_of(detail_tile_));
+ if (detail_tile_ == kUsage) {
+ draw_usage_details(list, panel);
+ } else {
+ draw_power_details(list, panel);
+ }
+ list.pop_opacity();
+ return;
+ }
draw_panel(list, panel, 40, 1.0f, kLime);
caps(list, f, "LOADED MODEL", panel.x + 56, panel.y + 60, 20, kLime);
ui::text(list, f.semibold, f.semibold.font->fit(L.preset.empty() ? L.model_label : L.preset, 40, panel.w - 112),
@@ -1089,6 +1141,143 @@ void Dashboard::draw_details(gfx::DrawList & list, std::uint32_t glass) const {
list.pop_opacity();
}
+// Everything the console is doing, one section each.
+void Dashboard::draw_usage_details(gfx::DrawList & list, const Rect & panel) const {
+ const ui::Fonts & f = fonts_;
+ const Live & L = live_;
+ const bool serving = L.state == ServerState::ready || L.state == ServerState::generating;
+ char text[96];
+ caps(list, f, "USAGE", panel.x + 56, panel.y + 60, 20, kCyan);
+ ui::text(list, f.regular, "What the console is doing for PS5LM, over the last two minutes.", panel.x + 56,
+ panel.y + 96, 20, kInk.with_alpha(kMuted));
+
+ const float x0 = panel.x + 56, colw = (panel.w - 112 - 48) * 0.5f, x1 = x0 + colw + 48;
+ // GPU and CPU, each with its chart.
+ const struct {
+ const char * name;
+ Color c;
+ float now;
+ bool known;
+ const std::vector<float> * hist;
+ std::string sub;
+ float x;
+ } parts[2] = {
+ { "GPU", kCyan, L.gpu_busy, serving, &L.gpu_history,
+ "Vulkan (RADV), " + gib(L.model_gib + L.kv_gib) + " GiB on it", x0 },
+ { "CPU", kLime, L.cpu_use, true, &L.cpu_history,
+ std::to_string(L.cpus) + " CPUs" + (L.cpu_ghz > 0 ? ", " + gib(L.cpu_ghz) + " GHz" : std::string()) +
+ ", heap " + gib(L.heap_gib) + " GiB",
+ x1 },
+ };
+ for (const auto & p : parts) {
+ caps(list, f, p.name, p.x, panel.y + 160, 16, p.c);
+ const float w = number(list, f, p.known, "%.0f", p.now * 100.0f, p.x, panel.y + 222, 56, kInk);
+ ui::text(list, f.regular, "% busy", p.x + w + 10, panel.y + 222, 22, kInk.with_alpha(kMuted));
+ ui::text(list, f.regular, f.regular.font->fit(p.sub, 20, colw), p.x, panel.y + 256, 20, kInk.with_alpha(kFaint));
+ history(list, *p.hist, { p.x, panel.y + 280, colw, 150 }, 1.0f, p.c, 10.0f);
+ }
+
+ // Memory and storage.
+ list.rounded_rect({ x0, panel.y + 470, panel.w - 112, 1 }, 0, kInk.with_alpha(0.1f));
+ caps(list, f, "MEMORY", x0, panel.y + 514, 16, kAmber);
+ const double used = std::max(0.0, L.pool_gib - L.free_gib);
+ std::snprintf(text, sizeof(text), "%s of %s GiB, GPU and CPU", gib(used).c_str(), gib(L.pool_gib).c_str());
+ ui::text(list, f.mono, text, x0 + colw, panel.y + 514, 20, kInk, gfx::Align::right);
+ bar(list, { x0, panel.y + 534, colw, 12 }, L.pool_gib > 0 ? (float) (used / L.pool_gib) : 0.0f, kAmber);
+
+ caps(list, f, "STORAGE", x1, panel.y + 514, 16, kRose);
+ const struct {
+ const char * name;
+ double free, total;
+ } drives[2] = { { "Internal", L.data_free, L.data_total }, { "USB", L.usb_free, L.usb_total } };
+ for (int k = 0; k < 2; ++k) {
+ const float y = panel.y + 570 + k * 70.0f;
+ ui::text(list, f.regular, drives[k].name, x1, y, 20, kInk.with_alpha(0.85f));
+ if (drives[k].total <= 0) {
+ ui::text(list, f.regular, "No drive", x1 + colw, y, 20, kInk.with_alpha(kFaint), gfx::Align::right);
+ continue;
+ }
+ std::snprintf(text, sizeof(text), "%.0f of %.0f GiB free", drives[k].free, drives[k].total);
+ ui::text(list, f.mono, text, x1 + colw, y, 20, kInk, gfx::Align::right);
+ bar(list, { x1, y + 16, colw, 10 }, (float) ((drives[k].total - drives[k].free) / drives[k].total), kRose);
+ }
+ caps(list, f, "MODELS", x0, panel.y + 610, 16, kInk.with_alpha(kMuted));
+ double on_disk = 0;
+ for (const auto & m : L.models) {
+ on_disk += m.size_gib;
+ }
+ std::snprintf(text, sizeof(text), "%zu found, %s GiB", L.models.size(), gib(on_disk).c_str());
+ ui::text(list, f.mono, text, x0 + colw, panel.y + 610, 20, kInk, gfx::Align::right);
+}
+
+// The SoC's power, the energy it took, and every temperature it reports.
+void Dashboard::draw_power_details(gfx::DrawList & list, const Rect & panel) const {
+ const ui::Fonts & f = fonts_;
+ const Live & L = live_;
+ const Color kGold = Color::rgb(0xffd166);
+ char text[96];
+ caps(list, f, "POWER", panel.x + 56, panel.y + 60, 20, kGold);
+ ui::text(list, f.regular, "The SoC's own reading: CPU, GPU and memory together.", panel.x + 56, panel.y + 96, 20,
+ kInk.with_alpha(kMuted));
+
+ const float x0 = panel.x + 56, lw = 640, x1 = x0 + lw + 64, rw = panel.x + panel.w - 56 - x1;
+ const float w = number(list, f, L.soc_power_w > 0, "%.0f", L.soc_power_w, x0, panel.y + 200, 72, kInk);
+ ui::text(list, f.regular, "W now", x0 + w + 12, panel.y + 200, 24, kInk.with_alpha(kMuted));
+ float mn = 1e9f, mx = 0, sum = 0;
+ for (float v : L.power_history) {
+ mn = std::min(mn, v);
+ mx = std::max(mx, v);
+ sum += v;
+ }
+ const size_t n = L.power_history.size();
+ history(list, L.power_history, { x0, panel.y + 236, lw, 200 }, std::max(60.0f, mx * 1.15f), kGold, 10.0f);
+ const char * names[3] = { "MIN", "AVG", "MAX" };
+ const float vals[3] = { n ? mn : 0, n ? sum / (float) n : 0, mx };
+ for (int k = 0; k < 3; ++k) {
+ const float x = x0 + k * 190.0f;
+ caps(list, f, names[k], x, panel.y + 486, 15, kInk.with_alpha(kMuted));
+ number(list, f, n > 0, "%.0f W", vals[k], x + 56, panel.y + 488, 24, kInk);
+ }
+ const struct {
+ const char * name;
+ std::string value;
+ } rows[3] = {
+ { "THIS SESSION", [&] { char t[24]; std::snprintf(t, sizeof(t), "%.2f Wh", L.energy_wh); return std::string(t); }() },
+ { "PER TOKEN", L.gen_tps > 0 && L.soc_power_w > 0 ? gib(L.soc_power_w / L.gen_tps) + " J while generating"
+ : std::string(kDash) },
+ { "FAN", L.fan >= 0 ? std::to_string((int) (L.fan * 100.0f + 0.5f)) + "% duty" : std::string(kDash) },
+ };
+ for (int k = 0; k < 3; ++k) {
+ const float y = panel.y + 556 + k * 50.0f;
+ caps(list, f, rows[k].name, x0, y, 15, kInk.with_alpha(kMuted));
+ ui::text(list, f.mono, rows[k].value, x0 + lw, y + 2, 22, kInk, gfx::Align::right);
+ }
+
+ // Every sensor, hottest first by bar length.
+ list.rounded_rect({ x1 - 32, panel.y + 150, 1, panel.h - 220 }, 0, kInk.with_alpha(0.1f));
+ caps(list, f, "TEMPERATURES", x1, panel.y + 160, 15, kHeat);
+ if (L.temps.empty()) {
+ ui::text(list, f.regular, "No sensor answered", x1, panel.y + 200, 20, kInk.with_alpha(kFaint));
+ }
+ for (size_t k = 0; k < L.temps.size() && k < 12; ++k) {
+ const float y = panel.y + 204 + (float) k * 40.0f;
+ std::string name = L.temps[k].first;
+ if (name == "cpu") {
+ name = "CPU";
+ } else {
+ name = "SoC " + name.substr(3);
+ }
+ ui::text(list, f.regular, name, x1, y, 20, kInk.with_alpha(0.85f));
+ std::snprintf(text, sizeof(text), "%.0f \xC2\xB0" "C", L.temps[k].second);
+ ui::text(list, f.mono, text, x1 + rw, y, 20, kInk, gfx::Align::right);
+ bar(list, { x1 + 90, y - 8, rw - 180, 6 }, L.temps[k].second / 100.0f, kHeat);
+ }
+ ui::paragraph(list, f.regular,
+ "The console reports the SoC's total only. CPU and GPU power apart, and voltages, are not available to "
+ "homebrew.",
+ x0, panel.y + panel.h - 52, 17, panel.w - 112, 24, kInk.with_alpha(kFaint), 2);
+}
+
void Dashboard::draw_settings(gfx::DrawList & list) const {
const ui::Fonts & f = fonts_;
const SettingCategory & c = kCategories[setting_category_];
@@ -1233,7 +1422,8 @@ void Dashboard::draw_hints(DashboardFrame & frame) const {
ui::draw_hints(frame.overlay, fonts_, style, hints, 3, kGridX + kGridW, true);
} else if (details_.value > 0.5f) {
const ui::Hint hints[] = { { ui::Button::triangle, "Library" }, { ui::Button::circle, "Back" } };
- ui::draw_hints(frame.overlay, fonts_, style, hints, 2, kGridX + kGridW, true);
+ const bool model = detail_tile_ == kModel;
+ ui::draw_hints(frame.overlay, fonts_, style, model ? hints : hints + 1, model ? 2 : 1, kGridX + kGridW, true);
} else if (page_ == 1) {
const bool toggle = in_rows_ && is_toggle(kCategories[setting_category_].rows[setting_row_].id);
if (!in_rows_) {
@@ -1259,8 +1449,9 @@ void Dashboard::draw_hints(DashboardFrame & frame) const {
{ ui::Button::triangle, "Library" } };
ui::draw_hints(frame.scene, fonts_, style, hints, loaded ? 3 : 2, kGridX + kGridW, true);
} else {
- const ui::Hint hints[] = { { ui::Button::dpad, "Move" } };
- ui::draw_hints(frame.scene, fonts_, style, hints, 1, kGridX + kGridW, true);
+ const ui::Hint hints[] = { { ui::Button::dpad, "Move" }, { ui::Button::cross, "Expand" } };
+ const bool expands = focus_ == kUsage || focus_ == kPower;
+ ui::draw_hints(frame.scene, fonts_, style, hints, expands ? 2 : 1, kGridX + kGridW, true);
}
}
diff --git a/ps5/app/dashboard.hpp b/ps5/app/dashboard.hpp
index ceb005e..53ed515 100644
--- a/ps5/app/dashboard.hpp
+++ b/ps5/app/dashboard.hpp
@@ -72,6 +72,8 @@ class Dashboard {
void draw_hints(DashboardFrame & frame) const;
void draw_tabs(hui::gfx::DrawList & list) const;
void draw_details(hui::gfx::DrawList & list, std::uint32_t glass) const;
+ void draw_usage_details(hui::gfx::DrawList & list, const hui::gfx::Rect & panel) const;
+ void draw_power_details(hui::gfx::DrawList & list, const hui::gfx::Rect & panel) const;
void draw_settings(hui::gfx::DrawList & list) const;
void draw_logs(hui::gfx::DrawList & list) const;
void update_dashboard(const hui::InputFrame & input, hui::ui::Feedback & feedback);
@@ -101,6 +103,7 @@ class Dashboard {
int slot(int row) const; // a model row's line in the list, after the section headers
bool details_open_ = false;
+ int detail_tile_ = 0; // which tile the open details belong to
hui::tween::Spring details_; // 0 closed, 1 open
int page_ = 0;
diff --git a/ps5/app/preview_main.cpp b/ps5/app/preview_main.cpp
index ae290c8..3f521f8 100644
--- a/ps5/app/preview_main.cpp
+++ b/ps5/app/preview_main.cpp
@@ -72,7 +72,11 @@ ps5lm::Live sample(float seconds, bool generating) {
"--min-p", "0", "--metrics" };
L.soc_temp = 61;
L.cpu_temp = 54;
- L.soc_power_w = 118;
+ L.soc_power_w = 86;
+ L.energy_wh = 0.42;
+ L.fan = 0.23f;
+ L.temps = { { "cpu", 54 }, { "soc0", 61 }, { "soc1", 60 }, { "soc2", 59 }, { "soc3", 62 }, { "soc4", 61 },
+ { "soc5", 60 }, { "soc6", 58 } };
L.cpu_ghz = 3.5f;
L.data_free = 412;
L.data_total = 825;
@@ -95,6 +99,7 @@ ps5lm::Live sample(float seconds, bool generating) {
L.gpu_history.push_back(on ? 0.92f + 0.05f * std::sin(i * 0.3f) : 0.03f);
L.cpu_history.push_back(on ? 0.11f + 0.03f * std::sin(i * 0.5f) : 0.02f);
L.temp_history.push_back(on ? 60.0f + 2.0f * std::sin(i * 0.2f) : 52.0f);
+ L.power_history.push_back(on ? 85.0f + 1.5f * std::sin(i * 0.4f) : 23.0f);
}
L.gen_tps = generating ? 20.7f : 0.0f;
L.gpu_busy = generating ? 0.94f : 0.02f;
@@ -246,9 +251,15 @@ int main(int argc, char ** argv) {
g_loading = -1;
step(120, {}, true);
shot("01-dashboard");
- // To the Model tile: right twice along the top, then down.
+ // USAGE, POWER, then down to the Model tile.
step(20, nav(hui::Direction::right), true);
+ step(40, press(hui::Action::confirm), true);
+ shot("02a-usage");
+ step(30, press(hui::Action::back), true);
step(20, nav(hui::Direction::right), true);
+ step(40, press(hui::Action::confirm), true);
+ shot("02b-power");
+ step(30, press(hui::Action::back), true);
step(40, nav(hui::Direction::down), false);
shot("02-model-focus");
step(60, press(hui::Action::confirm), false);
diff --git a/ps5/app/stats.cpp b/ps5/app/stats.cpp
index 99c4560..a4d1b25 100644
--- a/ps5/app/stats.cpp
+++ b/ps5/app/stats.cpp
@@ -42,6 +42,12 @@ void push(std::vector<float> & v, float x) {
}
}
+// sceKernelGetSocPowerConsumption's first word: milliwatts in the low half.
+float soc_watts(uint64_t raw) {
+ const uint64_t mw = raw & 0xffffffffu;
+ return mw >= 1000 && mw <= 350000 ? (float) (mw / 1000.0) : 0.0f;
+}
+
// Free and total GiB of the filesystem holding `path`, or zeros.
void space(const char * path, double * free, double * total) {
struct statvfs v = {};
@@ -230,7 +236,7 @@ void StatsCollector::run() {
double last_wall = start, last_cpu = cpu_seconds();
double last_busy = 0, last_tokens = 0, last_gen_s = 0;
bool have_last = false, last_working = false;
- double last_ptok = 0, last_psec = 0;
+ double last_ptok = 0, last_psec = 0, last_decoded = 0;
for (;;) {
std::this_thread::sleep_for(std::chrono::seconds(1));
const double wall = now_s(), cpu = cpu_seconds();
@@ -268,11 +274,12 @@ void StatsCollector::run() {
if (sceKernelGetCpuTemperature(&t) == 0 && t > -100 && t < 200) {
cpu_t = (float) t;
}
- // The unit is not documented; milliwatts is the community reading,
- // so only plausible values are shown.
+ // Milliwatts in the low 32 bits; the high half counts slowly (a
+ // sample number). Measured on the console: 22 W idle, 86 W while the
+ // 27B generates.
uint64_t raw[16] = {};
- if (sceKernelGetSocPowerConsumption(raw, 0.0) == 0 && raw[0] >= 1000 && raw[0] <= 350000) {
- watts = (float) (raw[0] / 1000.0);
+ if (sceKernelGetSocPowerConsumption(raw, 0.0) == 0) {
+ watts = soc_watts(raw[0]);
}
const long hz = sceKernelGetCpuFrequency();
ghz = hz > 0 ? (float) (hz / 1e9) : 0.0f;
@@ -289,6 +296,7 @@ void StatsCollector::run() {
// Marice/ps5-exporter, when loaded, serves them on port 9100.
float fan = -1;
bool from_exporter = false;
+ std::vector<std::pair<std::string, float>> temps;
if (soc_t < -100) {
std::string p = http_get(9100, "/metrics");
// Not running: hand the bundled copy to elfldr, at start and then
@@ -302,7 +310,14 @@ void StatsCollector::run() {
from_exporter = true;
soc_t = (float) sample(p, "ps5_temperature_celsius{sensor=\"soc0\"}", -1000);
cpu_t = (float) sample(p, "ps5_temperature_celsius{sensor=\"cpu\"}", -1000);
- watts = (float) sample(p, "ps5_soc_power_watts", 0);
+ watts = soc_watts((uint64_t) sample(p, "ps5_soc_power_raw_value", 0));
+ for (int k = -1; k < 16; ++k) {
+ const std::string name = k < 0 ? std::string("cpu") : "soc" + std::to_string(k);
+ const double t = sample(p, "ps5_temperature_celsius{sensor=\"" + name + "\"}", -1000);
+ if (t > -100) {
+ temps.emplace_back(name, (float) t);
+ }
+ }
fan = (float) sample(p, "ps5_fan_duty_ratio", -1);
if (ghz <= 0) {
ghz = (float) (sample(p, "ps5_cpu_frequency_hertz", 0) / 1e9);
@@ -324,6 +339,11 @@ void StatsCollector::run() {
live_.soc_power_w = watts;
live_.cpu_ghz = ghz;
live_.fan = fan;
+ live_.temps = temps;
+ if (watts > 0) {
+ push(live_.power_history, watts);
+ live_.energy_wh += watts * dt / 3600.0;
+ }
live_.sensors_from_exporter = from_exporter;
if (soc_t > -100) {
push(live_.temp_history, soc_t);
@@ -368,6 +388,14 @@ void StatsCollector::run() {
live_.gen_tps = dgen > 0.05 ? (float) ((tokens - last_tokens) / dgen) : 0.0f;
}
live_.ctx_used = (uint32_t) (json_int(slots, "n_prompt_tokens") + json_int(slots, "n_decoded"));
+ // The server's counters move only when a request ends, so during a
+ // long reply the speed comes from the slot's decoded count.
+ const double decoded = (double) json_int(slots, "n_decoded");
+ if (working && have_last && decoded > last_decoded && dt > 0) {
+ live_.gen_tps = (float) ((decoded - last_decoded) / dt);
+ live_.gpu_busy = 1.0f; // ponytail: a decoding slot keeps the GPU busy; no finer reading mid-request
+ }
+ last_decoded = working ? decoded : 0;
have_last = true;
last_busy = busy_s;
last_tokens = tokens;
diff --git a/ps5/app/stats.hpp b/ps5/app/stats.hpp
index fd13e60..c73690b 100644
--- a/ps5/app/stats.hpp
+++ b/ps5/app/stats.hpp
@@ -13,6 +13,7 @@
#include <cstdint>
#include <mutex>
#include <string>
+#include <utility>
#include <vector>
namespace ps5lm {
@@ -68,6 +69,9 @@ struct Live {
float fan = -1; // fan duty 0..1, below 0 when unread
bool sensors_from_exporter = false; // read from ps5-exporter, not the kernel
std::vector<float> temp_history; // SoC degrees C per second
+ std::vector<float> power_history; // SoC watts per second
+ double energy_wh = 0; // SoC energy since the app started
+ std::vector<std::pair<std::string, float>> temps; // every sensor that answered ("cpu", "soc0", ...)
// Storage, GiB; usb_total 0 when no drive is mounted.
double data_free = 0, data_total = 0;
diff --git a/ps5/app/version.hpp b/ps5/app/version.hpp
index 7d0d863..c18d348 100644
--- a/ps5/app/version.hpp
+++ b/ps5/app/version.hpp
@@ -4,4 +4,4 @@
// The app's version, semver. The one place it is set: scripts read it from
// here (scripts/release-app.sh), and git tags are v<this>. Bump it with an
// entry in CHANGELOG.md.
-#define PS5LM_VERSION "0.3.0"
+#define PS5LM_VERSION "0.4.0"