使用hcache查看使用buff/cache的目录文件

简介: 我是使用的git从github拉取下代码,然后重新编译的, 因为此项目是go语言写的,所以编译时需要安装go语言如下命令下载代码,或者直接下载zip压缩包,资源在 “此目录下文档中所用的资源” 目录中

使用hcache查看使用buff/cache的目录文件

我是使用的git从github拉取下代码,然后重新编译的, 因为此项目是go语言写的,所以编译时需要安装go语言

如下命令下载代码,或者直接下载zip压缩包,资源在 “此目录下文档中所用的资源” 目录中

git clone git@github.com:silenceshell/hcache.git

进入主目录,编译,然后将编译后的文件拷贝到/usr/local/bin目录下,即可使用

cd hcache
make build
sudo cp hcache /usr/local/bin/

使用:

hcache <-json <-pps>|-terse|-default> <-nohdr> <-bname> file file file
 -json output will be JSON
   -pps include the per-page information in the output (can be huge!)
 -terse print terse machine-parseable output
 -default print ascii tables
 -histo print a histogram using unicode block characters
 -nohdr don't print the column header in terse or default format
 -bname use basename(file) in the output (use for long paths)
 -plain return data with no box characters
 -unicode return data with unicode box characters
 -pid int show all open maps for the given pid
 -top int show top x cached files
$ hcache --top 10
[sudo] password for silenceshell: 
+----------------------------------------------------------------------------------+----------------+------------+-----------+---------+
| Name                                                                             | Size (bytes)   | Pages      | Cached    | Percent |
|----------------------------------------------------------------------------------+----------------+------------+-----------+---------|
| /opt/google/chrome/chrome                                                        | 114911208      | 28055      | 25457     | 090.740 |
| /usr/share/code/code                                                             | 67688720       | 16526      | 12274     | 074.271 |
| /home/silenceshell/Software/pycharm-community-2016.2/lib/pycharm.jar                   | 95177431       | 23237      | 11325     | 048.737 |
| /opt/atom/atom                                                                   | 62641344       | 15294      | 10578     | 069.164 |
| /usr/bin/dockerd                                                                 | 39121168       | 9552       | 7103      | 074.361 |
| /home/silenceshell/Software/pycharm-community-2016.2/jre/jre/lib/amd64/libjfxwebkit.so | 57455824       | 14028      | 6625      | 047.227 |
| /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4.10.2                                  | 36462184       | 8902       | 6316      | 070.950 |
| /usr/lib/beyondcompare/BCompare                                                  | 30640160       | 7481       | 5505      | 073.586 |
| /usr/bin/SecureCRT                                                               | 29524560       | 7209       | 4806      | 066.667 |
| /usr/share/code/libnode.so                                                       | 21135976       | 5161       | 4588      | 088.898 |
+----------------------------------------------------------------------------------+----------------+------------+-----------+---------+
$ 
$ hcache --top 3  --bname  
+-------------+----------------+------------+-----------+---------+
| Name        | Size (bytes)   | Pages      | Cached    | Percent |
|-------------+----------------+------------+-----------+---------|
| chrome      | 114911208      | 28055      | 25476     | 090.807 |
| pycharm.jar | 95177431       | 23237      | 11479     | 049.400 |
| atom        | 62641344       | 15294      | 10578     | 069.164 |
+-------------+----------------+------------+-----------+---------+ 
$ 
$ lsof /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4.10.2 
COMMAND    PID   USER  FD   TYPE DEVICE SIZE/OFF    NODE NAME
quiterss 20630 silenceshell mem    REG    8,5 36462184 3936610 /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4.10.2

根据上面github给的示例,我们可以发现常用的两个命令为:

在root用户下使用:

1.显示top n的缓存目录

hcache --top 10

2.显示top n 的缓存目录的基本信息,包括大小

hcache --top 3  --bname
目录
相关文章
|
5天前
|
存储 C++
webserver--Buffer类实现内存缓冲区读写(全代码)
webserver--Buffer类实现内存缓冲区读写(全代码)
|
5天前
|
Linux
内核态的文件操作函数:filp_open、filp_close、vfs_read、vfs_write、set_fs、get_fs
内核态的文件操作函数:filp_open、filp_close、vfs_read、vfs_write、set_fs、get_fs
110 0
|
6月前
|
Shell
使用 shell 脚本清理内存 buff/cache
使用 shell 脚本清理内存 buff/cache
117 0
|
7月前
|
测试技术 C#
C#不通过byte[],直接对内存映射文件复制内存
C#不通过byte[],直接对内存映射文件复制内存
|
8月前
|
缓存 Linux
关于linux操作系统中的buff/cache
linux操作系统中的buff/cache学习
195 0
|
11月前
|
SQL 缓存 Linux
Linux清除缓存buff/cache
Linux清除缓存buff/cache
416 0
|
缓存 应用服务中间件 PHP
关于php的buffer(缓冲区)
关于php的buffer(缓冲区)
56 0
关于php的buffer(缓冲区)
|
缓存 Linux
Linux系统中的Page cache和Buffer cache
简单说来,page cache用来缓存文件数据,buffer cache用来缓存磁盘数据。在有文件系统的情况下,对文件操作,那么数据会缓存到page cache,如果直接采用dd等工具对磁盘进行读写,那么数据会缓存到buffer cache。 Buffer(Buffer Cache)以块形式缓冲了块设备的操作,定时或手动的同步到硬盘,它是为了缓冲写操作然后一次性将很多改动写入硬盘,避免频繁写硬盘,提高写入效率。 Cache(Page Cache)以页面形式缓存了文件系统的文件,给需要使用的程序读取,它是为了给读操作提供缓冲,避免频繁读硬盘,提高读取效率。
448 0
Linux系统中的Page cache和Buffer cache
|
Linux
【记录】:CentOS清理swap和buffer/cache
swap清理: swapoff -a && swapon -a  注意:这样清理有个前提条件,空闲的内存必须比已经使用的swap空间大cache清理: sync; sync; sync;&& echo3 >/proc/sys/vm/drop_caches ...
2538 0