Top Description Inners Fields Constructors Methods
org.fusesource.hawtjni.runtime

public Class NativeStats

extends Object
Class Inheritance
Imports
java.io.PrintStream, java.util.ArrayList, .Arrays, .Collection, .Collections, .HashMap, .Map.Entry

Instructions on how to use the NativeStats tool with a standalone SWT example:
  1. Compile the native libraries defining the NATIVE_STATS flag.
  2. Add the following code around the sections of interest to dump the native calls done in that section.
         StatsInterface si = MyFooStatsInterface.INSTANCE;
         NativeStats stats = new NativeStats(si); 
         ... // your code
         stats.diff().dump(System.out);
         
  3. Or add the following code at a given point to dump a snapshot of the native calls done until that point.
         stats.snapshot().dump(System.out);
         
Author
Hiram Chirino

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static interface

Field Summary

Modifier and TypeField and Description
private final HashMap<NativeStats.StatsInterface, ArrayList<NativeStats.NativeFunction>>

Constructor Summary

AccessConstructor and Description
public
public
private

Method Summary

Modifier and TypeMethod and Description
public NativeStats
copy()

public NativeStats
diff()

public void
dump(PrintStream
Print stream.
ps
)

Dumps the stats to the print stream in a JSON format.

public void
public NativeStats
private static HashMap<NativeStats.StatsInterface, ArrayList<NativeStats.NativeFunction>>
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

snapshotback to summary
private final HashMap<NativeStats.StatsInterface, ArrayList<NativeStats.NativeFunction>> snapshot

Constructor Detail

NativeStatsback to summary
public NativeStats(NativeStats.StatsInterface... classes)
NativeStatsback to summary
public NativeStats(Collection<NativeStats.StatsInterface> classes)
NativeStatsback to summary
private NativeStats(HashMap<NativeStats.StatsInterface, ArrayList<NativeStats.NativeFunction>> snapshot)

Method Detail

copyback to summary
public NativeStats copy()
diffback to summary
public NativeStats diff()
dumpback to summary
public void dump(PrintStream ps)

Dumps the stats to the print stream in a JSON format.

Parameters
ps:PrintStream

Print stream.

resetback to summary
public void reset()
snapshotback to summary
public NativeStats snapshot()
snapshotback to summary
private static HashMap<NativeStats.StatsInterface, ArrayList<NativeStats.NativeFunction>> snapshot(Collection<NativeStats.StatsInterface> classes)
updateback to summary
public void update()
org.fusesource.hawtjni.runtime back to summary

public Class NativeStats.NativeFunction

extends Object
implements Comparable<NativeStats.NativeFunction>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

Field Summary

Modifier and TypeField and Description
private int
private final String
private final int

Constructor Summary

AccessConstructor and Description
public
NativeFunction(int ordinal, String name, int callCount)

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(NativeStats.NativeFunction
the object to be compared.
func
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public NativeStats.NativeFunction
copy()

public int
public String
public int
public void
public void
setCounter(int counter)

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

counterback to summary
private int counter
nameback to summary
private final String name
ordinalback to summary
private final int ordinal

Constructor Detail

NativeFunctionback to summary
public NativeFunction(int ordinal, String name, int callCount)

Method Detail

compareToback to summary
public int compareTo(NativeStats.NativeFunction func)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
func:NativeStats.NativeFunction

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

copyback to summary
public NativeStats.NativeFunction copy()
getCounterback to summary
public int getCounter()
getNameback to summary
public String getName()
getOrdinalback to summary
public int getOrdinal()
resetback to summary
public void reset()
setCounterback to summary
public void setCounter(int counter)
subtractback to summary
pack-priv void subtract(NativeStats.NativeFunction func)
org.fusesource.hawtjni.runtime back to summary

public Interface NativeStats.StatsInterface


Method Summary

Modifier and TypeMethod and Description
public int
public int
functionCounter(int ordinal)

public String
functionName(int ordinal)

public String

Method Detail

functionCountback to summary
public int functionCount()
functionCounterback to summary
public int functionCounter(int ordinal)
functionNameback to summary
public String functionName(int ordinal)
getNativeClassback to summary
public String getNativeClass()