diff --git a/lib/data/model/app/shell_func.dart b/lib/data/model/app/shell_func.dart index 6c737fb28..1fcf383ba 100644 --- a/lib/data/model/app/shell_func.dart +++ b/lib/data/model/app/shell_func.dart @@ -33,7 +33,8 @@ enum ShellFunc { /// Issue #168 /// Use `sh` for compatibility - static final installShellCmd = """ + static final installShellCmd = + """ mkdir -p $_homeVar/$_srvBoxDir cat << 'EOF' > $_installShellPath ${ShellFunc.allScript} @@ -134,7 +135,8 @@ fi'''; static final String allScript = () { final sb = StringBuffer(); - sb.write(''' + sb.write( + ''' #!/bin/sh # Script for ServerBox app v1.0.${BuildData.build} # DO NOT delete this file while app is running @@ -153,7 +155,8 @@ userId=\$(id -u) '''); // Write each func for (final func in values) { - sb.write(''' + sb.write( + ''' ${func.name}() { ${func._cmd.split('\n').map((e) => '\t$e').join('\n')} } @@ -199,7 +202,9 @@ enum StatusCmdType { tempType, tempVal, host, - diskio; + diskio, + nvdia, + ; } /// Cmds for linux server @@ -217,6 +222,7 @@ const _statusCmds = [ 'cat /sys/class/thermal/thermal_zone*/temp', 'hostname', 'cat /proc/diskstats', + 'nvidia-smi -q -x', ]; enum DockerCmdType { diff --git a/lib/data/model/server/nvdia.dart b/lib/data/model/server/nvdia.dart new file mode 100644 index 000000000..5b599649a --- /dev/null +++ b/lib/data/model/server/nvdia.dart @@ -0,0 +1,132 @@ +import 'package:xml/xml.dart'; + +/// [ +/// { +/// "name": "GeForce RTX 3090", +/// "temp": 40, +/// "power": "30W / 350W", +/// "memory": { +/// "total": 24268, +/// "used": 240, +/// "unit": "MiB", +/// "processes": [ +/// { +/// "pid": 1456, +/// "name": "/usr/lib/xorg/Xorg", +/// "memory": 40 +/// }, +/// ] +/// }, +/// } +/// ] +/// + +class NvdiaSmi { + static List fromXml(String raw) { + final xmlData = XmlDocument.parse(raw); + final gpus = xmlData.findAllElements('gpu'); + final result = List.generate(gpus.length, (index) { + final gpu = gpus.elementAt(index); + final name = gpu.findElements('product_name').firstOrNull?.innerText; + final temp = gpu + .findElements('temperature') + .firstOrNull + ?.findElements('gpu_temp') + .firstOrNull + ?.innerText; + final power = gpu.findElements('gpu_power_readings').firstOrNull; + final powerDraw = + power?.findElements('power_draw').firstOrNull?.innerText; + final powerLimit = + power?.findElements('current_power_limit').firstOrNull?.innerText; + final memory = gpu.findElements('fb_memory_usage').firstOrNull; + final memoryUsed = memory?.findElements('used').firstOrNull?.innerText; + final memoryTotal = memory?.findElements('total').firstOrNull?.innerText; + final processes = gpu + .findElements('processes') + .firstOrNull + ?.findElements('process_info'); + final memoryProcesses = + List.generate(processes?.length ?? 0, (index) { + final process = processes?.elementAt(index); + final pid = process?.findElements('pid').firstOrNull?.innerText; + final name = + process?.findElements('process_name').firstOrNull?.innerText; + final memory = + process?.findElements('used_memory').firstOrNull?.innerText; + if (pid != null && name != null && memory != null) { + return NvdiaSmiMemProcess( + int.parse(pid), + name, + int.parse( + memory.split(' ').firstOrNull ?? '0', + ), + ); + } + return null; + }); + memoryProcesses.removeWhere((element) => element == null); + if (name != null && + temp != null && + powerDraw != null && + powerLimit != null && + memory != null) { + return NvdiaSmiItem( + name, + int.parse(temp.split(' ').firstOrNull ?? '0'), + '$powerDraw / $powerLimit', + NvdiaSmiMem( + int.parse(memoryTotal?.split(' ').firstOrNull ?? '0'), + int.parse(memoryUsed?.split(' ').firstOrNull ?? '0'), + 'MiB', + List.from(memoryProcesses), + ), + ); + } + return null; + }); + result.removeWhere((element) => element == null); + return List.from(result); + } +} + +class NvdiaSmiItem { + final String name; + final int temp; + final String power; + final NvdiaSmiMem memory; + + const NvdiaSmiItem(this.name, this.temp, this.power, this.memory); + + @override + String toString() { + return 'NvdiaSmiItem{name: $name, temp: $temp, power: $power, memory: $memory}'; + } +} + +class NvdiaSmiMem { + final int total; + final int used; + final String unit; + final List processes; + + const NvdiaSmiMem(this.total, this.used, this.unit, this.processes); + + @override + String toString() { + return 'NvdiaSmiMem{total: $total, used: $used, unit: $unit, processes: $processes}'; + } +} + +class NvdiaSmiMemProcess { + final int pid; + final String name; + final int memory; + + const NvdiaSmiMemProcess(this.pid, this.name, this.memory); + + @override + String toString() { + return 'NvdiaSmiMemProcess{pid: $pid, name: $name, memory: $memory}'; + } +} diff --git a/lib/data/model/server/server.dart b/lib/data/model/server/server.dart index a18b249f7..312a29b59 100644 --- a/lib/data/model/server/server.dart +++ b/lib/data/model/server/server.dart @@ -4,6 +4,7 @@ import 'package:toolbox/data/model/server/cpu.dart'; import 'package:toolbox/data/model/server/disk.dart'; import 'package:toolbox/data/model/server/memory.dart'; import 'package:toolbox/data/model/server/net_speed.dart'; +import 'package:toolbox/data/model/server/nvdia.dart'; import 'package:toolbox/data/model/server/server_private_info.dart'; import 'package:toolbox/data/model/server/system.dart'; import 'package:toolbox/data/model/server/temp.dart'; @@ -55,6 +56,7 @@ class ServerStatus { SystemType system; String? err; DiskIO diskIO; + List? nvdia; /// Whether is connectting, parsing and etc. bool _isBusy = false; @@ -72,6 +74,7 @@ class ServerStatus { required this.system, required this.diskIO, this.err, + this.nvdia, }); } diff --git a/lib/data/model/server/server_status_update_req.dart b/lib/data/model/server/server_status_update_req.dart index 599531081..242541ad5 100644 --- a/lib/data/model/server/server_status_update_req.dart +++ b/lib/data/model/server/server_status_update_req.dart @@ -1,3 +1,4 @@ +import 'package:toolbox/data/model/server/nvdia.dart'; import 'package:toolbox/data/model/server/server.dart'; import 'package:toolbox/data/model/server/system.dart'; import 'package:toolbox/data/res/logger.dart'; @@ -110,6 +111,13 @@ Future _getLinuxStatus(ServerStatusUpdateReq req) async { } catch (e, s) { Loggers.parse.warning(e, s); } + + try { + final nvdia = NvdiaSmi.fromXml(StatusCmdType.nvdia.find(segments)); + req.ss.nvdia = nvdia; + } catch (e, s) { + Loggers.parse.warning(e, s); + } return req.ss; } diff --git a/lib/data/res/default.dart b/lib/data/res/default.dart index 450d2ffa7..044de65ca 100644 --- a/lib/data/res/default.dart +++ b/lib/data/res/default.dart @@ -11,6 +11,7 @@ class Defaults { 'cpu', 'mem', 'swap', + 'gpu', 'disk', 'net', 'temp' diff --git a/lib/view/page/server/detail.dart b/lib/view/page/server/detail.dart index ca56e018e..2ca91b10f 100644 --- a/lib/view/page/server/detail.dart +++ b/lib/view/page/server/detail.dart @@ -1,11 +1,13 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:toolbox/core/extension/context/common.dart'; +import 'package:toolbox/core/extension/context/dialog.dart'; import 'package:toolbox/core/extension/context/locale.dart'; import 'package:toolbox/core/extension/order.dart'; import 'package:toolbox/data/model/server/cpu.dart'; import 'package:toolbox/data/model/server/disk.dart'; import 'package:toolbox/data/model/server/net_speed.dart'; +import 'package:toolbox/data/model/server/nvdia.dart'; import 'package:toolbox/data/model/server/server_private_info.dart'; import 'package:toolbox/data/model/server/system.dart'; import 'package:toolbox/data/res/store.dart'; @@ -45,6 +47,7 @@ class _ServerDetailPageState extends State _buildCPUView, _buildMemView, _buildSwapView, + _buildGpuView, _buildDiskView, _buildNetView, _buildTemperature, @@ -302,6 +305,114 @@ class _ServerDetailPageState extends State ); } + Widget _buildGpuView(ServerStatus ss) { + if (ss.nvdia == null) return UIs.placeholder; + final children = ss.nvdia!.map((e) => _buildGpuItem(e)).toList(); + return CardX( + ExpandTile( + title: const Text('GPU'), + leading: const Icon(Icons.memory, size: 17), + initiallyExpanded: children.length <= 3, + children: children, + ), + ); + } + + Widget _buildGpuItem(NvdiaSmiItem item) { + final mem = item.memory; + final processes = mem.processes; + final children = []; + if (processes.isNotEmpty) { + children.addAll(processes.map((e) => _buildGpuProcessItem(e))); + } + return CardX( + ListTile( + title: Text(item.name, style: UIs.textSize13), + leading: Text( + '${item.temp}°C', + style: UIs.textSize11Grey, + textScaler: _textFactor, + ), + subtitle: Text( + '${item.power} - ${mem.used} / ${mem.total} ${mem.unit}', + style: UIs.textSize11Grey, + textScaler: _textFactor, + ), + trailing: InkWell( + onTap: () { + final height = () { + if (processes.length > 5) { + return 5 * 47.0; + } + return processes.length * 47.0; + }(); + context.showRoundDialog( + title: Text(item.name), + child: SizedBox( + width: double.maxFinite, + height: height, + child: ListView.builder( + itemCount: processes.length, + itemBuilder: (_, idx) => _buildGpuProcessItem(processes[idx]), + ), + ), + actions: [ + TextButton( + onPressed: () => context.pop(), + child: Text(l10n.close), + ) + ], + ); + }, + child: const Icon(Icons.info_outline, size: 17), + ), + ), + ); + } + + Widget _buildGpuProcessItem(NvdiaSmiMemProcess process) { + return ListTile( + title: Text( + process.name, + style: UIs.textSize11, + maxLines: 1, + overflow: TextOverflow.ellipsis, + textScaler: _textFactor, + ), + subtitle: Text( + 'PID: ${process.pid} - ${process.memory} MiB', + style: UIs.textSize11Grey, + textScaler: _textFactor, + ), + trailing: InkWell( + onTap: () { + context.showRoundDialog( + title: SizedBox( + width: 377, + child: Text('${process.pid}', maxLines: 1), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Memory: ${process.memory} MiB'), + UIs.height13, + Text('Process: ${process.name}') + ], + ), + actions: [ + TextButton( + onPressed: () => context.pop(), + child: Text(l10n.close), + ) + ], + ); + }, + child: const Icon(Icons.info_outline, size: 17), + ), + ); + } + Widget _buildDiskView(ServerStatus ss) { final disks = ss.disk; disks.removeWhere((e) { diff --git a/pubspec.lock b/pubspec.lock index 5aa0e0fc0..f80bca683 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -698,10 +698,10 @@ packages: dependency: transitive description: name: petitparser - sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "6.0.1" pinenacl: dependency: transitive description: @@ -1125,13 +1125,13 @@ packages: source: hosted version: "1.0.3" xml: - dependency: transitive + dependency: "direct main" description: name: xml - sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + sha256: af5e77e9b83f2f4adc5d3f0a4ece1c7f45a2467b695c2540381bac793e34e556 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.4.2" xterm: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index ce226bba8..f2c2c2e2a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,6 +60,7 @@ dependencies: url: https://github.com/lollipopkit/watch_connectivity choice: ^2.0.0 #flutter_secure_storage: ^9.0.0 + xml: ^6.4.2 dev_dependencies: flutter_native_splash: ^2.1.6 diff --git a/test/nvdia.dart b/test/nvdia.dart deleted file mode 100644 index d5ef5aea5..000000000 --- a/test/nvdia.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; - -const _raw = ''' -+-----------------------------------------------------------------------------+ -| NVIDIA-SMI 455.23 Driver Version: 455.23 CUDA Version: 11.1 | -|-------------------------------+----------------------+----------------------+ -| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | -| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | -| | | MIG M. | -|===============================+======================+======================| -| 0 GeForce RTX 3090 Off | 00000000:01:00.0 Off | N/A | -| 30% 40C P8 30W / 350W | 240MiB / 24268MiB | 5% Default | -+-------------------------------+----------------------+----------------------+ -| 1 GeForce RTX 2080 Off | 00000000:02:00.0 On | N/A | -| 30% 51C P2 70W / 225W | 1080MiB / 8192MiB | 27% Default | -+-------------------------------+----------------------+----------------------+ - -+-----------------------------------------------------------------------------+ -| Processes: | -| GPU GI CI PID Type Process name GPU Memory | -| ID ID Usage | -|=============================================================================| -| 0 N/A N/A 1456 G /usr/lib/xorg/Xorg 40MiB | -| 0 N/A N/A 1589 G /usr/bin/gnome-shell 70MiB | -| 1 N/A N/A 1456 G /usr/lib/xorg/Xorg 400MiB | -| 1 N/A N/A 1589 G /usr/bin/gnome-shell 300MiB | -| 1 N/A N/A 2112 G ...AAAAAAAAA= --shared-files 200MiB | -+-----------------------------------------------------------------------------+ -'''; - -/// [ -/// { -/// "name": "GeForce RTX 3090", -/// "temp": 40, -/// "power": "30W / 350W", -/// "memory": { -/// "total": 24268, -/// "used": 240, -/// "unit": "MiB", -/// "processes": [ -/// { -/// "pid": 1456, -/// "name": "/usr/lib/xorg/Xorg", -/// "memory": 40 -/// }, -/// ] -/// }, -/// } -/// ] - -void main() { - test('nvdia-smi', () { - - }); -} \ No newline at end of file diff --git a/test/nvdia_test.dart b/test/nvdia_test.dart new file mode 100644 index 000000000..ef9a06a84 --- /dev/null +++ b/test/nvdia_test.dart @@ -0,0 +1,849 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:toolbox/data/model/server/nvdia.dart'; + +const _raw = + ''' + + + + Mon Nov 27 15:08:08 2023 + 535.129.03 + 12.2 + 1 + + NVIDIA GeForce RTX 3080 Ti + GeForce + Ampere + Enabled + Enabled + Disabled + None + + N/A + N/A + + + None + + Disabled + 4000 + + N/A + N/A + + N/A + GPU-71dd2db7-1b83-c2f0-8c13-46b94790bafd + 0 + 94.02.71.00.28 + No + 0x100 + N/A + 2208-225-A1 + N/A + 1 + + G001.0000.03.03 + 2.0 + N/A + N/A + + + N/A + N/A + + + N/A + N/A + + N/A + + None + N/A + + + No + N/A + + + N/A + + + 01 + 00 + 0000 + 220810DE + 00000000:01:00.0 + 15351B4C + + + 4 + 1 + 1 + 4 + 5 + + + 16x + 16x + + + + N/A + N/A + + 0 + 0 + 0 KB/s + 0 KB/s + N/A + N/A + + 0 % + P8 + + Active + Not Active + Not Active + Not Active + Not Active + Not Active + Not Active + Not Active + Not Active + + + 12288 MiB + 245 MiB + 352 MiB + 11690 MiB + + + 256 MiB + 7 MiB + 249 MiB + + + 0 MiB + 0 MiB + 0 MiB + + Default + + 3 % + 2 % + 0 % + 0 % + 0 % + 0 % + + + 0 + 0 + 0 + + + 0 + 0 + 0 + + + N/A + N/A + + + + N/A + N/A + N/A + N/A + + + N/A + N/A + N/A + N/A + + + + + N/A + N/A + + + N/A + N/A + + N/A + N/A + + N/A + + 34 C + N/A + 98 C + 95 C + 93 C + 83 C + N/A + N/A + + + 65 C + 91 C + + + P8 + 24.55 W + 350.00 W + 350.00 W + 350.00 W + 100.00 W + 380.00 W + + + P8 + N/A + N/A + N/A + N/A + N/A + N/A + + + 210 MHz + 210 MHz + 405 MHz + 555 MHz + + + N/A + N/A + + + N/A + N/A + + + N/A + + + 2145 MHz + 2145 MHz + 9501 MHz + 1950 MHz + + + N/A + + + N/A + N/A + + + 775.000 mV + + + N/A + N/A + + + + 9501 MHz + 2145 MHz + 2130 MHz + 2115 MHz + 2100 MHz + 2085 MHz + 2070 MHz + 2055 MHz + 2040 MHz + 2025 MHz + 2010 MHz + 1995 MHz + 1980 MHz + 1965 MHz + 1950 MHz + 1935 MHz + 1920 MHz + 1905 MHz + 1890 MHz + 1875 MHz + 1860 MHz + 1845 MHz + 1830 MHz + 1815 MHz + 1800 MHz + 1785 MHz + 1770 MHz + 1755 MHz + 1740 MHz + 1725 MHz + 1710 MHz + 1695 MHz + 1680 MHz + 1665 MHz + 1650 MHz + 1635 MHz + 1620 MHz + 1605 MHz + 1590 MHz + 1575 MHz + 1560 MHz + 1545 MHz + 1530 MHz + 1515 MHz + 1500 MHz + 1485 MHz + 1470 MHz + 1455 MHz + 1440 MHz + 1425 MHz + 1410 MHz + 1395 MHz + 1380 MHz + 1365 MHz + 1350 MHz + 1335 MHz + 1320 MHz + 1305 MHz + 1290 MHz + 1275 MHz + 1260 MHz + 1245 MHz + 1230 MHz + 1215 MHz + 1200 MHz + 1185 MHz + 1170 MHz + 1155 MHz + 1140 MHz + 1125 MHz + 1110 MHz + 1095 MHz + 1080 MHz + 1065 MHz + 1050 MHz + 1035 MHz + 1020 MHz + 1005 MHz + 990 MHz + 975 MHz + 960 MHz + 945 MHz + 930 MHz + 915 MHz + 900 MHz + 885 MHz + 870 MHz + 855 MHz + 840 MHz + 825 MHz + 810 MHz + 795 MHz + 780 MHz + 765 MHz + 750 MHz + 735 MHz + 720 MHz + 705 MHz + 690 MHz + 675 MHz + 660 MHz + 645 MHz + 630 MHz + 615 MHz + 600 MHz + 585 MHz + 570 MHz + 555 MHz + 540 MHz + 525 MHz + 510 MHz + 495 MHz + 480 MHz + 465 MHz + 450 MHz + 435 MHz + 420 MHz + 405 MHz + 390 MHz + 375 MHz + 360 MHz + 345 MHz + 330 MHz + 315 MHz + 300 MHz + 285 MHz + 270 MHz + 255 MHz + + + 9251 MHz + 2145 MHz + 2130 MHz + 2115 MHz + 2100 MHz + 2085 MHz + 2070 MHz + 2055 MHz + 2040 MHz + 2025 MHz + 2010 MHz + 1995 MHz + 1980 MHz + 1965 MHz + 1950 MHz + 1935 MHz + 1920 MHz + 1905 MHz + 1890 MHz + 1875 MHz + 1860 MHz + 1845 MHz + 1830 MHz + 1815 MHz + 1800 MHz + 1785 MHz + 1770 MHz + 1755 MHz + 1740 MHz + 1725 MHz + 1710 MHz + 1695 MHz + 1680 MHz + 1665 MHz + 1650 MHz + 1635 MHz + 1620 MHz + 1605 MHz + 1590 MHz + 1575 MHz + 1560 MHz + 1545 MHz + 1530 MHz + 1515 MHz + 1500 MHz + 1485 MHz + 1470 MHz + 1455 MHz + 1440 MHz + 1425 MHz + 1410 MHz + 1395 MHz + 1380 MHz + 1365 MHz + 1350 MHz + 1335 MHz + 1320 MHz + 1305 MHz + 1290 MHz + 1275 MHz + 1260 MHz + 1245 MHz + 1230 MHz + 1215 MHz + 1200 MHz + 1185 MHz + 1170 MHz + 1155 MHz + 1140 MHz + 1125 MHz + 1110 MHz + 1095 MHz + 1080 MHz + 1065 MHz + 1050 MHz + 1035 MHz + 1020 MHz + 1005 MHz + 990 MHz + 975 MHz + 960 MHz + 945 MHz + 930 MHz + 915 MHz + 900 MHz + 885 MHz + 870 MHz + 855 MHz + 840 MHz + 825 MHz + 810 MHz + 795 MHz + 780 MHz + 765 MHz + 750 MHz + 735 MHz + 720 MHz + 705 MHz + 690 MHz + 675 MHz + 660 MHz + 645 MHz + 630 MHz + 615 MHz + 600 MHz + 585 MHz + 570 MHz + 555 MHz + 540 MHz + 525 MHz + 510 MHz + 495 MHz + 480 MHz + 465 MHz + 450 MHz + 435 MHz + 420 MHz + 405 MHz + 390 MHz + 375 MHz + 360 MHz + 345 MHz + 330 MHz + 315 MHz + 300 MHz + 285 MHz + 270 MHz + 255 MHz + + + 5001 MHz + 2145 MHz + 2130 MHz + 2115 MHz + 2100 MHz + 2085 MHz + 2070 MHz + 2055 MHz + 2040 MHz + 2025 MHz + 2010 MHz + 1995 MHz + 1980 MHz + 1965 MHz + 1950 MHz + 1935 MHz + 1920 MHz + 1905 MHz + 1890 MHz + 1875 MHz + 1860 MHz + 1845 MHz + 1830 MHz + 1815 MHz + 1800 MHz + 1785 MHz + 1770 MHz + 1755 MHz + 1740 MHz + 1725 MHz + 1710 MHz + 1695 MHz + 1680 MHz + 1665 MHz + 1650 MHz + 1635 MHz + 1620 MHz + 1605 MHz + 1590 MHz + 1575 MHz + 1560 MHz + 1545 MHz + 1530 MHz + 1515 MHz + 1500 MHz + 1485 MHz + 1470 MHz + 1455 MHz + 1440 MHz + 1425 MHz + 1410 MHz + 1395 MHz + 1380 MHz + 1365 MHz + 1350 MHz + 1335 MHz + 1320 MHz + 1305 MHz + 1290 MHz + 1275 MHz + 1260 MHz + 1245 MHz + 1230 MHz + 1215 MHz + 1200 MHz + 1185 MHz + 1170 MHz + 1155 MHz + 1140 MHz + 1125 MHz + 1110 MHz + 1095 MHz + 1080 MHz + 1065 MHz + 1050 MHz + 1035 MHz + 1020 MHz + 1005 MHz + 990 MHz + 975 MHz + 960 MHz + 945 MHz + 930 MHz + 915 MHz + 900 MHz + 885 MHz + 870 MHz + 855 MHz + 840 MHz + 825 MHz + 810 MHz + 795 MHz + 780 MHz + 765 MHz + 750 MHz + 735 MHz + 720 MHz + 705 MHz + 690 MHz + 675 MHz + 660 MHz + 645 MHz + 630 MHz + 615 MHz + 600 MHz + 585 MHz + 570 MHz + 555 MHz + 540 MHz + 525 MHz + 510 MHz + 495 MHz + 480 MHz + 465 MHz + 450 MHz + 435 MHz + 420 MHz + 405 MHz + 390 MHz + 375 MHz + 360 MHz + 345 MHz + 330 MHz + 315 MHz + 300 MHz + 285 MHz + 270 MHz + 255 MHz + + + 810 MHz + 2100 MHz + 2085 MHz + 2070 MHz + 2055 MHz + 2040 MHz + 2025 MHz + 2010 MHz + 1995 MHz + 1980 MHz + 1965 MHz + 1950 MHz + 1935 MHz + 1920 MHz + 1905 MHz + 1890 MHz + 1875 MHz + 1860 MHz + 1845 MHz + 1830 MHz + 1815 MHz + 1800 MHz + 1785 MHz + 1770 MHz + 1755 MHz + 1740 MHz + 1725 MHz + 1710 MHz + 1695 MHz + 1680 MHz + 1665 MHz + 1650 MHz + 1635 MHz + 1620 MHz + 1605 MHz + 1590 MHz + 1575 MHz + 1560 MHz + 1545 MHz + 1530 MHz + 1515 MHz + 1500 MHz + 1485 MHz + 1470 MHz + 1455 MHz + 1440 MHz + 1425 MHz + 1410 MHz + 1395 MHz + 1380 MHz + 1365 MHz + 1350 MHz + 1335 MHz + 1320 MHz + 1305 MHz + 1290 MHz + 1275 MHz + 1260 MHz + 1245 MHz + 1230 MHz + 1215 MHz + 1200 MHz + 1185 MHz + 1170 MHz + 1155 MHz + 1140 MHz + 1125 MHz + 1110 MHz + 1095 MHz + 1080 MHz + 1065 MHz + 1050 MHz + 1035 MHz + 1020 MHz + 1005 MHz + 990 MHz + 975 MHz + 960 MHz + 945 MHz + 930 MHz + 915 MHz + 900 MHz + 885 MHz + 870 MHz + 855 MHz + 840 MHz + 825 MHz + 810 MHz + 795 MHz + 780 MHz + 765 MHz + 750 MHz + 735 MHz + 720 MHz + 705 MHz + 690 MHz + 675 MHz + 660 MHz + 645 MHz + 630 MHz + 615 MHz + 600 MHz + 585 MHz + 570 MHz + 555 MHz + 540 MHz + 525 MHz + 510 MHz + 495 MHz + 480 MHz + 465 MHz + 450 MHz + 435 MHz + 420 MHz + 405 MHz + 390 MHz + 375 MHz + 360 MHz + 345 MHz + 330 MHz + 315 MHz + 300 MHz + 285 MHz + 270 MHz + 255 MHz + 240 MHz + 225 MHz + 210 MHz + + + 405 MHz + 420 MHz + 405 MHz + 390 MHz + 375 MHz + 360 MHz + 345 MHz + 330 MHz + 315 MHz + 300 MHz + 285 MHz + 270 MHz + 255 MHz + 240 MHz + 225 MHz + 210 MHz + + + + + N/A + N/A + 1575 + G + /usr/lib/xorg/Xorg + 220 MiB + + + N/A + N/A + 1933 + G + /usr/bin/gnome-shell + 34 MiB + + + N/A + N/A + 16484 + G + /opt/microsoft/msedge/msedge --type=gpu-process --crashpad-handler-pid=16445 --enable-crash-reporter=, --change-stack-guard-on-fork=enable --gpu-preferences=WAAAAAAAAAAgAAAEAAAAAAAAAAAAAAAAAABgAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAGAAAAAAAAAAYAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAIAAAAAAAAAA== --shared-files --field-trial-handle=0,i,8049841253453661893,8316967731219016996,262144 + 76 MiB + + + + + + + +'''; + +/// [ +/// { +/// "name": "GeForce RTX 3090", +/// "temp": 40, +/// "power": "30W / 350W", +/// "memory": { +/// "total": 24268, +/// "used": 240, +/// "unit": "MiB", +/// "processes": [ +/// { +/// "pid": 1456, +/// "name": "/usr/lib/xorg/Xorg", +/// "memory": 40 +/// }, +/// ] +/// }, +/// } +/// ] + +void main() { + test('nvdia-smi', () { + if (kDebugMode) { + print(NvdiaSmi.fromXml(_raw).firstOrNull?.memory.processes); + } + }); +} diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt index b2e4bd8d6..4f2af69bb 100644 --- a/windows/flutter/CMakeLists.txt +++ b/windows/flutter/CMakeLists.txt @@ -9,6 +9,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -91,7 +96,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS