The Statistics API is the direct interface to the internal statistics tree. Statistics are disabled by default, but can be enabled by setting a StatsSpec interface. A StatsSpec interface defines how WebSphere® eXtreme Scale should monitor statistics.
public class LocalClient { public static void main(String[] args) { // retrieve a handle to the StatsAccessor StatsAccessor accessor = StatsAccessorFactory.getStatsAccessor(); } }
public static void main(String[] args) { // retrieve a handle to the StatsAccessor StatsAccessor accessor = StatsAccessorFactory.getStatsAccessor(); // Set the spec via the static field StatsSpec spec = new StatsSpec(StatsSpec.OG_ALL); accessor.setStatsSpec(spec); // Set the spec via the spec String StatsSpec spec = new StatsSpec("og.all=enabled"); accessor.setStatsSpec(spec); }
public static void main(String[] args) { // retrieve a handle to the StatsAccessor StatsAccessor accessor = StatsAccessorFactory.getStatsAccessor(); // Set the spec via the static field StatsSpec spec = new StatsSpec(StatsSpec.OG_ALL); accessor.setStatsSpec(spec); ObjectGridManager manager = ObjectGridmanagerFactory.getObjectGridManager(); ObjectGrid grid = manager.getObjectGrid("ObjectGridA"); Session session = grid.getSession(); Map map = session.getMap("MapA"); // Drive insert session.begin(); map.insert("SomeKey", "SomeValue"); session.commit(); }
public static void main(String[] args) { // retrieve a handle to the StatsAccessor StatsAccessor accessor = StatsAccessorFactory.getStatsAccessor(); // Set the spec via the static field StatsSpec spec = new StatsSpec(StatsSpec.OG_ALL); accessor.setStatsSpec(spec); ObjectGridManager manager = ObjectGridManagerFactory.getObjectGridManager(); ObjectGrid grid = manager.getObjectGrid("ObjectGridA"); Session session = grid.getSession(); Map map = session.getMap("MapA"); // Drive insert session.begin(); map.insert("SomeKey", "SomeValue"); session.commit(); // Retrieve StatsFact StatsFact fact = accessor.getStatsFact(new String[] {"EmployeeGrid"}, StatsModule.MODULE_TYPE_OBJECT_GRID); }
public static void main(String[] args) { // retrieve a handle to the StatsAccessor StatsAccessor accessor = StatsAccessorFactory.getStatsAccessor(); // Set the spec via the static field StatsSpec spec = new StatsSpec(StatsSpec.OG_ALL); accessor.setStatsSpec(spec); ObjectGridManager manager = ObjectGridmanagerFactory.getObjectGridManager(); ObjectGrid grid = manager.getObjectGrid("ObjectGridA"); Session session = grid.getSession(); Map map = session.getMap("MapA"); // Drive insert session.begin(); map.insert("SomeKey", "SomeValue"); session.commit(); // Retrieve StatsFact StatsFact fact = accessor.getStatsFact(new String[] {"EmployeeGrid"}, StatsModule.MODULE_TYPE_OBJECT_GRID); // Retrieve module and time OGStatsModule module = (OGStatsModule)fact.getStatsModule(); ActiveTimeStatistic timeStat = module.getTransactionTime("Default", true); double time = timeStat.getMeanTime(); }