Peter's Solaris Zone

JKstat

OpenSolaris project page

14 June 2009: version 0.29

JKstat provides a jni interface for Java applications to access Solaris kstats.

In addition to the jni library and supporting classes, JKstat also provides a graphical browser to explore the kstat hierarchy, and a small number of standalone utilities such as jcpustate.

Version 0.29, now available for download, (and in zip form) has more code and javadoc cleanup, and includes a JavaFX example.

Version 0.28, now available for download, (and in zip form) improves the charting capabilities.

Version 0.27, now available for download, improves the client-server mode. Run the server like so:

./jkstat server -p server_port
where the argument to the -p flag specifies which port you would like the server to listen on. Then on the client machine, run the browser like so:
./jkstat remotebrowser -s http://server_name:server_port/
If you're on windows, then download in zip format instead, unpack the zip file, and double-click on the jkstat.bat file to start the client.

Version 0.25, now available for download, is a rather major refactoring of the code. Some of the more complex demos (such as the ZFS ARC statistics display) have been removed from JKstat and integrated into SolView instead. The class hierarchy has been revised to make it simpler and to make it clearer what constitutes the fundamental API and what is part of the graphical demos. And a number of bugs have been fixed (thanks to Mike Duigou for some of the fixes, and for prodding me to do a few important things, not all of which are finished yet!).

To see what subcommands are available, just run jkstat without any arguments.

The Kstat browser:

The fsstat utility:

The IO statistics gadget:

The network traffic gadget:

A java version of xcpustate:

A sample chart:

(It's Solaris specific, and I'm developing on Solaris 10, but it ought to work on earlier versions. You will require J2SE 5 or later, though.)

The fsstat utility uses new kstats. To actually see any output, you need to be running Nevada build35 or later, or Solaris 10 11/06 or later. Sorry, but I just use what's there.

Plans

The aim is to produce a functional jni interface. At this stage, tools built on top of it are necessary to guide the design and test the implementation, Once I'm happy that the jni interface itself is stable, I'll call it version 1 and concentrate on the tools themselves. In all honesty, we're now pretty close to that point.

I aim to replicate most of the standard Solaris utilities that display kstat data, such as iostat and vmstat. Graphical utilities for this purpose are useful for several reasons, apart from fitting better into the 21st century: a picture is worth a thousand words (so well designed graphics make it easier to visualize what's going on than a stream of numbers), and you can instantly expand areas of interest (and hide the irrelevant details) to drill down through the statistics.

In addition, there is the possibility of integrating these tools with others to gain greater understanding. For example, you could be looking at IO statistics. Upon noticing a certain pattern or level of IO traffic, you could immediately call dtrace to explain what was causing that activity.

It's actually very handy to be able to sort and filter. You can see some of this in jfsstat - it has fixed filtering (to hide some of the less interesting kstats), and you can sort the table too. I need to clean up the display a bit (so it formats the numbers better) without messing up the sorting. I'm currently working on filtering by zone name and fstype - maybe even down to the level of being able to filter by individual filesystem.

Version History

0.29
Code and javadoc cleanup; JavaFX example.
0.28
Charts enhanced.
0.27
Improved client-server mode.
0.26
Experimental client-server mode added.
0.25
Major refactoring and simplification.
0.24
Added arcstat demo (removed in 0.25 and moved to SolView).
0.23
Code cleanup using PMD.
0.22
Added KstatAggregate class. Added ProcessorTree to map the cpu structure. The psrinfo subcommand tests that. The cpustate demo shows aggregate core and chip statistic for multithreaded amd multicore machines. (The advanced cpustate demo was moved to SolView in version 0.25.) The cpustate and netload demos gain charts.
0.21
Fixes NPEs when given a kstat with missing data. Humanizes the units in the network rate display, and removes the kstatbrowser wrapper (use "jkstat browser" instead).
0.20
Text in resources. Updated jfreechart. kstat charts can have other statistics added. Regular expression support in KstatFilter.
0.19
Handle kstat chain updates. A master jkstat utility with the other utilities implemented as subcommands. Removed unused native methods. Added CDDL license text. Restructured the directory layout. The browser Trees have models.
0.18
Refactoring continues: common code eliminated from demos. Added jkmemalloc utility; added jkchart utility.
0.17
More code cleanups. Added chart displays using JFreeChart.
0.16
More code cleanups. And more sensible class names. Overall, the API is getting closer to where I want it to be.
Browser sorting works properly.
0.15
Many code cleanups: jstyle, generics, collections.
First attempt at jmpstat. Other sample applications use filters.
Browser now sorts. Thanks Tom!
0.14
Add KstatFilter.
jnetio has gone; jnetload is the new gadget.
Menus cleaned up - RadioButtons for all the sleep menus, mnemonics used consistently.
0.13
Use SpringLayout in place of GridLayout.
Add mm:0:phys_installed.
Fix a number of display corruption issues.
Right click popup menus in jiostat and jcpustate.
0.11
The kstatbrowser now uses a JTable, rather than mocking up the table in html.
Added a new jfsstat utility to display the new kstats introduced alongside the fsstat utility in Nevada build 35. The JTable also uses the TableSorter class from the Java Swing tutorial to allow you to sort the data.
0.10
More work on jiostat, fixing up underlying performance problems.
0.09
This introduced jiostat, but was never released due to the performance problems that jiostat encountered. Hopefully 0.10 is much better.
0.08
The accessories have been significantly cleaned up and are better structured. Rates now use the snaptimes, and accessories for the distribution of packet sizes on bge interfaces and dma transfer rates on ifb graphics cards have been added.
0.07
Some more raw kstats, and some more graphical helpers. A general code cleanup and restructure. Ability to clone the kstatbrowser window, and help and license details. Added jcpustate, just like xcpustate.
0.05
Add graphics to the kstat browser, so you get a continually updating graphical representation of I/O and network traffic.
0.04
Add some statistics, so you can see a breakdown of how many kstats are in a given module, class, or type. Add the capability to update the currently viewed kstat. Add the first raw kstat - nfs mntinfo.
0.03
Add support for I/O and interrupt kstats. It should be easy to do timer kstats, but I haven't found any yet to test with. And raw kstats aren't hard - they just need to be done individually, which will take time. I also added browsing by kstat class and type.
0.02
Graphical kstat browser added. Run kstatbrowser.
0.01
Simplifies the code, while adding graphical tools to display load average and network utilization.
0.00
Initial release. Classes to return the type of a kstat and its value.

Peter's Home | Zone Home