Add mostly final ags config
This commit is contained in:
parent
c310042564
commit
bce65f6835
23 changed files with 999 additions and 156 deletions
|
@ -0,0 +1,43 @@
|
|||
class GPUService extends Service {
|
||||
static {
|
||||
Service.register(
|
||||
this,
|
||||
{},
|
||||
{ "current-usage": ["float", "r"], temperature: ["float", "r"] },
|
||||
);
|
||||
}
|
||||
|
||||
#currentUsage = 0;
|
||||
#temperature = 0;
|
||||
|
||||
get current_usage() {
|
||||
return this.#currentUsage;
|
||||
}
|
||||
|
||||
get temperature() {
|
||||
return this.#temperature;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.#update();
|
||||
const interval = setInterval(() => {
|
||||
this.#update();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
#update() {
|
||||
this.#currentUsage = Utils.exec(
|
||||
"sh -c 'cat /sys/class/drm/card?/device/gpu_busy_percent'",
|
||||
);
|
||||
this.#temperature =
|
||||
Utils.exec(
|
||||
"sh -c 'cat /sys/class/drm/card?/device/hwmon/hwmon?/temp1_input'",
|
||||
) / 1000;
|
||||
this.changed("current-usage");
|
||||
this.changed("temperature");
|
||||
}
|
||||
}
|
||||
|
||||
const gpu = new GPUService();
|
||||
export default gpu;
|
Loading…
Add table
Add a link
Reference in a new issue