Emacs mode for java thread dumps
Emacs Lisp
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test-data
README.org
thread-dump-test.el
thread-dump.el

README.org

thread-dump.el

This is a java thread-dump viewer. It provides a master-details view of a thread dump(s) with ability to filter interesting threads and to hide uninteresting ones.

Installation

Add the following to your init.el:

(require 'package)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)

:

(when (not (package-installed-p 'thread-dump))
  (package-install 'thread-dump))

There are 2 entry points to the viewer: thread-dump-open-dir creates a viewer for directory with thread dumps, thread-dump-open-file creates a viewer for given file.

If you use dired the following code might be useful:

(defun thread-dump-open-dired-dir ()
  (interactive)
  (thread-dump-open-dir (dired-current-directory)))

:

(defun thread-dump-open-marked-files ()
  (interactive)
  (let ((files (dired-get-marked-files)))
    (thread-dump-open-files files)))

:

(add-hook 'dired-mode-hook
          (lambda ()
             (define-key dired-mode-map (kbd "C-c t d") 'thread-dump-open-dired-dir)
             (define-key dired-mode-map (kbd "C-c t f") 'thread-dump-open-marked-files)))

It adds 2 keybindings to dired-mode: C-c t d opens a viewer for current dired directory and C-c t f opens a viewer for selected files or, if no files selected, for file under the cursor.

Usage

You can use j and k (or n and p) for navigation between threads in the master view on the left. RET and o open thread under cursor and switch to the thread buffer, v only shows a thread without leaving the master buffer.

Use h to hide a single thread and H to hide all the threads with the same stacktrace as in thread under cursor. To reset hidden threads use C-u H.

Use / and type a word to add a filter, viewer will show only the threads matched by the filter. / RET resets a filter.

If you run a viewer for several files, use N and P to view next and previous thread dump. Filters and hidden threads are preserved between thread dumps.

Use q to leave thread-dump viewer.