Skip to content
Snippets Groups Projects
Commit 9156b9ed authored by Jan Waller's avatar Jan Waller
Browse files

Meta Monitoring Challenges

parent a86f816a
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="mooBench.benchmark.Benchmark"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-d 10 -h 1 -m 0 -t 1000 -o tmp/test.txt -q"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-d 10 -h 1 -m 0 -t 10 -o tmp/test.txt -q -a mooBench.monitoredApplication.MonitoredClassManualInstrumentation"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="MooBench"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:frameworks/Kieker/lib/kicker-1.10_aspectj.jar"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:frameworks/Kieker/lib/kicker-1.10_aspectj.jar&#13;&#10;-Dkicker.monitoring.debug=true&#13;&#10;-Dkicker.monitoring.skipDefaultAOPConfiguration=true"/>
</launchConfiguration>
......@@ -7,11 +7,11 @@ RESULTSDIR="${BASEDIR}results/"
THREADS=1 ## 1
RECURSIONDEPTH=10 ## 10
TOTALCALLS=10000 ## 10000
TOTALCALLS=1000 ## 2000000
METHODTIME=500000 ## 500000
#MOREPARAMS="--quickstart"
MOREPARAMS="${MOREPARAMS} -r kieker.Logger"
MOREPARAMS="${MOREPARAMS} -r kieker.Logger -a mooBench.monitoredApplication.MonitoredClassManualInstrumentation"
echo "Removing and recreating '$RESULTSDIR'"
(rm -rf ${RESULTSDIR}) && mkdir ${RESULTSDIR}
......@@ -28,6 +28,7 @@ JAVAAGENT="-javaagent:lib/kicker-1.10_aspectj.jar"
JAVAARGS="${JAVAARGS} -Dkieker.monitoring.writer.filesystem.AsyncFsWriter.customStoragePath=${RESULTSDIR}"
JAVAARGS="${JAVAARGS} -Dkicker.monitoring.writer.filesystem.AsyncBinaryFsWriter.customStoragePath=${RESULTSDIR}"
JAVAARGS="${JAVAARGS} -Dkicker.monitoring.debug=true -Dkicker.monitoring.skipDefaultAOPConfiguration=true"
## Write configuration
uname -a >${RESULTSDIR}configuration.txt
......@@ -51,5 +52,5 @@ sync
mv ${BASEDIR}kieker.log ${RESULTSDIR}kieker.log
[ -f ${BASEDIR}nohup.out ] && cp ${BASEDIR}nohup.out ${RESULTSDIR}
zip -jqr ${BASEDIR}results.zip ${RESULTSDIR}*
zip -qr ${BASEDIR}results.zip ${RESULTSDIR}*
[ -f ${BASEDIR}nohup.out ] && > ${BASEDIR}nohup.out
No preview for this file type
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package mooBench.monitoredApplication;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import kieker.common.record.flow.trace.TraceMetadata;
import kieker.common.record.flow.trace.operation.AfterOperationEvent;
import kieker.common.record.flow.trace.operation.AfterOperationFailedEvent;
import kieker.common.record.flow.trace.operation.BeforeOperationEvent;
import kieker.monitoring.core.controller.IMonitoringController;
import kieker.monitoring.core.controller.MonitoringController;
import kieker.monitoring.core.registry.TraceRegistry;
import kieker.monitoring.timer.ITimeSource;
/**
* @author Jan Waller
*/
public final class MonitoredClassManualInstrumentation implements MonitoredClass {
private static final IMonitoringController CTRLINST = MonitoringController.getInstance();
private static final ITimeSource TIME = CTRLINST.getTimeSource();
private static final TraceRegistry TRACEREGISTRY = TraceRegistry.INSTANCE;
final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
/**
* Default constructor.
*/
public MonitoredClassManualInstrumentation() {
// empty default constructor
}
public final long monitoredMethod(final long methodTime, final int recDepth) {
if (!CTRLINST.isMonitoringEnabled()) {
return this.monitoredMethod_actual(methodTime, recDepth);
}
final String signature = "public final long mooBench.monitoredApplication.MonitoredClassThreaded.monitoredMethod(long, int)";
if (!CTRLINST.isProbeActivated(signature)) {
return this.monitoredMethod_actual(methodTime, recDepth);
}
// common fields
TraceMetadata trace = TRACEREGISTRY.getTrace();
final boolean newTrace = trace == null;
if (newTrace) {
trace = TRACEREGISTRY.registerTrace();
CTRLINST.newMonitoringRecord(trace);
}
final long traceId = trace.getTraceId();
final String clazz = this.getClass().getName();
// measure before execution
CTRLINST.newMonitoringRecord(new BeforeOperationEvent(TIME.getTime(), traceId, trace.getNextOrderId(), signature, clazz));
// execution of the called method
final Object retval;
try {
retval = this.monitoredMethod_actual(methodTime, recDepth);
} catch (final Throwable th) { // NOPMD NOCS (catch throw might ok here)
// measure after failed execution
CTRLINST.newMonitoringRecord(new AfterOperationFailedEvent(TIME.getTime(), traceId, trace.getNextOrderId(), signature, clazz,
th.toString()));
throw new RuntimeException(th);
} finally {
if (newTrace) { // close the trace
TRACEREGISTRY.unregisterTrace();
}
}
// measure after successful execution
CTRLINST.newMonitoringRecord(new AfterOperationEvent(TIME.getTime(), traceId, trace.getNextOrderId(), signature, clazz));
return (Long) retval;
}
public final long monitoredMethod_actual(final long methodTime, final int recDepth) {
if (recDepth > 1) {
return this.monitoredMethod(methodTime, recDepth - 1);
} else {
final long exitTime = this.threadMXBean.getCurrentThreadUserTime() + methodTime;
long currentTime;
do {
currentTime = this.threadMXBean.getCurrentThreadUserTime();
} while (currentTime < exitTime);
return currentTime;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment