日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

vmtouch--the Virtual Memory Toucher

發(fā)布時(shí)間:2025/3/21 57 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vmtouch--the Virtual Memory Toucher 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

給大家介紹個(gè)好玩的工具--vmtouch,可以查看某個(gè)文件在內(nèi)存的使用。下面是摘錄其網(wǎng)站,有興趣的童鞋可以自己研究下

下載源碼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.txt,?b.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/





本文轉(zhuǎn)自 taojin1240 51CTO博客,原文鏈接:http://blog.51cto.com/taotao1240/743249,如需轉(zhuǎn)載請(qǐng)自行聯(lián)系原作者

總結(jié)

以上是生活随笔為你收集整理的vmtouch--the Virtual Memory Toucher的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。