Skip to main content

2022-12-10

Project description

pcvis

A command line tool for visualizing page cache of a given file

prerequisites

installation

via pip

pip install pcvis

After installation, there will be a command called pcvis you can use

manual

  1. Download this repo, copy the pcvis/pcvis.py from this repo
  2. 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:

# 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:

  1. the black blocks indicate the part of the file that is in the page cache
  2. this file's header and footer are accessed and loaded in page cache
  3. 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 launch pcstat automatically and visualize the result. If this argument is not specified, pcvis will read the output of pcstat from stdin, 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 is 0. Some sample styles are shown below:

    • e.g. pcvis -s 24 🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕🌑🌑🌑🌑🌕🌑🌕🌑🌕🌕🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌑🌕
    • e.g. pcvis -s 17 💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍🤍🤍🤍🤍🤍💚🤍🤍🤍🤍💚🤍💚🤍💚💚🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍🤍💚
  • -h or --help: show help message

notes

  1. 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
  1. 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

pcvis-0.4.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

pcvis-0.4.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pcvis-0.4.0.tar.gz.

File metadata

  • Download URL: pcvis-0.4.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for pcvis-0.4.0.tar.gz
Algorithm Hash digest
SHA256 82e1b63e06287acb4aae73adc6b8d25439408ec9a5908f1c948d5f0a74792170
MD5 c9090e795a8169f1bea9743cfead830d
BLAKE2b-256 c77dbab93c4f67879fbee24719c214afcaa7c83f76c7dd099a25cced868f3d39

See more details on using hashes here.

File details

Details for the file pcvis-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pcvis-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for pcvis-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62e758d725afb458eb240525e96f9a5d953192fbe1aa28a5028b5d3b5ebdee6b
MD5 8420bbc38ed5e238631fc4dbc1333011
BLAKE2b-256 c21f17ccc26922a7a2977b40d59bf879b4eeeb4e318b425421fe28c1829db8ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page