use of org.spf4j.perf.MeasurementRecorder in project spf4j by zolyfarkas.
the class RecorderFactoryTest method testRecorderFactory.
@Test
public void testRecorderFactory() throws InterruptedException, IOException, InstanceNotFoundException, MBeanException, AttributeNotFoundException, ReflectionException {
MeasurementRecorder rec = RecorderFactory.createScalableQuantizedRecorder(RecorderFactoryTest.class, "ms", 100000000, 10, 0, 6, 10);
rec.record(1);
int sum = 1;
for (int i = 0; i < 10; i++) {
rec.record(i);
sum += i;
}
String ret3 = (String) Client.getAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi", "org.spf4j.perf.recorders", "class_" + RecorderFactoryTest.class.getName(), "measurementsAsString");
Assert.assertThat(ret3, Matchers.containsString(sum + "," + 11));
rec.close();
}
use of org.spf4j.perf.MeasurementRecorder in project spf4j by zolyfarkas.
the class RecorderFactoryTest method testRecorderFactory2.
@Test
public void testRecorderFactory2() throws InterruptedException, IOException, InstanceNotFoundException, MBeanException, AttributeNotFoundException, ReflectionException {
MeasurementRecorder rec = RecorderFactory.createScalableQuantizedRecorder(RecorderFactoryTest.class, "ms", 100000000, 10, 0, 6, 10);
CompositeData ret3 = (CompositeData) Client.getAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi", "org.spf4j.perf.recorders", "class_" + RecorderFactoryTest.class.getName(), "measurements");
Assert.assertNull(ret3);
rec.close();
}
use of org.spf4j.perf.MeasurementRecorder in project spf4j by zolyfarkas.
the class RecorderFactoryTest method testRecorderFactoryDyna.
@Test
public void testRecorderFactoryDyna() throws InterruptedException, IOException, InstanceNotFoundException, MBeanException, AttributeNotFoundException, ReflectionException {
MeasurementRecorderSource rec = RecorderFactory.createScalableQuantizedRecorderSource(RsTest.class, "ms", 100000000, 10, 0, 6, 10);
MeasurementRecorder recorder = rec.getRecorder("test");
recorder.record(1);
int sum = 1;
for (int i = 0; i < 10; i++) {
recorder.record(i);
sum += i;
}
String ret3 = (String) Client.getAttribute("service:jmx:rmi:///jndi/rmi://:9999/jmxrmi", "org.spf4j.perf.recorders", "class_" + RecorderFactoryTest.class.getName() + "_RsTest", "measurementsAsString");
Assert.assertThat(ret3, Matchers.containsString("test," + sum + "," + 11));
rec.close();
}
Aggregations