{ "info": { "author": "Tetsuya Morimoto", "author_email": "tetsuya.morimoto@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries" ], "description": "# iosnoop-tool\n\nparse and visualize iosnoop output\n\n## What is iosnoop?\n\n*iosnoop* is a tracing tool for disk I/O events and created by [Brendan D. Gregg](http://brendangregg.com/). Originally, it is for Solaris/MacOS X using DTrace.\n\n> iosnoop - A program to print disk I/O events as they happen, with useful details such as UID, PID, filename (if available), command, etc. Written using DTrace (Solaris 10 3/05, MacOS X 10.5).\n>\n> http://www.brendangregg.com/DTrace/iosnoop\n\nAnd then, iosnoop was ported for Linux using [ftrace](https://www.kernel.org/doc/Documentation/trace/ftrace.txt). Refer to his blog for iosnoop detail.\n\n> I'm probably dreaming. I just ported my popular iosnoop tool to Linux:\n>\n> http://www.brendangregg.com/blog/2014-07-16/iosnoop-for-linux.html\n\nLinux ported iosnoop is a simple bash script and can be downloaded from here.\n\n* https://github.com/brendangregg/perf-tools/blob/master/iosnoop\n\nThe output is like this. iosnoop requires root permission to run. iosnoop summarizes block device I/O (disk I/O) latency (LATms) with 1 line.\n\n```bash\n$ sudo path/to/iosnoop -ts\nTracing block I/O. Ctrl-C to end.\nSTARTs ENDs COMM PID TYPE DEV BLOCK BYTES LATms\n14545946.332115 14545946.344366 <...> 17185 WS 8,160 4840587442 4096 12.25\n14545946.331036 14545946.347082 main 17197 WS 8,160 4840666914 4096 16.05\n14545946.332136 14545946.348852 <...> 17185 WS 8,160 4840643666 4096 16.72\n14545946.331067 14545946.352752 main 17197 WS 8,160 4844855458 4096 21.69\n14545946.332146 14545946.355893 <...> 17185 WS 8,160 4844863762 4096 23.75\n14545946.356584 14545946.358920 0 WS 8,160 4844859722 4096 2.34\n14545946.356238 14545946.361128 0 WS 8,160 4844855466 4096 4.89\n14545946.356943 14545946.364070 0 WS 8,160 4844863770 4096 7.13\n```\n\n## Why iosnoop-tool?\n\n*iosnoop-tool* is a visualizing tool for iosnoop output.\n\nBrendan also has provided a visualization tool named trace2heatmap.pl, and introduced how to make Heatmap from iosnoop output.\n\n* [Linux iosnoop Latency Heat Maps](http://www.brendangregg.com/blog/2014-07-23/linux-iosnoop-latency-heat-maps.html)\n\nI confirmed this tool works and know heatmap seems good enough. However, I am not good at reading/writing perl script, so I created my visualization tool in order to customize for my purpose.\n\n## Requirements\n\n* Python >= 3.4\n* [Seaborn](https://seaborn.pydata.org/)\n* Support output of iosnoop for Linux only\n * need `-ts` arguments\n```bash\n$ sudo iosnoop -ts\n```\n\n## How to install\n\n### for developer\n\nCreate virtualenv to install `iosnoop-tool`.\n\n```bash\n$ mkdir virtualenvs\n$ virtualenv -p python3 virtualenvs/venv\n$ source virtualenvs/venv/bin/activate\n(venv) $\n```\n\nInstall `iosnoop-tool` package from the repository.\n\n```bash\n(venv) $ git clone https://github.com/t2y/iosnoop-tool.git\n(venv) $ cd iosnoop-tool\n(venv) $ python setup.py develop\n```\n\n### Base CLI options\n\nConfirm `iosnoop-cli` works as below.\n\n```bash\n(venv) $ iosnoop-cli --help\nusage: iosnoop-cli [-h] [--basedate BASEDATE] --data DATA\n [--columns COLUMNS [COLUMNS ...]]\n [--io-commands IO_COMMANDS [IO_COMMANDS ...]]\n [--io-device IO_DEVICE] [--io-pids IO_PIDS [IO_PIDS ...]]\n [--io-types IO_TYPES [IO_TYPES ...]] [--since SINCE]\n [--until UNTIL] [-v] [--version]\n {csv,plot} ...\n\npositional arguments:\n {csv,plot}\n\noptional arguments:\n -h, --help show this help message and exit\n --basedate BASEDATE set base datetime to convert kernel timestamp to\n localtime, format: yyyymmddHHMISS\n --data DATA set path to iosnoop output file\n --columns COLUMNS [COLUMNS ...]\n set columns name in iosnoop output\n --io-commands IO_COMMANDS [IO_COMMANDS ...]\n set commands in iosnoop output\n --io-device IO_DEVICE\n set device in iosnoop output\n --io-pids IO_PIDS [IO_PIDS ...]\n set process ids in iosnoop output\n --io-types IO_TYPES [IO_TYPES ...]\n set types in iosnoop output\n --since SINCE set seconds since relative difference from start\n --until UNTIL set seconds until relative difference from start\n -v, --verbose set verbose mode\n --version show program version\n```\n\n### Sub Commands\n\n#### csv\n\nCreate csv/tsv file from output of iosnoop.\n\n```bash\n(venv) $ iosnoop-cli csv --help\nusage: iosnoop-cli csv [-h] [--dialect {excel,excel-tab,unix}]\n [--output OUTPUT] [--separator SEPARATOR]\n\noptional arguments:\n -h, --help show this help message and exit\n --dialect {excel,excel-tab,unix}\n set dialect for csv writer, default is excel\n --output OUTPUT set path to save csv file of iosnoop\n --separator SEPARATOR\n set separator (choose from comma, tab), default is comma\n```\n\n#### plot\n\nCreate image file rendered by seaborn from output of iosnoop.\n\n```bash\n(venv) $ iosnoop-cli plot --help\nusage: iosnoop-cli plot [-h] [--backend BACKEND] [--colormap COLORMAP]\n [--fig-output FIGOUTPUT] [--fig-size FIGSIZE]\n [--hspace HSPACE] [--plot-type {heatmap}] [--square]\n [--subplot-conditions SUBPLOT_CONDITIONS [SUBPLOT_CONDITIONS ...]]\n [--x-interval X_INTERVAL] [--x-max X_MAX]\n [--y-interval Y_INTERVAL] [--y-max Y_MAX]\n\noptional arguments:\n -h, --help show this help message and exit\n --backend BACKEND set backend for matplotlib, use TkAgg to monitor in\n the foreground\n --colormap COLORMAP set color map for seaborn heatmap\n --fig-output FIGOUTPUT\n set path to save graph\n --fig-size FIGSIZE set figure size\n --hspace HSPACE set hspace for subplot\n --plot-type {heatmap}\n set plot type (\"heatmap\" by default)\n --square set square mode for heatmap\n --subplot-conditions SUBPLOT_CONDITIONS [SUBPLOT_CONDITIONS ...]\n set DataFrame conditions to filter\n --x-interval X_INTERVAL\n set value of interval for x bins\n --x-max X_MAX set maximum value for x-axis\n --y-interval Y_INTERVAL\n set value of interval for y bins\n --y-max Y_MAX set maximum value for y-axis\n```\n\n## How to use\n\nThis is sample heatmap rendered by seaborn.\n\n![](https://github.com/t2y/iosnoop-tool/raw/master/tests/fixtures/iosnoop-sample.png)\n\n```bash\n(venv) $ iosnoop-cli --data tests/fixtures/iosnoop-sample.log plot --y-max 600 --y-interval 10 --fig-output tests/fixtures/iosnoop-sample.png\n...\n(venv) $ file tests/fixtures/iosnoop-sample.png\ntests/fixtures/iosnoop-sample.png: PNG image data, 1024 x 800, 8-bit/color RGBA, non-interlaced\n```\n\nSpecifying --basedate options converts kernel timestamp to localtime.\n\n```bash\n(vent) $ iosnoop-cli --basedate 20180702230100 --data tests/fixtures/iosnoop-sample.log plot --y-max 600 --y-interval 10 --fig-output tests/fixtures/iosnoop-sample-with-basedate.png\n```\n\n![](https://github.com/t2y/iosnoop-tool/raw/master/tests/fixtures/iosnoop-sample-with-basedate.png)\n\n### Examples\n\n#### plot\n\n* show graphical window instead of saviing image file\n\n```bash\n(venv) $ iosnoop-cli --data tests/fixtures/iosnoop-sample.log plot --backend TkAgg\n```\n\n* adjust x-axis and y-axis as needed, default settings might not appropriate depends on output of iosnoop\n\n```bash\n(venv) $ iosnoop-cli --data tests/fixtures/iosnoop-sample.log plot --x-max 100 --x-interval 2.0 --y-max 300 --y-interval 5\n```\n\n##### compare multiple subplots\n\nUse header name to retrieve particular data in [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html).\n\n```bash\n(venv) $ head tests/fixtures/iosnoop-sample.log\nSTARTs ENDs COMM PID TYPE DEV BLOCK BYTES LATms\n14545946.332115 14545946.344366 <...> 17185 WS 8,160 4840587442 4096 12.25\n14545946.331036 14545946.347082 main 17197 WS 8,160 4840666914 4096 16.05\n14545946.356943 14545946.364070 0 WS 8,160 4844863770 4096 7.13\n```\n\n* retrieved by exact match and contains string, --hspace is used for adjusting height space for each subplots\n\n```bash\n(venv) $ iosnoop-cli --data tests/fixtures/iosnoop-sample.log plot --y-max 300 --y-interval 30 --subplot-conditions \"COMM == 'main'\" \"COMM.str.contains('jbd2|kblockd|flush')\" \"COMM == ''\" --hspace 0.9 --fig-output tests/fixtures/iosnoop-sample-comm.png\n```\n\n![](https://github.com/t2y/iosnoop-tool/raw/master/tests/fixtures/iosnoop-sample-comm.png)\n\n* retrieved by bytes between, --hspace is used for adjusting height space for each subplots\n\n```bash\n(venv) $ iosnoop-cli --data tests/fixtures/iosnoop-sample.log plot --subplot-conditions \"BYTES.between(0, 131072)\" \"BYTES.between(131073, 262144)\" \"BYTES.between(262145, 524287)\" \"BYTES == 524288\" --hspace 1.2 --fig-output tests/fixtures/iosnoop-sample-bytes.png\n```\n\n![](https://github.com/t2y/iosnoop-tool/raw/master/tests/fixtures/iosnoop-sample-bytes.png)\n\n#### csv\n\n* write contents parsed from iosnoop output as csv file\n\n```bash\n(venv) $ iosnoop-cli --data tests/fixtures/iosnoop-sample.log csv --output iosnoop.csv\n(venv) $ head iosnoop.csv\nSTARTs,ENDs,COMM,PID,TYPE,DEV,BLOCK,BYTES,LATms,STARTs_DIFF\n14545946.332115,14545946.344366,<...>,17185,WS,\"8,160\",4840587442,4096,12.25,0\n14545946.331036,14545946.347082,main,17197,WS,\"8,160\",4840666914,4096,16.05,-0.0010790005326271057\n14545946.332136,14545946.348852,<...>,17185,WS,\"8,160\",4840643666,4096,16.72,2.099946141242981e-05\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/t2y/iosnoop-tool", "keywords": "iosnoop", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "iosnoop-tool", "package_url": "https://pypi.org/project/iosnoop-tool/", "platform": "unix", "project_url": "https://pypi.org/project/iosnoop-tool/", "project_urls": { "Homepage": "https://github.com/t2y/iosnoop-tool" }, "release_url": "https://pypi.org/project/iosnoop-tool/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "parse and visualize iosnoop output", "version": "0.1.0" }, "last_serial": 4060566, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "ca44b81909448fd7672367edad52aad5", "sha256": "eb039f3f5a63e364fda9ea0f5c059cbfdd7519fd69c27b80a110645914757dfd" }, "downloads": -1, "filename": "iosnoop-tool-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ca44b81909448fd7672367edad52aad5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 789821, "upload_time": "2018-07-14T05:45:26", "url": "https://files.pythonhosted.org/packages/76/1e/39de440bde8ef3f48b766411515e90a71bd34077c0c1852961f3f3933e15/iosnoop-tool-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ca44b81909448fd7672367edad52aad5", "sha256": "eb039f3f5a63e364fda9ea0f5c059cbfdd7519fd69c27b80a110645914757dfd" }, "downloads": -1, "filename": "iosnoop-tool-0.1.0.tar.gz", "has_sig": false, "md5_digest": "ca44b81909448fd7672367edad52aad5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 789821, "upload_time": "2018-07-14T05:45:26", "url": "https://files.pythonhosted.org/packages/76/1e/39de440bde8ef3f48b766411515e90a71bd34077c0c1852961f3f3933e15/iosnoop-tool-0.1.0.tar.gz" } ] }