{ "info": { "author": "Cl\u00e9ment MATHIEU", "author_email": "clement+flamegraph@unportant.info", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development" ], "description": ".. image:: https://travis-ci.org/cykl/hprof2flamegraph.svg?branch=release\n :target: https://travis-ci.org/cykl/hprof2flamegraph\n\n\n*****************\nJava flame graphs\n*****************\n\nA few years ago, Brendan Gregg created the `flame graph visualization`_. He describes it as\n*a visualization of profiled software, allowing the most frequent code-paths to be identified\nquickly and accurately*. More pragmatically, it is a great way to identify the hot spots of\nan application and to understand its runtime behavior.\n\nThe FlameGraph_ project provides a `flamegraph.pl` script to create SVG files\nfrom a pivot format called *folded stacks*, and several scripts to convert the\nproprietary output of various profilers (perf, DTrace etc.) into folded stacks.\n\nThis project aims to provide conversion scripts for several Java profilers.\nThese scripts are not pushed in the official project mostly because they are written\nin Python and not in Perl.\n\nSupported profilers are:\n\n- HPROF_\n- `Honest-profiler`_\n\n\n.. _flame graph visualization: http://www.brendangregg.com/flamegraphs.html\n.. _FlameGraph: https://github.com/brendangregg/FlameGraph\n.. _HPROF: http://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html\n.. _Honest-profiler: https://github.com/RichardWarburton/honest-profiler\n\n\nInstallation\n============\n\nThe easiest way to install `hprof2flamgegraph` is to use the\n`Pypi package`_:\n\n.. code-block:: bash\n\n pip install [--user] hprof2flamegraph\n\nIt installs a `stackcollapse-hprof` and `stackcollapse-hpl` scripts into\nthe `bin` directory of your environment. Make sure this directory is in\nyour `PATH`. The original `flamegraph.pl` script from Brendan is also\ninstalled (CDDL licensed).\n\nYou can also download the script from github or clone the repository.\nThe script is standalone with Python >= 2.7 and only requires the `argparse`\nmodule with Python 2.6.\n\n.. _Pypi package: http://pypi.python.org/pypi/hprof2flamegraph\n\n\nWhy should I use flame graphs with a Java profiler ?\n====================================================\n\nThe Java ecosystem is full of great performance analysis tools and profilers.\nThey are often full featured (CPU, memory, threads, GC, monitors, etc.) and well\nsuited for complex environments or analyses.\n\nHowever, quite often we only need to get the big picture of our application.\nFlame graphs really shine in this area. It is the easiest and fastest way to visualize\nyour application and understand its performance profile. It is a complement to\nmore heavy-weight analysis environments.\n\nThe official `flame graph visualization`_ page describe it in-depth and examine several\nuse cases.\n\n\nUsage\n=====\n\nHPROF\n-----\n\nRun the application with HPROF enabled. It must be configured to\ndo CPU sampling and not CPU tracing. You can configure the sampling\ninterval, the maximum stack depth, and whether if line numbers and\nthread information are printed.\n\nI recommend to always set these last two to `y` since they can be\ndiscarded at a latter step if needed. You never collect too much information.\n\n\n.. code-block:: bash\n\n java -agentlib:hprof=cpu=samples,depth=100,interval=7,lineno=y,thread=y,file=output.hprof[...]\n\nConvert the `output.hprof` file into folded stacks using the *stackcollapse-hprof* script\n\n.. code-block:: bash\n\n stackcollapse-hprof output.hprof > output-folded.txt\n\nCreate the final SVG graph. You can either use the `flamegraph.pl` script shipped with this\nmodule or the one from the official FlameGraph project. They are the same.\n\n.. code-block:: bash\n\n flamegraph.pl output-folded.txt > output.svg\n\nA few tips about HPROF follows:\n\n- HPROF is not hot-pluggable. It means that it must be activated when the JVM starts and that\n the application will be profiled from the begging to the end. However, playing with SIGQUITs\n allow to profile a specific time frame. Its lame but it works.\n\n- It is also usually a good practice to avoid round sampling intervals like 10ms to avoid a\n possible bias due to the synchronization of several periodic processes (like a process\n scheduler or a timer).\n\n- As shown in `Evaluating the Accuracy of Java Profilers`_ HPROF is flawed, like many other Java\n profiler, and can produce non-actionable profiles. It worth reading the paper to make sure you\n understand the limitation of the tool. After that, HPROF is usually good enough to identify the\n hot spots.\n\n.. _Evaluating the Accuracy of Java Profilers: http://pl.cs.colorado.edu/papers/mytkowicz-pldi10.pdf\n\nHonest-profiler\n---------------\n\nRun the application with `honest-profiler enabled`_ (and remember it is **not production ready yet**).\n\n.. code-block:: bash\n\n java -agentpath:/path/to/location/liblagent.so[...]\n\nIt will create a *log.hpl*. Convert it into folded stacks using the *stackcollapse-hpl* script\n\n.. code-block:: bash\n\n stackcollapse-hpl log.hpl > output-folded.txt\n\nCreate the final SVG graph\n\n.. code-block:: bash\n\n flamegraph.pl output-folded.txt > output.svg\n\n.. _honest-profiler enabled: https://github.com/RichardWarburton/honest-profiler/wiki/How%20to%20Run\n\n\nSpecific use cases\n==================\n\nHadoop jobs\n-----------\n\nWant to profile an Hadoop job?\n\nIt is quite easy to do. You only have to set the following Hadoop variables:\n\n- `mapred.task.profile`\n- `mapred.task.profile.params`\n- `mapred.task.profile.maps`\n- `mapred.task.profile.reduces`.\n\nTo enable HPROF programmatically from a Java job:\n\n.. code-block:: java\n\n Configuration conf = getConf();\n conf.setBoolean(\"mapred.task.profile\", true);\n conf.set(\"mapred.task.profile.params\",\n \"-agentlib:hprof=cpu=samples,depth=100,interval=7,lineno=y,thread=y,file=%s\");\n conf.set(\"mapred.task.profile.maps\", \"0\");\n conf.set(\"mapred.task.profile.reduces\", \"0\");\n\nTo do it from the command line:\n\n.. code-block:: bash\n\n hadoop jar my.jar \\\n -Dmapred.task.profile=true \\\n -Dmapred.task.profile.params=\"-agentlib:hprof=cpu=samples,depth=100,interval=7,lineno=y,thread=y,file=%s\" \\\n -Dmapred.task.profile.maps=0 \\\n -Dmapred.task.profile.reduces=0\n\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cykl/hprof2flamegraph", "keywords": null, "license": "License :: OSI Approved :: BSD License", "maintainer": null, "maintainer_email": null, "name": "hprof2flamegraph", "package_url": "https://pypi.org/project/hprof2flamegraph/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/hprof2flamegraph/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/cykl/hprof2flamegraph" }, "release_url": "https://pypi.org/project/hprof2flamegraph/0.0.6/", "requires_dist": null, "requires_python": null, "summary": "Java Flame Graphs", "version": "0.0.6" }, "last_serial": 2739519, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "764fe79076ab1cb24146c6771f75125e", "sha256": "5beae1768c92b742c65b36c4b3e51262ab9e6e75aae306911974811525bb125b" }, "downloads": -1, "filename": "hprof2flamegraph-0.0.1.tar.gz", "has_sig": false, "md5_digest": "764fe79076ab1cb24146c6771f75125e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11129, "upload_time": "2013-12-05T23:02:08", "url": "https://files.pythonhosted.org/packages/c2/2b/93a572fb638a74d4f6d93b9530fc71c6e76b83e6e1ab4c4f821f07e3c919/hprof2flamegraph-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "c3ef78fab69e34a84ed43a2873f136ae", "sha256": "8b6f14026f42f53047ae756096f4ffec5e472f5efe295d798e0311d1291cb0c4" }, "downloads": -1, "filename": "hprof2flamegraph-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c3ef78fab69e34a84ed43a2873f136ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 647245, "upload_time": "2014-10-21T19:04:27", "url": "https://files.pythonhosted.org/packages/eb/f2/b9cff64a36b576f811247976632967e7bc301cc9ff99ec6ec64eabb85978/hprof2flamegraph-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "b5f303df590ec1ff64d6779f90421c78", "sha256": "084b8f59fbd32c8a3872367eb432c0deee435bc4add989421da11675a3d04456" }, "downloads": -1, "filename": "hprof2flamegraph-0.0.3.tar.gz", "has_sig": false, "md5_digest": "b5f303df590ec1ff64d6779f90421c78", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 650800, "upload_time": "2016-06-09T17:52:54", "url": "https://files.pythonhosted.org/packages/c6/65/14c122a3dc75e7eee319a1073cc85061d0414e31214f76fce02fef5ab221/hprof2flamegraph-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "f23c30b81425fba8bf3dddb2a7148663", "sha256": "f05fa62745bda0252c8d07b4da57ab95fe4db809aa7e91a9a0b26c384f6c5371" }, "downloads": -1, "filename": "hprof2flamegraph-0.0.4.tar.gz", "has_sig": false, "md5_digest": "f23c30b81425fba8bf3dddb2a7148663", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 650820, "upload_time": "2016-06-09T18:03:27", "url": "https://files.pythonhosted.org/packages/7e/23/85dafaef1a161562efe088c8c35da56a4b3bceb9b117fa64e6fbf0e4fb85/hprof2flamegraph-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "3eaa9e54cac5d06507776827c09b1139", "sha256": "7471184e45f751615b20e438a00c1ce7737a28802c026b2442f7c7fcfd635f59" }, "downloads": -1, "filename": "hprof2flamegraph-0.0.5.tar.gz", "has_sig": false, "md5_digest": "3eaa9e54cac5d06507776827c09b1139", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 651026, "upload_time": "2017-02-16T22:12:30", "url": "https://files.pythonhosted.org/packages/01/61/d53976883c79eaf78a9fb58d9df4898032d6acc8c737d639df74fa8a21ee/hprof2flamegraph-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "d27d11e54ceebfec5d6c9b7c1d03514a", "sha256": "efa8ad38910c27f67ecb40e4be9470f8834e2cadc82f61a2ec0cd81ef2ee111b" }, "downloads": -1, "filename": "hprof2flamegraph-0.0.6.tar.gz", "has_sig": false, "md5_digest": "d27d11e54ceebfec5d6c9b7c1d03514a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 651111, "upload_time": "2017-03-29T19:31:05", "url": "https://files.pythonhosted.org/packages/a0/f2/c64a25dbf128edbc5d660a2d953803e4212cde25c69d80fdbcd997929fef/hprof2flamegraph-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d27d11e54ceebfec5d6c9b7c1d03514a", "sha256": "efa8ad38910c27f67ecb40e4be9470f8834e2cadc82f61a2ec0cd81ef2ee111b" }, "downloads": -1, "filename": "hprof2flamegraph-0.0.6.tar.gz", "has_sig": false, "md5_digest": "d27d11e54ceebfec5d6c9b7c1d03514a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 651111, "upload_time": "2017-03-29T19:31:05", "url": "https://files.pythonhosted.org/packages/a0/f2/c64a25dbf128edbc5d660a2d953803e4212cde25c69d80fdbcd997929fef/hprof2flamegraph-0.0.6.tar.gz" } ] }