Package: pcvis
pcvisA command line tool for visualizing page cache status of given filesprerequisitesinstallpcstat(Page Cache stat: get page cache stats for files,https://github.com/tobert/pcstat)it has both Linux and macOS binaries since v0.0.1if you are using Linux/macOS, you can skip this step and usepcvis --install-pcstatto install it automaticallyinstallationviapippip install pcvisAfter installation, there will be a command calledpcvisyou can usemanualDownload this repo, copy thepcvis/pcvis.pyfrom this repoMovepcvis.pyinto your$PATH(e.g./usr/local/bin)mv pcvis.py /usr/local/bin/pcvis
chmod +x /usr/local/bin/pcvisusageVisualize a given file's page cache status like below:# pcstat still needs to be installed, and it will be automatically launched by pcvis
pcvis -f /path/to/my_filesample outputs█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░█░░░░█░█░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█Via this visualization, you can easily spot that:the black blocks indicate the part of the file that is in the page cachethis file's header and footer are accessed and loaded in page cachethis file is accessed in a random access manner, and you may even vaguely check if the random access is a binary search, etcarguments-for--file: the path to the file(s) you want to visualize its page cache status, e.g.pcvis -f /path/to/foo_file /path/to/bar_file. If you specify this argument,pcviswill launchpcstatautomatically and visualize the result. If this argument is not specified,pcviswill read the output ofpcstatfromstdin, e.g.pcstat -json -pps /path/to/my_file | pcvis-sor--style: there are over 20 different rendering styles to choose from, you can specify a custom style by passing an integer to this argument. The default style is0. Some sample styles are shown below:e.g.pcvis -s 3🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌕🌑🌕🌑🌕🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕e.g.pcvis -s 4💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍💚🤍💚🤍💚💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚-ior--install-pcstat: install pcstat to your system. By default, pcstat is installed into /usr/local/bin. You can specifyPCVIS_PCSTAT_PATHenv var to alter the default install dir. e.g.PCVIS_PCSTAT_PATH=/usr/bin pcvis -i-lor--list: list all styles available-vor--version: show version (only available if you install viapip)-hor--help: show help messageexamplesVisualize all csv files' page cachefind.-iname"*.csv"|xargspcvis-fInstallpcstatautomatically into/usr/local/binpcvis--install-pcstatList all available stylespcvis--listnotesIf you are doing database kernel development and would like to verify IO access pattern for your files, before running the above command for visualization, you may need to clean page cache up front so that such result clearly show the IO access pattern each time# for linux
sync; echo 1 > /proc/sys/vm/drop_caches 

# for macOS
sudo purgeSome of the icons in the visualization requires UTF8 to render, so you may need to set locale to UTF8 under some systemsexport LC_ALL="en_US.utf8"Otherwise, errors like'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)may be reported.Alternatively, you may try using some ASCII only style likepcvis -s 1 -f /path/to/fileto avoid such issue.developmentrun testspoetry run pytestinstall dev revision locallymake setup