2022-12-01
Project description
pcvis
A command line tool for visualizing page cache of a given file
prerequisites
- install
pcstat
(Page Cache stat: get page cache stats for files, https://github.com/tobert/pcstat)- it has both Linux and macOS binaries since v0.0.1
installation
via pip
pip install pcvis
After installation, there will be a command called pcvis
you can use
manual
- Download this repo, copy the
pcvis/pcvis.py
from this repo - Move
pcvis.py
into your$PATH
(e.g./usr/local/bin
)
mv pcvis.py /usr/local/bin/pcvis
chmod +x /usr/local/bin/pcvis
usage
Visualize a given file's page cache status like below. In the visualized image, the white dots indicate the part of the file that is in the page cache.
# pcstat still needs to be installed, and it will be automatically launched by pcvis
pcvis -f /path/to/my_file
sample outputs
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░░░░░░░░░░░░█░░░░░░░░░█░░░░█░█░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
Via this visualization, you can easily spot that:
- this file's header and footer are accessed and loaded in page cache
- this file is accessed in a random access manner, and you may even vaguely check if the random access is a binary search, etc
arguments
-
-f
or--file
: the path to the file you want to visualize its page cache status, e.g.pcvis -f /path/to/my_file
. If you specify this argument,pcvis
will launchpcstat
automatically and visualize the result. If this argument is not specified,pcvis
will read the output ofpcstat
fromstdin
, e.g.pcstat -json -pps /path/to/my_file | pcvis
-
-s
or--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 24
🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌕🌑🌕🌑🌕🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕 -
e.g.
pcvis -s 17
💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍💚🤍💚🤍💚💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚
-
-
-h
or--help
: show help message
notes
- Before running the above command for visualization, you need to clean page cache so that the above result is accurate
# for linux
sync; echo 1 > /proc/sys/vm/drop_caches
# for macOS
sudo purge
- Some of the icons in the visualization requires UTF8 to render, so you may need to set locale to UTF8 under some systems
export LC_ALL="en_US.utf8"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pcvis-0.3.0.tar.gz
.
File metadata
- Download URL: pcvis-0.3.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 558e8d06618153e57d3acd61f344a2d9e59dc76e1eb0317cfdac8acdd4ee7ec9 |
|
MD5 | b72b90f7766a3de883b425c3060f2777 |
|
BLAKE2b-256 | 4ae693f47c701d16ebe5920c8ffbf521fcb5106b7785925a25c50dd5eaf3a379 |
File details
Details for the file pcvis-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pcvis-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6f68d735a2165c4ab81952d44e2327be23b5b99afa15caf7452f97e3e5b77b1 |
|
MD5 | 5ee4a4d72eda77d1604c3e3754f7b41f |
|
BLAKE2b-256 | d7fa8c93a25aff6ddae43afc0696b5d74ffe9e9af907831e71184ae92cb58f71 |