English | Japanese

What is "Samurai"

Samurai is a tabbed GUI tail tool. The three major things Samurai does for you are

System Requirements

OS: Windows and any flavor of Unix like OS supports JDK 1.4 or later
Tested JVM to inspect: JDK 1.3.x,JDK 1.4.x,JDK5.0 based JVM provided by Apple, BEA, HP, Sun and IBM

Launching Samurai

There are two ways to launch Samurai. Choose suitable one.

  1. Launching Samurai via Java Web Start
  2. Java Web Start is a network based application launching protocol which comes with JRE1.4.2 or later.
    WIth Java Web Start you can create a desktop shortcut or a start menu item just like other native applications.
    Another cool feature with Java Web Start is that it automatically checks the latest version upon every launch and ensures the latest version is installed.
    You can just launch Samurai by clicking the icon below.
    If you don't have any JRE installed on your system, you can simply click here(IE only and ActiveX required to be enabled) to install JRE1.5.

    • Launch Samurai:

    Java Web Start system will pop up a warning dialog on the first launch which alerts that the application could violate your PC's security.
    Please click "Start" to proceed. It's because Samurai needs to get a permission to access your local filesystem which is necessary in reading log files.
    I am NOT suggesting that you may launch any Java Web Start applications without any concerns. You need to be aware that technically a Java Web Start application could crack your PC and cause fatal casualties.

    fig. 1 Security alert dialog
  3. Command line
  4. The binary is available for download at https://samuraism.jp/samurai/en/samurai.jar
    You can simply double-click to launch Samurai on your desktop or type as following in your command prompt

    $ java -jar samurai.jar

    Automatic update is not available with this way.
    Please check and download latest version manually.

Thread Dump View

  1. Initial view
  2. You'll see a window like fig.2. A tab named "Thread dump" will appear after you drag and drop a log file onto the window.
    Currently drag and drop does not work on Linux environment. Use the file menu instead.


    fig. 2 an initial view

  3. Thread dump tab
  4. When Samurai detects a thread dump in your log, a tab named "Thread Dump" will appear.


    fig. 3 "Thread dump" tab

    You can just click "Thread dumps" tab to see the analisys result.
    Samurai colors idle threads in gray, blocked threds in red and running threds in green.
    There are three result views and Samurai shows "Table view" by default.
    In many case you are just interested in the table view and the sequence view. Use the table view to decide which thread needs be inspected, the sequence view to understand the thread's behavior.
    You should take care especially threds always in red.


    fig. 4 Table view


    fig. 5 All thread view


    fig. 6 Sequence view

    Heap analysis View

    Every JVM implimentation accepts "-verbose:gc" option which will show you the internal GC activity.
    This is necessary when you check memory leaks, or decide if heap is allocated enough although the plain gc log is very hard to analyze.
    Samurai gives you a nice and understandable view of the GC logs.
    Red line stands for the heap usage before a GC.
    Yellow one stands for the heap usage after a GC.
    Gray one stands for the time spent for a GC.
    You can copy the graph to your desktop clipboard by pressing Ctrl+C, or Cmd+C(Mac).

    fig. 7 Memory tab

    CSV View

    Samurai provides you a realtime and visualized look of CSV files.
    You can copy the graph to the system clipboard by pressing Ctrl+C (Mac -> Cmd+C).

    fig. 8 CSV graph

    Search Logs

    Samurai is not only a thread dump analyzer but also a handy log viewr.
    It works just like a GUI version of "tail -f filename", and you can search the text on the fly.
    The searching function will be triggered when you type any texts.
    A search result will be hilighted if there is any matches. You can press Ctrl+G(Mac: Cmd+G) or F3 for forward search, Shift+Ctrl+G(Mac: Shift+Cmd+G) for backward search.
    You can also enable / disable the case sensitivity and regular expression.


    fig. 10 hilighting a match

    Source Code

    The archive contains jar file along with source code.
    You can access the project repository via http://yusuke.homeip.net/fisheye/browse/svn/samurai/trunk
    Or you can check out the latest source code anonymously with a subversion client as follows:

    svn checkout http://yusuke.homeip.net/svn/samurai/trunk samurai
    

    Mailing list

    Any comment, bug report, feature request or patch is highly welcomed.
    Feel free to post your comments to the mailing list.
    Subscribe to samurai-tool
    Email:
    Visit this group

    Bugs

    Known bugs and feature requests will be filed to the Jira site.
    Go to Jira

    License

    Samurai is released under the LGPL license.
    Samurai
    Copyright 2003-2008, Yusuke Yamamoto.
    
    Distributable under LGPL license.
    See terms of license at gnu.org.

    Pricing

    Samurai is an opensourced software and free of charge.
    You can use Samurai freely for any commercial or non-commercial project.
    If you feel Samurai makes your life easier, please do consider making a donation!