当前位置: 首页 > 工具软件 > HCache > 使用案例 >

缓存查看利器hcache

公良渝
2023-12-01

简介

  hcache是一款查看buff/cache的工具,可以查看进程的缓存占用情况,以及占用操作系统缓存最多的N的文件;

安装

wget https://silenceshell-1255345740.cos.ap-shanghai.myqcloud.com/hcache
chmod +x hcache
mv hcache /usr/local/bin/

使用

查看使用缓存最多的3个文件

$ hcache -top 3
+----------------------+----------------+------------+-----------+---------+
| Name                 | Size (bytes)   | Pages      | Cached    | Percent |
|----------------------+----------------+------------+-----------+---------|
| /usr/bin/kubelet     | 138647424      | 33850      | 11751     | 034.715 |
| /usr/bin/dockerd     | 39473368       | 9638       | 6574      | 068.209 |
| /usr/lib/snapd/snapd | 18977392       | 4634       | 4505      | 097.216 |
+----------------------+----------------+------------+-----------+---------+

查看进程的缓存使用

hcache -pid 1397
+-----------------------+----------------+------------+-----------+---------+
| Name                  | Size (bytes)   | Pages      | Cached    | Percent |
|-----------------------+----------------+------------+-----------+---------|
| libm-2.23.so          | 1088952        | 266        | 185       | 069.549 |
| libstdc++.so.6.0.21   | 1566440        | 383        | 346       | 090.339 |
| libz.so.1.2.8         | 104824         | 26         | 26        | 100.000 |
| libdl-2.23.so         | 14608          | 4          | 4         | 100.000 |
| libwrap.so.0.7.6      | 36632          | 9          | 9         | 100.000 |
| libaio.so.1.0.1       | 5512           | 2          | 2         | 100.000 |
| libnss_compat-2.23.so | 35688          | 9          | 9         | 100.000 |
| libnsl-2.23.so        | 93128          | 23         | 23        | 100.000 |
| libc-2.23.so          | 1864888        | 456        | 456       | 100.000 |
| libcrypt-2.23.so      | 39224          | 10         | 10        | 100.000 |
| librt-2.23.so         | 31712          | 8          | 8         | 100.000 |
| liblz4.so.1.7.1       | 96360          | 24         | 24        | 100.000 |
| libgcc_s.so.1         | 89696          | 22         | 22        | 100.000 |
| libpthread-2.23.so    | 138696         | 34         | 34        | 100.000 |
| libnss_nis-2.23.so    | 47648          | 12         | 12        | 100.000 |
| libnuma.so.1.0.0      | 43936          | 11         | 11        | 100.000 |
| ld-2.23.so            | 162632         | 40         | 40        | 100.000 |
| mysqld                | 24754056       | 6044       | 4051      | 067.025 |
| libnss_files-2.23.so  | 47600          | 12         | 12        | 100.000 |
+-----------------------+----------------+------------+-----------+---------+

参考:

  1. hcache github地址
 类似资料: