Commit 3d6a99ec authored by Christian Wulf's avatar Christian Wulf

added LICENSE;

added QA config files;
added Delay and Clock
parent b987e909
<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
<local-check-config name="Kieker Checkstyle" location="lib/static-analysis/checkstyle-5.6/cs-conf.xml" type="project" description="">
<additional-data name="protect-config-file" value="true"/>
</local-check-config>
<fileset name="all" enabled="true" check-config-name="Kieker Checkstyle" local="true">
<file-match-pattern match-pattern="." include-pattern="true"/>
</fileset>
<filter name="FilesFromPackage" enabled="true">
<filter-data value="examples/userguide/ch2--bookstore-application/src"/>
<filter-data value="examples/userguide/ch2--manual-instrumentation/src"/>
<filter-data value="examples/userguide/ch3-4--custom-components/src"/>
<filter-data value="examples/userguide/ch5--trace-monitoring-aspectj/src"/>
<filter-data value="examples/userguide/appendix-JMS/src"/>
<filter-data value="examples/userguide/appendix-Sigar/src"/>
<filter-data value="src-gen/analysis"/>
</filter>
<filter name="NonSrcDirs" enabled="true"/>
</fileset-config>
<?xml version="1.0" encoding="UTF-8"?>
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd">
<analysis enabled="false" />
<rulesets>
<ruleset name="kieker" ref="lib/static-analysis/pmd-5.0.5/pmdrules.xml" refcontext="project" />
</rulesets>
</eclipse-pmd>
\ No newline at end of file
* text=auto
<?xml version="1.0" encoding="UTF-8"?>
<pmd>
<useProjectRuleSet>true</useProjectRuleSet>
<ruleSetFile>lib/static-analysis/pmd-5.0.5/pmdrules.xml</ruleSetFile>
<includeDerivedFiles>false</includeDerivedFiles>
<violationsAsErrors>true</violationsAsErrors>
<fullBuildEnabled>true</fullBuildEnabled>
</pmd>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="2">
<profile kind="CleanUpProfile" name="Kieker - Clean Up" version="2">
<setting id="cleanup.format_source_code" value="true"/>
<setting id="cleanup.add_missing_annotations" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="false"/>
<setting id="cleanup.remove_unused_private_types" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="true"/>
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
<setting id="cleanup.make_variable_declarations_final" value="true"/>
<setting id="cleanup.add_missing_methods" value="false"/>
<setting id="cleanup.always_use_this_for_non_static_field_access" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
<setting id="cleanup.correct_indentation" value="true"/>
<setting id="cleanup.never_use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.add_serial_version_id" value="true"/>
<setting id="cleanup.remove_unused_private_methods" value="true"/>
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
<setting id="cleanup.remove_unused_private_members" value="false"/>
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="false"/>
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
<setting id="cleanup.always_use_this_for_non_static_method_access" value="true"/>
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
<setting id="cleanup.format_source_code_changes_only" value="false"/>
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_missing_nls_tags" value="false"/>
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="false"/>
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
<setting id="cleanup.use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.remove_unused_private_fields" value="true"/>
<setting id="cleanup.make_parameters_final" value="true"/>
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
<setting id="cleanup.remove_unused_imports" value="true"/>
<setting id="cleanup.organize_imports" value="true"/>
<setting id="cleanup.sort_members" value="false"/>
<setting id="cleanup.remove_private_constructors" value="true"/>
<setting id="cleanup.convert_to_enhanced_for_loop" value="true"/>
<setting id="cleanup.always_use_blocks" value="true"/>
<setting id="cleanup.never_use_blocks" value="false"/>
<setting id="cleanup.always_use_parentheses_in_expressions" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access" value="true"/>
<setting id="cleanup.remove_unused_local_variables" value="false"/>
<setting id="cleanup.make_private_fields_final" value="true"/>
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
<setting id="cleanup.add_default_serial_version_id" value="true"/>
<setting id="cleanup.sort_members_all" value="false"/>
<setting id="cleanup.use_blocks" value="true"/>
<setting id="cleanup.add_missing_override_annotations" value="true"/>
<setting id="cleanup.make_local_variable_final" value="true"/>
</profile>
</profiles>
This diff is collapsed.
#Organize Import Order
#Thu Aug 16 15:19:31 CEST 2012
6=kieker.test
5=kieker
4=com
3=org
2=junit
1=javax
0=java
/***************************************************************************
* 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 teetime.stage;
import teetime.framework.core.AbstractFilter;
import teetime.framework.core.Context;
import teetime.framework.core.IOutputPort;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class Clock extends AbstractFilter<Clock> {
public final IOutputPort<Clock, Long> timestampOutputPort = this.createOutputPort();
@Override
protected boolean execute(final Context<Clock> context) {
final long timestamp = this.getTimestamp();
context.put(this.timestampOutputPort, timestamp);
return true;
}
/**
* @since 1.10
*/
private long getTimestamp() {
return System.nanoTime();
}
}
package teetime.stage.basic;
import teetime.framework.core.AbstractFilter;
import teetime.framework.core.Context;
import teetime.framework.core.IOutputPort;
/**
*
* The stage implements a clock that continuously outputs the current time as timestamp. This stage MUST be owned by an own thread since this stage calls <code>Thread.sleep()</code>.
*
* @author Christian Wulf
*
* @since 1.10
*
* @param <T>
*/
public class Clock<T> extends AbstractFilter<Clock<T>> {
public final IOutputPort<Clock<T>, Long> timestampOutputPort = this.createOutputPort();
private boolean initialDelayExceeded = false;
private long initialDelayInMs;
private long intervalDelayInMs;
/**
* @since 1.10
*/
@Override
protected boolean execute(final Context<Clock<T>> context) {
if (!initialDelayExceeded) {
initialDelayExceeded = true;
sleep(initialDelayInMs);
} else {
sleep(intervalDelayInMs);
}
context.put(timestampOutputPort, getCurrentTimeInNs());
return true;
}
@Override
public void onPipelineStarts() throws Exception {
if (getOwningPipeline().getStages().size() > 1) {
throw new IllegalArgumentException("The clock stage must be the only stage within its owning pipeline since it must be executed by a separate thread.");
}
super.onPipelineStarts();
}
private void sleep(final long delayInMs) {
try {
Thread.sleep(delayInMs);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private long getCurrentTimeInNs() {
return System.nanoTime();
}
public long getInitialDelayInMs() {
return initialDelayInMs;
}
public void setInitialDelayInMs(final long initialDelayInMs) {
this.initialDelayInMs = initialDelayInMs;
}
public long getIntervalDelayInMs() {
return intervalDelayInMs;
}
public void setIntervalDelayInMs(final long intervalDelayInMs) {
this.intervalDelayInMs = intervalDelayInMs;
}
}
......@@ -5,69 +5,28 @@ import teetime.framework.core.Context;
import teetime.framework.core.IInputPort;
import teetime.framework.core.IOutputPort;
/**
*
* @author Christian Wulf
*
* @since 1.10
*
* @param <T>
*/
public class Delay<T> extends AbstractFilter<Delay<T>> {
public final IInputPort<Delay<T>, T> INPUT_OBJECT = this.createInputPort();
public final IInputPort<Delay<T>, Object> signalInputPort = createInputPort();
public final IInputPort<Delay<T>, T> objectInputPort = createInputPort();
public final IOutputPort<Delay<T>, T> RELAYED_OBJECT = this.createOutputPort();
public final IOutputPort<Delay<T>, T> relayOutputPort = createOutputPort();
private long initialDelayInNs;
private long intervalDelayInNs;
private boolean initialDelayExceeded = false;
private long lastTimeInNs = this.getCurrentTimeInNs();
/**
* @since 1.10
*/
@Override
protected boolean execute(final Context<Delay<T>> context) {
final long passedTimeInNs = this.getCurrentTimeInNs() - this.lastTimeInNs;
final long thresholdInNs = (this.initialDelayExceeded) ? this.intervalDelayInNs : this.initialDelayInNs;
if (passedTimeInNs >= thresholdInNs) {
final T token = context.tryTake(this.INPUT_OBJECT);
if (token == null) {
return false;
}
this.lastTimeInNs += thresholdInNs;
context.put(this.RELAYED_OBJECT, token);
this.initialDelayExceeded = true;
final Object signal = context.tryTake(signalInputPort);
if (signal == null) {
return false;
}
return true;
}
/**
* @since 1.10
*/
private long getCurrentTimeInNs() {
return System.nanoTime();
}
final T object = context.tryTake(objectInputPort);
if (object == null) {
return false;
}
public long getInitialDelayInNs() {
return initialDelayInNs;
}
context.put(relayOutputPort, object);
public void setInitialDelayInNs(long initialDelayInNs) {
this.initialDelayInNs = initialDelayInNs;
}
public long getIntervalDelayInNs() {
return intervalDelayInNs;
return true;
}
public void setIntervalDelayInNs(long intervalDelayInNs) {
this.intervalDelayInNs = intervalDelayInNs;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment