给大家介绍个好玩的工具--vmtouch,可以查看某个文件在内存的使用。下面是摘录其网站,有兴趣的童鞋可以自己研究下

下载源码wget http://hoytech.com/vmtouch/vmtouch.c

编译gcc -Wall -O3 -o vmtouch vmtouch.c

cp vmtouch /usr/local/bin/

Example 1

How much of the /bin/ directory is currently in cache?

$ vmtouch /bin/ Files: 92 Directories: 1 Resident Pages: 348/1307 1M/5M 26.6% Elapsed: 0.003426 seconds

Example 2

How much of big-dataset.txt is currently in memory?

$ vmtouch -v big-dataset.txt big-dataset.txt [ ] 0/42116 Files: 1 Directories: 0 Resident Pages: 0/42116 0/164M 0% Elapsed: 0.005182 seconds None of it. Now let's bring part of it into memory with tail: $ tail -n 10000 big-dataset.txt > /dev/null Now how much? $ vmtouch -v big-dataset.txt big-dataset.txt [ oOOOOOOO] 4950/42116 Files: 1 Directories: 0 Resident Pages: 4950/42116 19M/164M 11.8% Elapsed: 0.006706 seconds vmtouch tells us that 4950 pages at the end of the file are now resident in memory.

Example 3

Let's bring the rest of big-dataset.txt into memory (pressing enter a few times to illustrate the animated progress bar you will see on your terminal):

$ vmtouch -vt big-dataset.txt big-dataset.txt [OOo oOOOOOOO] 6887/42116 [OOOOOOOOo oOOOOOOO] 10631/42116 [OOOOOOOOOOOOOOo oOOOOOOO] 15351/42116 [OOOOOOOOOOOOOOOOOOOOOo oOOOOOOO] 19719/42116 [OOOOOOOOOOOOOOOOOOOOOOOOOOOo oOOOOOOO] 24183/42116 [OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo oOOOOOOO] 28615/42116 [OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo oOOOOOOO] 31415/42116 [OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo oOOOOOOO] 36775/42116 [OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOo oOOOOOOO] 39431/42116 [OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO] 42116/42116 Files: 1 Directories: 0 Touched Pages: 42116 (164M) Elapsed: 12.107 seconds

Example 4

We have 3 big datasets, a.txtb.txt, and c.txt but only 2 of them will fit in memory at once. If we have a.txt and b.txt in memory but would now like to work withb.txt and c.txt, we could just start loading up c.txt but then our system would evict pages from both a.txt (which we want) and b.txt (which we don't want).

So let's give the system a hint and evict a.txt from memory, making room for c.txt:

$ vmtouch -ve a.txt Evicting a.txt Files: 1 Directories: 0 Evicted Pages: 42116 (164M) Elapsed: 0.076824 seconds

Example 5

Daemonise and lock all files in a directory into physical memory:

vmtouch -dl /var/www/htdocs/critical/

本文转自 taojin1240 51CTO博客,原文链接:http://blog.51cto.com/taotao1240/743249,如需转载请自行联系原作者

vmtouch--the Virtual Memory Toucher相关推荐

  1. DumpMem and Monster - Virtual Memory Explorers on Windows Mobile/CE

    Windows Mobile 5 和 6的平台是建立在CE5.x的基础上的.当可用的内存很少时,平台会自动关闭应用程序.而且,在这个移动平台上,同时只能运行32个process.在桌面电脑上,我们有4 ...

  2. 【计算机基础】 Virtual memory 虚拟内存

    Virtual memory 虚拟内存 虚拟内存的作用 将主存看成存储在磁盘上的地址空间的高速缓存,在主存中只保存活动区域,并根据需要在磁盘和主存之间来回传送数据,高效实用主存 为每个进程提供一致的地 ...

  3. is running beyond the ‘VIRTUAL‘ memory limit. Current usage: 123.5 MB of 1 GB physical memory used

    is running beyond the 'VIRTUAL' memory limit. Current usage: 123.5 MB of 1 GB physical memory used; ...

  4. 初识virtual memory

    一.先谈几个重要的东西 virtual memory是一个抽象概念,书上的原文是"an abstraction of main memory known as virtual memory& ...

  5. WinCE 5.0 virtual memory space

    要深入了解WinCE的memory结构,就不得不在这里先画个virtual memory space的图.这个图是针对WinCE 5.0的.由于WinCE 6的结构做了很大变化,关于WinCE 6的内 ...

  6. ES启动异常:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

    现象 ES启动时出现异常 bin/elasticsearchmax virtual memory areas vm.max_map_count [65530] is too low, increase ...

  7. HADOOP:Current usage: 399.9 MB of 1 GB physical memory used; 2.5 GB of 2.1 GB virtual memory used.

    [已解决]Current usage: 399.9 MB of 1 GB physical memory used; 2.5 GB of 2.1 GB virtual memory used. Kil ...

  8. es max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

    max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144] /etc ...

  9. Flink:Container is running beyond virtual memory limits

    1.美图 2.问题描述 以Yarn模式启动Flink时提示:The Flink Yarn cluster has failed. 详细错误信息为 Container [] is running bey ...

最新文章

  1. 191027爬虫笔记
  2. android告别篇-对于源码我的一些看法
  3. redis nginx session tomcat
  4. Hadoop MapReduce InputFormat基础
  5. python csv写入 不以科学计数法_【Python与GIS】聊聊Python与数据——上(三)
  6. java虚拟机带键盘安卓版下载。_jvm1.5官方下载
  7. matlab曲线拟合成两直线,最小二乘法曲线拟合 原理及matlab实现
  8. 48种世间哲学,其中值得借鉴的有10个
  9. 2000级2班同学聚会邀请函
  10. 收集最火的开源项目——PHP 篇
  11. 考研备考建议篇——论文怎么投稿
  12. smbus电池信息读取
  13. Datawhale组队学习 Task05:字符串(2天)
  14. 图扑软件与华为云共同构建新型智慧工厂
  15. 计算机丢失softwareinspect,logo1 systemInspect山泉查不到。。。和顶的又不一样[求助】...
  16. 服务器的内存和硬盘哪个更重要,[内存与硬盘区别] 内存和硬盘哪个重要
  17. Acm程序设计学习第二周
  18. 行程码是怎么知道你去过哪些地方的呢?
  19. 系统的认识大数据人工智能数据分析中的数据
  20. macOS中修改应用或文件图标

热门文章

  1. Oralce-清除数据的两种思路
  2. Linux 中复制文件到多个目录中
  3. Oracle-Materialized View解读
  4. VirtualBox安装Kali
  5. springboot打包不同环境配置与shell脚本部署
  6. Android获取存储和打印输出Logcat日志
  7. 瓦力机器人故障维修_大眼萌!5G巡逻机器人亮相乌镇,24小时值守互联网大会...
  8. python散点图显示数据_Python数据可视化——散点图
  9. mysql 查询字段语句_mysql查询语句常用字段操作函数
  10. comsol积分函数_怎样在COMSOL中实现时间和空间积分