#json #scripting #automation #output #instance #memory #lsmod

app lsrmod

lsrmod是用Rust编写的,输出到std和json

3个版本

0.1.3 2024年7月11日
0.1.2 2024年7月11日
0.1.1 2024年7月11日

#19 in #scripting

Download history 170/week @ 2024-07-05 113/week @ 2024-07-12 1/week @ 2024-07-19 10/week @ 2024-07-26 1/week @ 2024-08-02

每月 295 次下载

MIT 许可证

8KB
110

lsrmod

基于Rust的lsmod实现

同时以JSON格式打印,以便于自动化和脚本使用。

e.g., lsrmod --number-of-lines=10
+----------------------+-----------+-----------+----------------------+-------+--------------------+
| Name                 | Memory(b) | Instances | Depends on           | State | Memory Offset      |
| ipheth               | 20480     | 0         | -                    | Live  | 0x0000000000000000 |
| apple_mfi_fastcharge | 16384     | 0         | -                    | Live  | 0x0000000000000000 |
| tls                  | 151552    | 0         | -                    | Live  | 0x0000000000000000 |
| r8153_ecm            | 12288     | 0         | -                    | Live  | 0x0000000000000000 |
| cdc_ether            | 24576     | 1         | r8153_ecm,           | Live  | 0x0000000000000000 |
| usbnet               | 61440     | 2         | r8153_ecm,cdc_ether, | Live  | 0x0000000000000000 |
| r8152                | 143360    | 1         | r8153_ecm,           | Live  | 0x0000000000000000 |
| mii                  | 20480     | 2         | usbnet,r8152,        | Live  | 0x0000000000000000 |
| snd_usb_audio        | 499712    | 0         | -                    | Live  | 0x0000000000000000 |
| snd_usbmidi_lib      | 53248     | 1         | snd_usb_audio,       | Live  | 0x0000000000000000 |
+----------------------+-----------+-----------+----------------------+-------+--------------------+

安装

cargo install lsrmod

示例

lsrmod --json | jq . | head -n25
[
  {
    "name": "tls",
    "memory": "151552",
    "instances": 0,
    "depends_on": "-",
    "state": "Live",
    "memory_offset": "0x0000000000000000"
  },
  {
    "name": "r8153_ecm",
    "memory": "12288",
    "instances": 0,
    "depends_on": "-",
    "state": "Live",
    "memory_offset": "0x0000000000000000"
  },
  {
    "name": "cdc_ether",
    "memory": "24576",
    "instances": 1,
    "depends_on": "r8153_ecm,",
    "state": "Live",
    "memory_offset": "0x0000000000000000"
  },

依赖

~3–12MB
~108K SLoC