mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
restructure integrated tests as living examples
This commit is contained in:
parent
26f53f855d
commit
cf5ae84abd
@ -99,10 +99,10 @@ public class StdoutActivity extends SimpleActivity implements ActivityDefObserve
|
||||
opSequence = initOpSequencer();
|
||||
setDefaultsFromOpSequence(opSequence);
|
||||
|
||||
bindTimer = ActivityMetrics.timer(activityDef, "bind");
|
||||
executeTimer = ActivityMetrics.timer(activityDef, "execute");
|
||||
resultTimer = ActivityMetrics.timer(activityDef, "result");
|
||||
triesHisto = ActivityMetrics.histogram(activityDef, "tries");
|
||||
bindTimer = ActivityMetrics.timer(activityDef, "bind", this.getHdrDigits());
|
||||
executeTimer = ActivityMetrics.timer(activityDef, "execute", this.getHdrDigits());
|
||||
resultTimer = ActivityMetrics.timer(activityDef, "result", this.getHdrDigits());
|
||||
triesHisto = ActivityMetrics.histogram(activityDef, "tries", this.getHdrDigits());
|
||||
|
||||
this.pw = createPrintWriter();
|
||||
|
||||
|
@ -16,19 +16,21 @@
|
||||
|
||||
package io.nosqlbench.engine.api.activityconfig.yaml;
|
||||
|
||||
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsDocList;
|
||||
import io.nosqlbench.engine.api.util.TagFilter;
|
||||
import io.nosqlbench.nb.api.config.standard.ConfigModel;
|
||||
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
|
||||
import io.nosqlbench.nb.api.config.standard.Param;
|
||||
import io.nosqlbench.nb.api.config.standard.*;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class StmtsDocList implements Iterable<StmtsDoc> {
|
||||
private final static Logger logger = LogManager.getLogger(StmtsDocList.class);
|
||||
|
||||
private final RawStmtsDocList rawStmtsDocList;
|
||||
private final Map<String,String> templateVariables = new LinkedHashMap<>();
|
||||
private final Map<String, String> templateVariables = new LinkedHashMap<>();
|
||||
|
||||
public StmtsDocList(RawStmtsDocList rawStmtsDocList) {
|
||||
this.rawStmtsDocList = rawStmtsDocList;
|
||||
@ -111,18 +113,18 @@ public class StmtsDocList implements Iterable<StmtsDoc> {
|
||||
return this.getStmtDocs().get(0).getDescription();
|
||||
}
|
||||
|
||||
public Map<String,String> getTemplateVariables() {
|
||||
public Map<String, String> getTemplateVariables() {
|
||||
return templateVariables;
|
||||
}
|
||||
|
||||
public void addTemplateVariable(String key, String defaultValue) {
|
||||
this.templateVariables.put(key,defaultValue);
|
||||
this.templateVariables.put(key, defaultValue);
|
||||
}
|
||||
|
||||
public NBConfigModel getConfigModel() {
|
||||
ConfigModel cfgmodel = ConfigModel.of(StmtsDocList.class);
|
||||
getTemplateVariables().forEach((k,v) -> {
|
||||
cfgmodel.add(Param.defaultTo(k,v,"template parameter found in the yaml workload"));
|
||||
getTemplateVariables().forEach((k, v) -> {
|
||||
cfgmodel.add(Param.defaultTo(k, v, "template parameter found in the yaml workload"));
|
||||
});
|
||||
return cfgmodel.asReadOnly();
|
||||
}
|
||||
@ -149,4 +151,9 @@ public class StmtsDocList implements Iterable<StmtsDoc> {
|
||||
// sb.append(", names:").append(names);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static NBConfigModelExpander TEMPLATE_VAR_EXPANDER = workload -> {
|
||||
StmtsDocList loaded = StatementsLoader.loadPath(logger, (String) workload, "activities");
|
||||
return loaded.getConfigModel();
|
||||
};
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.nosqlbench.engine.core.script;
|
||||
package io.nosqlbench.nbr.examples;
|
||||
|
||||
import io.nosqlbench.engine.core.lifecycle.ScenarioResult;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
@ -28,14 +28,16 @@ public class SpeedCheckIntegrationTests {
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
// Verified as working
|
||||
public void testSpeedSanity() {
|
||||
ScenarioResult scenarioResult = ScriptIntegrationTests.runScenario("speedcheck");
|
||||
ScenarioResult scenarioResult = ScriptExampleTests.runScenario("speedcheck");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
// This seems incomplete
|
||||
public void testThreadSpeeds() {
|
||||
ScenarioResult scenarioResult = ScriptIntegrationTests.runScenario("threadspeeds");
|
||||
ScenarioResult scenarioResult = ScriptExampleTests.runScenario("threadspeeds");
|
||||
}
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
var csvlogger = csvmetrics.log("logs/csvmetricstestdir");
|
||||
|
||||
activitydef = {
|
||||
"alias" : "csvmetrics",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0",
|
||||
"async" : "1000"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
csvlogger.add(metrics.csvmetrics.cycles.servicetime);
|
||||
csvlogger.start(500,"MILLISECONDS");
|
||||
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
||||
|
||||
csvlogger.report();
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
stride_rate = {
|
||||
"alias" : "stride_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..12500",
|
||||
"stride" : "1",
|
||||
"threads" : "5",
|
||||
"striderate" : "2500",
|
||||
"interval" : "1000",
|
||||
"async" : 1000
|
||||
};
|
||||
|
||||
print('running stride_rate');
|
||||
scenario.run(10000,stride_rate);
|
||||
print('stride_rate finished');
|
||||
|
||||
print("metrics.stride_rate.strides.servicetime.meanRate = " + metrics.stride_rate.strides.servicetime.meanRate);
|
||||
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "threadspeeds",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..4000000000000",
|
||||
"threads" : "1",
|
||||
"interval" : "10000",
|
||||
"targetrate" : "1000000"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
|
||||
var speeds = [];
|
||||
var latencies = [];
|
||||
|
||||
function aTestCycle(threads, index) {
|
||||
activities.threadspeeds.threads = threads; // dynamically adjust the active threads for this activity
|
||||
scenario.waitMillis(60000); // wait for 1 minute to get a clean 1 minute average speed
|
||||
// scenario.waitMillis(5000); // wait for 1 minute to get a clean 1 minute average speed
|
||||
speeds[threads]= metrics.threadspeeds.cycles.oneMinuteRate; // record 1 minute avg speed
|
||||
print("speeds:" + speeds.toString());
|
||||
|
||||
}
|
||||
|
||||
var min=1;
|
||||
var max=256;
|
||||
var mid=Math.floor((min+max)/2)|0;
|
||||
|
||||
[min,mid,max].forEach(aTestCycle);
|
||||
|
||||
while (min<mid && mid<max && scenario.isRunningActivity(activitydef)) {
|
||||
print("speeds:" + speeds.toString());
|
||||
if (speeds[min]<speeds[max]) {
|
||||
min=mid;
|
||||
mid=Math.floor((mid+max) / 2)|0;
|
||||
} else {
|
||||
max=mid;
|
||||
mid=Math.floor((min+mid) / 2)|0;
|
||||
}
|
||||
aTestCycle(mid);
|
||||
}
|
||||
print("The optimum number of threads is " + mid + ", with " + speeds[mid] + " cps");
|
||||
var targetrate = (speeds[mid] * .7)|0;
|
||||
print("Measuring latency with threads=" + mid + " and targetrate=" + targetrate);
|
||||
|
||||
activities.threadspeeds.threads = mid;
|
||||
activities.threadspeeds.targetrate = targetrate;
|
||||
scenario.waitMillis(60000);
|
||||
|
||||
|
||||
scenario.stop(threadspeeds);
|
||||
|
||||
|
40
nbr-examples/src/test/resources/scripts/examples/README.md
Normal file
40
nbr-examples/src/test/resources/scripts/examples/README.md
Normal file
@ -0,0 +1,40 @@
|
||||
# Script Examples
|
||||
|
||||
The scripts in this directory are meant to be used for two things:
|
||||
|
||||
1. Integrated testing of real scenarios as part of the NoSQLBench build.
|
||||
2. Living documentation of NoSQLBench engine and extensions which is proven to work and always
|
||||
up to date.
|
||||
|
||||
## Running
|
||||
|
||||
All of these scripts can be invoked directly by NoSQLBench with one of these patterns:
|
||||
|
||||
* `nb script <basename> <arg>...`
|
||||
* example: `nb script params_variable one=two three=four`
|
||||
* `java -jar nb.jar script <filename>.js <arg>...` (ensure you have Java 17 for this)
|
||||
* example: `java -jar nb.jar params_variable five=six`
|
||||
* `nb <basename> <arg>...` (if and only if `<script>.js` is located in scripts/auto)
|
||||
* example: `nb `
|
||||
|
||||
## Diag Adapter
|
||||
|
||||
Some of these scripts use a diag driver which acts as a configurable
|
||||
op template for the purposes of demonstration and integrated testing.
|
||||
For more details on how to configure and use this for more advanced
|
||||
scenarios, see the help for the adapter `diag`. NOTE: the diag driver
|
||||
adapter has been updated and modernized for nb5, so if you are used
|
||||
to the old one, be sure to brush up on the improvements.
|
||||
|
||||
## Status
|
||||
|
||||
It is a goal to have all the scripts located within this directory
|
||||
be executed automatically on every full build with their own documented
|
||||
success criteria which is also visible. As of 2022-06-09, all of the
|
||||
scripts besides the ones in the doconly folder are executed by
|
||||
an integrated testing harness, although this is not enforced yet as a rule.
|
||||
|
||||
Further, these scripts should be externalized into docs in a way that is
|
||||
kept up to date with each release.
|
||||
|
||||
|
@ -16,16 +16,18 @@
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "erroring_activity",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..1500000",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500",
|
||||
"async" : "1000"
|
||||
"op" : {
|
||||
"log": "type=log modulo=1"
|
||||
}
|
||||
};
|
||||
|
||||
print('starting activity erroring_activity');
|
||||
scenario.start(activitydef1);
|
||||
scenario.waitMillis(2000);
|
||||
activities.erroring_activity.modulo="unparsable";
|
||||
activities.erroring_activity.threads="unparsable";
|
||||
scenario.awaitActivity("erroring_activity");
|
||||
print("awaited activity");
|
@ -16,12 +16,12 @@
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "erroring_activity_init",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..1500000",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500",
|
||||
"initdelay" : "unparsable",
|
||||
"async" : "1000"
|
||||
"unknown_config" : "unparsable",
|
||||
"op" : "noop"
|
||||
};
|
||||
|
||||
print('starting activity erroring_activity_init');
|
@ -16,11 +16,11 @@
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "activity_to_await",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..1500",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500",
|
||||
"async" : "1000"
|
||||
"op" : "noop"
|
||||
};
|
||||
|
||||
print('starting activity teststartstopdiag');
|
@ -16,7 +16,7 @@
|
||||
|
||||
basic_diag = params.withOverrides({
|
||||
"alias" : "basic_diag",
|
||||
"type" : "diag"
|
||||
"driver" : "diag"
|
||||
});
|
||||
|
||||
|
@ -16,19 +16,19 @@
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "blockingactivity1",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "1",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
"op":"noop"
|
||||
};
|
||||
activitydef2 = {
|
||||
"alias" : "blockingactivity2",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "1",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
"op":"noop"
|
||||
};
|
||||
|
||||
|
@ -16,13 +16,11 @@
|
||||
|
||||
co_cycle_delay = {
|
||||
"alias": "co_cycle_delay",
|
||||
"type": "diag",
|
||||
"diagrate": "500",
|
||||
"driver": "diag",
|
||||
"cycles": "0..1000000",
|
||||
"threads": "10",
|
||||
"cyclerate": "1000,1.5",
|
||||
"modulo": "1000",
|
||||
"async" : "1000"
|
||||
"op" : '{"log":{"level":"info","modulo":1000},"diagrate":{"diagrate":"500"}}'
|
||||
};
|
||||
|
||||
print('starting activity co_cycle_delay');
|
@ -16,12 +16,11 @@
|
||||
|
||||
co_cycle_delay = {
|
||||
"alias" : "co_cycle_delay",
|
||||
"type" : "diag",
|
||||
"diagrate" : "800",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..10000",
|
||||
"threads" : "1",
|
||||
"cyclerate" : "1000,1.0",
|
||||
"async" : "1000"
|
||||
"op" : "diagrate:diagrate=800"
|
||||
};
|
||||
|
||||
print('starting activity co_cycle_delay');
|
@ -17,11 +17,11 @@
|
||||
|
||||
activitydef = {
|
||||
"alias" : "cycle_rate",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "5K",
|
||||
"threads" : "10",
|
||||
"cyclerate" : "1K",
|
||||
"async" : 1000
|
||||
"op" : "noop"
|
||||
};
|
||||
|
||||
scenario.run(activitydef);
|
@ -16,12 +16,12 @@
|
||||
|
||||
activitydef = {
|
||||
"alias" : "cycle_rate_change",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..1000000",
|
||||
"threads" : "10",
|
||||
"cyclerate" : "2000",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
"op" : "noop"
|
||||
};
|
||||
|
||||
print('starting cycle_rate_change');
|
@ -18,10 +18,10 @@ var csvlogger = csvmetrics.log("logs/csvmetricstestdir");
|
||||
|
||||
activitydef = {
|
||||
"alias" : "csvmetrics",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"op": '{"log":"interval=1000"}',
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
scenario.start(activitydef);
|
@ -16,12 +16,12 @@
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testhistologger",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0",
|
||||
"async" : "1000"
|
||||
"op" : "noop"
|
||||
};
|
||||
|
||||
histologger.logHistoIntervals("testing extention histologger", ".*", "hdrhistodata.log", "0.5s");
|
@ -16,12 +16,12 @@
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testhistostatslogger",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0",
|
||||
"async" : "1000"
|
||||
"op" : "noop"
|
||||
};
|
||||
|
||||
histostatslogger.logHistoStats("testing extention histostatslogger", ".*", "logs/histostats.csv", "0.5s");
|
@ -18,14 +18,14 @@ var leader = {
|
||||
driver: 'diag',
|
||||
alias: 'leader',
|
||||
targetrate: '10000',
|
||||
op: 'log:info'
|
||||
op: 'log:level=info'
|
||||
};
|
||||
|
||||
var follower = {
|
||||
driver: 'diag',
|
||||
alias: 'follower',
|
||||
linkinput: 'leader',
|
||||
op: 'log:INFO'
|
||||
// linkinput: 'leader',
|
||||
op: 'log:level=INFO'
|
||||
};
|
||||
|
||||
scenario.start(leader);
|
||||
|
@ -14,16 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// With the API support for Polyglot, we lost the ability to expose
|
||||
// map operations (underlying Java Map API) as well as proxy methods
|
||||
// on ECMA objects. What works now is object semantics + non-map methods.
|
||||
// More testing and refinement may be needed to clarify the rules here.
|
||||
|
||||
// previously:
|
||||
// print('params.get("one")=\'' + params.get("one") + "'"); // worked with nashorn
|
||||
// print('params.get("three")=\'' + params.get("three") + "'");
|
||||
// print('params.size()=' + params.size());
|
||||
|
||||
// Called with one=two three=four
|
||||
|
||||
print('params["one"]=\'' + params["one"] + "'");
|
@ -16,14 +16,14 @@
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testactivity",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..1000000000",
|
||||
"threads" : "25",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
"op" : "noop"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
|
||||
scenario.start(activitydef);
|
||||
|
||||
scenario.waitMillis(500);
|
||||
while (metrics.testactivity.cycles.servicetime.count < 1000) {
|
@ -17,11 +17,12 @@
|
||||
//logger.info("testing dynamically changing threads.");
|
||||
activitydef = {
|
||||
"alias" : "speedcheck",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
"targetrate" : "10000.0",
|
||||
"op": "noop"
|
||||
};
|
||||
|
||||
print("running 5E5 cycles at 1E5 cps ~~ 5 seconds worth");
|
@ -16,11 +16,11 @@
|
||||
|
||||
activitydef = {
|
||||
"alias" : "teststartstopdiag",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..1000000000",
|
||||
"threads" : "25",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
"op" : "noop"
|
||||
};
|
||||
|
||||
print('starting activity teststartstopdiag');
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
scenario.start('type=diag;alias=threadchange;cycles=0..60000;threads=1;interval=2000;modulo=1000000;async=1000;rate=1000');
|
||||
scenario.start('driver=diag;alias=threadchange;cycles=0..60000;threads=1;interval=2000;modulo=1000000;op=noop;rate=1000');
|
||||
activities.threadchange.threads=1;
|
||||
print("threads now " + activities.threadchange.threads);
|
||||
print('waiting 500 ms');
|
@ -16,11 +16,12 @@
|
||||
|
||||
activitydef = {
|
||||
"alias" : "threadspeeds",
|
||||
"type" : "diag",
|
||||
"driver" : "diag",
|
||||
"cycles" : "0..4000000000000",
|
||||
"threads" : "1",
|
||||
"interval" : "10000",
|
||||
"targetrate" : "1000000"
|
||||
"targetrate" : "1000000",
|
||||
"op": "noop"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "erroring_activity",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1500000",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500"
|
||||
};
|
||||
|
||||
print('starting activity erroring_activity');
|
||||
scenario.start(activitydef1);
|
||||
scenario.waitMillis(2000);
|
||||
activities.erroring_activity.modulo="unparsable";
|
||||
scenario.awaitActivity("erroring_activity");
|
||||
print("awaited activity");
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "erroring_activity_init",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1500000",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500",
|
||||
"initdelay" : "unparsable"
|
||||
};
|
||||
|
||||
print('starting activity erroring_activity_init');
|
||||
scenario.start(activitydef1);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.awaitActivity("erroring_activity_init");
|
||||
print("awaited activity");
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "blockingactivity1",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "1",
|
||||
"interval" : "2000"
|
||||
};
|
||||
activitydef2 = {
|
||||
"alias" : "blockingactivity2",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "1",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
|
||||
print('running blockingactivity1');
|
||||
scenario.run(10000,activitydef1);
|
||||
print('blockingactivity1 finished');
|
||||
print('running blockingactivity2');
|
||||
scenario.run(10000,activitydef2);
|
||||
print('blockingactivity2 finished');
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
co_cycle_delay = {
|
||||
"alias": "co_cycle_delay",
|
||||
"type": "diag",
|
||||
"diagrate": "500",
|
||||
"cycles": "0..1000000",
|
||||
"threads": "10",
|
||||
"cyclerate": "1000,1.5",
|
||||
"modulo": "1000"
|
||||
};
|
||||
|
||||
print('starting activity co_cycle_delay');
|
||||
scenario.start(co_cycle_delay);
|
||||
for (i = 0; i < 5; i++) {
|
||||
scenario.waitMillis(1000);
|
||||
if (!scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("backlogging, cycles=" + metrics.co_cycle_delay.cycles.servicetime.count +
|
||||
" waittime=" + metrics.co_cycle_delay.cycles.waittime.value +
|
||||
" diagrate=" + activities.co_cycle_delay.diagrate +
|
||||
" cyclerate=" + activities.co_cycle_delay.cyclerate
|
||||
);
|
||||
|
||||
// print("config: " +
|
||||
// " cycles.config_cyclerate=" + metrics.co_cycle_delay.cycles.config_cyclerate.value +
|
||||
// " cycles.config_burstrate=" + metrics.co_cycle_delay.cycles.config_burstrate.value +
|
||||
// " cycles.waittime=" + metrics.co_cycle_delay.cycles.waittime.value
|
||||
// );
|
||||
//
|
||||
// print("diag config: " +
|
||||
// " diag.config_cyclerate=" + metrics.co_cycle_delay.diag.config_cyclerate.value +
|
||||
// " diag.config_burstrate=" + metrics.co_cycle_delay.diag.config_burstrate.value +
|
||||
// " diag.waittime=" + metrics.co_cycle_delay.diag.waittime.value
|
||||
// );
|
||||
|
||||
}
|
||||
print('step1 metrics.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
activities.co_cycle_delay.diagrate = "10000";
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (!scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("recovering, cycles=" + metrics.co_cycle_delay.cycles.servicetime.count +
|
||||
" waittime=" + metrics.co_cycle_delay.cycles.waittime.value +
|
||||
" diagrate=" + activities.co_cycle_delay.diagrate +
|
||||
" cyclerate=" + activities.co_cycle_delay.cyclerate
|
||||
);
|
||||
|
||||
// print("cycles.config: " +
|
||||
// " cycles.config_cyclerate=" + metrics.co_cycle_delay.cycles.config_cyclerate.value +
|
||||
// " cycles.config_burstrate=" + metrics.co_cycle_delay.cycles.config_burstrate.value +
|
||||
// " cycles.waittime=" + metrics.co_cycle_delay.cycles.waittime.value
|
||||
// );
|
||||
//
|
||||
// print("diag config: " +
|
||||
// " diag.config_cyclerate=" + metrics.co_cycle_delay.diag.config_cyclerate.value +
|
||||
// " diag.config_burstrate=" + metrics.co_cycle_delay.diag.config_burstrate.value +
|
||||
// " diag.waittime=" + metrics.co_cycle_delay.diag.waittime.value
|
||||
// );
|
||||
|
||||
|
||||
scenario.waitMillis(1000);
|
||||
if (metrics.co_cycle_delay.cycles.waittime.value < 10000000) {
|
||||
print("waittime trended back down as expected, exiting on iteration " + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//scenario.awaitActivity("co_cycle_delay");
|
||||
print('step2 metrics.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
scenario.stop(co_cycle_delay);
|
||||
print("stopped activity co_cycle_delay");
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
co_cycle_delay = {
|
||||
"alias" : "co_cycle_delay",
|
||||
"type" : "diag",
|
||||
"diagrate" : "800",
|
||||
"cycles" : "0..10000",
|
||||
"threads" : "1",
|
||||
"cyclerate" : "1000,1.0"
|
||||
};
|
||||
|
||||
print('starting activity co_cycle_delay');
|
||||
scenario.start(co_cycle_delay);
|
||||
scenario.waitMillis(4000);
|
||||
print('step1 cycles.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
activities.co_cycle_delay.diagrate="10000";
|
||||
for(i=0;i<5;i++) {
|
||||
if (! scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("iteration " + i + " waittime now " + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
scenario.waitMillis(1000);
|
||||
}
|
||||
//scenario.awaitActivity("co_cycle_delay");
|
||||
print('step2 cycles.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
print("awaited activity");
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "cycle_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..300000",
|
||||
"threads" : "10",
|
||||
"cyclerate" : "2000",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
print('starting cycle_rate');
|
||||
scenario.start(activitydef);
|
||||
print('started');
|
||||
print('cyclerate at 0ms:' + activities.cycle_rate.cyclerate);
|
||||
scenario.waitMillis(1000);
|
||||
activities.cycle_rate.cyclerate='50000';
|
||||
print("measured cycle increment per second is expected to adjust to 5000");
|
||||
print('cyclerate now:' + activities.cycle_rate.cyclerate);
|
||||
|
||||
var lastcount=metrics.cycle_rate.cycles.servicetime.count;
|
||||
for(i=0;i<10;i++) {
|
||||
scenario.waitMillis(1000);
|
||||
var nextcount=metrics.cycle_rate.cycles.servicetime.count;
|
||||
var cycles = (nextcount - lastcount);
|
||||
print("new this second: " + (nextcount - lastcount));
|
||||
lastcount=nextcount;
|
||||
if (cycles>4700 && cycles<5300) {
|
||||
print("cycles adjusted, exiting on iteration " + i)
|
||||
break;
|
||||
}
|
||||
}
|
||||
scenario.stop(activitydef);
|
||||
print('cycle_rate activity finished');
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testhistologger",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
|
||||
histologger.logHistoIntervals("testing extention histologger", ".*", "hdrhistodata.log", "0.5s");
|
||||
print("started logging to hdrhistodata.log for all metrics at 1/2 second intervals.");
|
||||
|
||||
scenario.start(activitydef);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testhistostatslogger",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
|
||||
histostatslogger.logHistoStats("testing extention histostatslogger", ".*", "logs/histostats.csv", "0.5s");
|
||||
print("started logging to logs/histostats.csv for all metrics at 1/2" +
|
||||
" second intervals.");
|
||||
|
||||
scenario.start(activitydef);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
var leader = {
|
||||
type: 'diag',
|
||||
alias: 'leader',
|
||||
targetrate: '10000'
|
||||
};
|
||||
|
||||
var follower = {
|
||||
type: 'diag',
|
||||
alias: 'follower',
|
||||
linkinput: 'leader'
|
||||
};
|
||||
|
||||
scenario.start(leader);
|
||||
print("started leader");
|
||||
scenario.start(follower);
|
||||
print("started follower");
|
||||
|
||||
scenario.waitMillis(500);
|
||||
|
||||
scenario.stop(leader);
|
||||
print("stopped leader");
|
||||
scenario.stop(follower);
|
||||
print("stopped follower");
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
print('params.get("one")=\'' + params.get("one") + "'");
|
||||
print('params.get("three")=\'' + params.get("three") + "'");
|
||||
print('params.size()=' + params.size());
|
||||
|
||||
var overrides = {
|
||||
'three': "five"
|
||||
};
|
||||
print('params.get("three") [overridden-three-five]=\'' + params.withOverrides(overrides).get("three") + "'");
|
||||
var defaults = {
|
||||
'four': "niner"
|
||||
};
|
||||
print('params.get("four") [defaulted-four-niner]=\'' + params.withDefaults(defaults).get("four") + "'");
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
phase_rate = {
|
||||
"alias" : "phase_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "10",
|
||||
"phaserate" : "25000",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
print('running phase_rate');
|
||||
scenario.run(10000,phase_rate);
|
||||
print('phase_rate finished');
|
||||
|
||||
print("phase_rate.phases.servicetime.meanRate = " + metrics.phase_rate.phases.servicetime.meanRate);
|
||||
print("value is expected to be 25000 +-1000");
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testactivity",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1000000000",
|
||||
"threads" : "25",
|
||||
"interval" : "2000"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
|
||||
while (metrics.testactivity.cycles.servicetime.count < 1000) {
|
||||
print('waiting 10ms because cycles<10000 : ' + metrics.testactivity.cycles.servicetime.count);
|
||||
scenario.waitMillis(10);
|
||||
|
||||
}
|
||||
scenario.stop(activitydef);
|
||||
print("count: " + metrics.testactivity.cycles.servicetime.count);
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//logger.info("testing dynamically changing threads.");
|
||||
activitydef = {
|
||||
"alias" : "speedcheck",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
|
||||
print("running 5E5 cycles at 1E5 cps ~~ 5 seconds worth");
|
||||
scenario.start(activitydef);
|
||||
|
||||
while (scenario.isRunningActivity(activitydef)) {
|
||||
achievedRate = metrics.speedcheck.cycles.servicetime.meanRate;
|
||||
currentCycle = metrics.speedcheck.cycles.servicetime.count;
|
||||
print("currentCycle = " + currentCycle + ", mean rate = " + achievedRate);
|
||||
scenario.waitMillis(1000);
|
||||
}
|
||||
|
||||
achievedRate = metrics.speedcheck.cycles.servicetime.meanRate;
|
||||
currentCycle = metrics.speedcheck.cycles.servicetime.count;
|
||||
print("last update - currentCycle = " + currentCycle + ", mean rate = " + achievedRate);
|
||||
|
||||
|
||||
scenario.stop(activitydef);
|
||||
//print('stopped scenario');
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "teststartstopdiag",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1000000000",
|
||||
"threads" : "25",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
print('starting activity teststartstopdiag');
|
||||
scenario.start(activitydef);
|
||||
|
||||
print('waiting 500 ms');
|
||||
|
||||
scenario.waitMillis(500);
|
||||
print('waited, stopping activity teststartstopdiag');
|
||||
scenario.stop(activitydef);
|
||||
|
||||
print('stopped activity teststartstopdiag');
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
stride_rate = {
|
||||
"alias" : "stride_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..50000",
|
||||
"stride" : "1",
|
||||
"threads" : "10",
|
||||
"striderate" : "10000",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
print('running stride_rate');
|
||||
scenario.run(10000,stride_rate);
|
||||
print('stride_rate finished');
|
||||
|
||||
print("metrics.stride_rate.strides.servicetime.meanRate = " + metrics.stride_rate.strides.servicetime.meanRate);
|
||||
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
scenario.start('type=diag;alias=threadchange;cycles=0..60000;threads=1;interval=2000;modulo=1000000;rate=1000');
|
||||
activities.threadchange.threads=1;
|
||||
print("threads now " + activities.threadchange.threads);
|
||||
print('waiting 500 ms');
|
||||
activities.threadchange.threads=5;
|
||||
print("threads now " + activities.threadchange.threads);
|
||||
scenario.stop('threadchange');
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "erroring_activity",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1500000",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
print('starting activity erroring_activity');
|
||||
scenario.start(activitydef1);
|
||||
scenario.waitMillis(2000);
|
||||
activities.erroring_activity.modulo="unparsable";
|
||||
scenario.awaitActivity("erroring_activity");
|
||||
print("awaited activity");
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "erroring_activity_init",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1500000",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500",
|
||||
"initdelay" : "unparsable",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
print('starting activity erroring_activity_init');
|
||||
scenario.start(activitydef1);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.awaitActivity("erroring_activity_init");
|
||||
print("awaited activity");
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "activity_to_await",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1500",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
print('starting activity teststartstopdiag');
|
||||
scenario.start(activitydef1);
|
||||
scenario.awaitActivity("activity_to_await");
|
||||
print("awaited activity");
|
@ -1,8 +0,0 @@
|
||||
basic_diag = params.withOverrides({
|
||||
"alias" : "basic_diag",
|
||||
"type" : "diag"
|
||||
});
|
||||
|
||||
|
||||
print('starting activity basic_diag');
|
||||
scenario.start(basic_diag);
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "blockingactivity1",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "1",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
};
|
||||
activitydef2 = {
|
||||
"alias" : "blockingactivity2",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "1",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
|
||||
print('running blockingactivity1');
|
||||
scenario.run(10000,activitydef1);
|
||||
print('blockingactivity1 finished');
|
||||
print('running blockingactivity2');
|
||||
scenario.run(10000,activitydef2);
|
||||
print('blockingactivity2 finished');
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
co_cycle_delay = {
|
||||
"alias": "co_cycle_delay",
|
||||
"type": "diag",
|
||||
"diagrate": "500",
|
||||
"cycles": "0..1000000",
|
||||
"threads": "10",
|
||||
"cyclerate": "1000,1.5",
|
||||
"modulo": "1000",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
print('starting activity co_cycle_delay');
|
||||
scenario.start(co_cycle_delay);
|
||||
for (i = 0; i < 5; i++) {
|
||||
scenario.waitMillis(1000);
|
||||
if (!scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("backlogging, cycles=" + metrics.co_cycle_delay.cycles.servicetime.count +
|
||||
" waittime=" + metrics.co_cycle_delay.cycles.waittime.value +
|
||||
" diagrate=" + activities.co_cycle_delay.diagrate +
|
||||
" cyclerate=" + activities.co_cycle_delay.cyclerate
|
||||
);
|
||||
}
|
||||
print('step1 metrics.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
activities.co_cycle_delay.diagrate = "10000";
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (!scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("recovering, cycles=" + metrics.co_cycle_delay.cycles.servicetime.count +
|
||||
" waittime=" + metrics.co_cycle_delay.cycles.waittime.value +
|
||||
" diagrate=" + activities.co_cycle_delay.diagrate +
|
||||
" cyclerate=" + activities.co_cycle_delay.cyclerate
|
||||
);
|
||||
|
||||
scenario.waitMillis(1000);
|
||||
if (metrics.co_cycle_delay.cycles.waittime.value < 50000000) {
|
||||
print("waittime trended back down as expected, exiting on iteration " + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//scenario.awaitActivity("co_cycle_delay");
|
||||
print('step2 metrics.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
scenario.stop(co_cycle_delay);
|
||||
print("stopped activity co_cycle_delay");
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
co_cycle_delay = {
|
||||
"alias" : "co_cycle_delay",
|
||||
"type" : "diag",
|
||||
"diagrate" : "800",
|
||||
"cycles" : "0..10000",
|
||||
"threads" : "1",
|
||||
"cyclerate" : "1000,1.0",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
print('starting activity co_cycle_delay');
|
||||
scenario.start(co_cycle_delay);
|
||||
scenario.waitMillis(4000);
|
||||
print('step1 cycles.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
activities.co_cycle_delay.diagrate="10000";
|
||||
for(i=0;i<5;i++) {
|
||||
if (! scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("iteration " + i + " waittime now " + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
scenario.waitMillis(1000);
|
||||
}
|
||||
|
||||
|
||||
//scenario.awaitActivity("co_cycle_delay");
|
||||
print('step2 cycles.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
print("awaited activity");
|
@ -1,34 +0,0 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "cycle_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "5K",
|
||||
"threads" : "10",
|
||||
"cyclerate" : "1K",
|
||||
"async" : 1000
|
||||
};
|
||||
|
||||
scenario.run(activitydef);
|
||||
|
||||
print("current cycle = " + metrics.cycle_rate.cycles.servicetime.count);
|
||||
print("mean cycle rate = " + metrics.cycle_rate.cycles.servicetime.meanRate);
|
||||
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "cycle_rate_change",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1000000",
|
||||
"threads" : "10",
|
||||
"cyclerate" : "2000",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
print('starting cycle_rate_change');
|
||||
scenario.start(activitydef);
|
||||
print('started');
|
||||
print('cyclerate at 0ms:' + activities.cycle_rate_change.cyclerate);
|
||||
scenario.waitMillis(500);
|
||||
activities.cycle_rate_change.cyclerate='1000';
|
||||
print("measured cycle increment per second is expected to adjust to 1000");
|
||||
|
||||
print('cyclerate now:' + activities.cycle_rate_change.cyclerate);
|
||||
|
||||
var lastcount=metrics.cycle_rate_change.cycles.servicetime.count;
|
||||
for(i=0;i<20;i++) {
|
||||
scenario.waitMillis(1000);
|
||||
var nextcount=metrics.cycle_rate_change.cycles.servicetime.count;
|
||||
var cycles = (nextcount - lastcount);
|
||||
print("new this second: " + (nextcount - lastcount));
|
||||
print(" waittime: " + metrics.cycle_rate_change.cycles.waittime.value);
|
||||
lastcount=nextcount;
|
||||
if (cycles>700 && cycles<1300) {
|
||||
print("cycles adjusted, exiting on iteration " + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
scenario.stop(activitydef);
|
||||
print('cycle_rate_change activity finished');
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
var csvlogger = csvmetrics.log("logs/csvmetricstestdir");
|
||||
|
||||
activitydef = {
|
||||
"alias" : "csvmetrics",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0",
|
||||
"async" : "1000"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
csvlogger.add(metrics.csvmetrics.cycles.servicetime);
|
||||
csvlogger.start(500,"MILLISECONDS");
|
||||
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
||||
|
||||
csvlogger.report();
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
var csvlogger = csvoutput.open("logs/csvoutputtestfile.csv","header1","header2");
|
||||
|
||||
csvlogger.write({"header1": "value1","header2":"value2"});
|
@ -1,2 +0,0 @@
|
||||
// Just an example
|
||||
var content = files.read("somefile.txt");
|
@ -1,4 +0,0 @@
|
||||
// Just an example
|
||||
var result= globalvars.put("result","OK")
|
||||
var result = globalvars.get("result");
|
||||
print("result="+result);
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testhistologger",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
histologger.logHistoIntervals("testing extention histologger", ".*", "hdrhistodata.log", "0.5s");
|
||||
print("started logging to hdrhistodata.log for all metrics at 1/2 second intervals.");
|
||||
|
||||
scenario.start(activitydef);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testhistostatslogger",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
histostatslogger.logHistoStats("testing extention histostatslogger", ".*", "logs/histostats.csv", "0.5s");
|
||||
print("started logging to logs/histostats.csv for all metrics at 1/2" +
|
||||
" second intervals.");
|
||||
|
||||
scenario.start(activitydef);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
@ -1 +0,0 @@
|
||||
var response = http.get("http://example.google.com")
|
@ -1,3 +0,0 @@
|
||||
// This requires active credentials, so it is disabled by default.
|
||||
// This still serves as an example
|
||||
// s3.uploadDirToUrl("testdata","s3://nb-extension-test/testdata1");
|
@ -1,3 +0,0 @@
|
||||
shutdown.addShutdownHook('testfunc', function f() {
|
||||
print("shutdown hook running");
|
||||
});
|
@ -1,2 +0,0 @@
|
||||
var sum= adder.getSum(12,34);
|
||||
print('sum is ' + sum);
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
var leader = {
|
||||
type: 'diag',
|
||||
alias: 'leader',
|
||||
targetrate: '10000',
|
||||
async: '1000'
|
||||
};
|
||||
|
||||
var follower = {
|
||||
type: 'diag',
|
||||
alias: 'follower',
|
||||
linkinput: 'leader',
|
||||
async: '1000'
|
||||
};
|
||||
|
||||
scenario.start(leader);
|
||||
print("started leader");
|
||||
scenario.start(follower);
|
||||
print("started follower");
|
||||
|
||||
scenario.waitMillis(500);
|
||||
|
||||
scenario.stop(leader);
|
||||
print("stopped leader");
|
||||
scenario.stop(follower);
|
||||
print("stopped follower");
|
||||
|
@ -1,26 +0,0 @@
|
||||
var optimo = optimos.init();
|
||||
|
||||
optimo.param('pa', 0.0, 200000.0);
|
||||
optimo.param('pb', 0.0, 200000.0);
|
||||
|
||||
optimo.setInitialRadius(10000.0).setStoppingRadius(0.001).setMaxEval(1000);
|
||||
|
||||
optimo.setObjectiveFunction(
|
||||
function (values) {
|
||||
// var arraydata = Java.from(ary);
|
||||
print("ary:" + JSON.stringify(values));
|
||||
|
||||
var a = 0.0 + values.pa;
|
||||
var b = 0.0 + values.pb;
|
||||
|
||||
var result = 1000000 - ((Math.abs(100 - a) + Math.abs(100 - b)));
|
||||
print("a=" + a + ",b=" + b + ", r=" + result);
|
||||
return result;
|
||||
}
|
||||
);
|
||||
|
||||
var result = optimo.optimize();
|
||||
|
||||
print("optimized result was " + result);
|
||||
print("map of result was " + result.getMap());
|
||||
|
@ -1,31 +0,0 @@
|
||||
// With the API support for Polyglot, we lost the ability to expose
|
||||
// map operations (underlying Java Map API) as well as proxy methods
|
||||
// on ECMA objects. What works now is object semantics + non-map methods.
|
||||
// More testing and refinement may be needed to clarify the rules here.
|
||||
|
||||
// previously:
|
||||
// print('params.get("one")=\'' + params.get("one") + "'"); // worked with nashorn
|
||||
// print('params.get("three")=\'' + params.get("three") + "'");
|
||||
// print('params.size()=' + params.size());
|
||||
|
||||
// Called with one=two three=four
|
||||
|
||||
print('params["one"]=\'' + params["one"] + "'");
|
||||
print('params["three"]=\'' + params["three"] + "'");
|
||||
|
||||
var overrides = {
|
||||
'three': "five"
|
||||
};
|
||||
|
||||
var overridden = params.withOverrides(overrides);
|
||||
|
||||
print('overridden["three"] [overridden-three-five]=\'' + overridden["three"] + "'");
|
||||
|
||||
var defaults = {
|
||||
'four': "niner"
|
||||
};
|
||||
|
||||
var defaulted = params.withDefaults(defaults);
|
||||
|
||||
print('defaulted.get["four"] [defaulted-four-niner]=\'' + defaulted["four"] + "'");
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "testactivity",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1000000000",
|
||||
"threads" : "25",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
|
||||
|
||||
scenario.waitMillis(500);
|
||||
while (metrics.testactivity.cycles.servicetime.count < 1000) {
|
||||
print('waiting 10ms because cycles<10000 : ' + metrics.testactivity.cycles.servicetime.count);
|
||||
scenario.waitMillis(10);
|
||||
|
||||
}
|
||||
scenario.stop(activitydef);
|
||||
print("count: " + metrics.testactivity.cycles.servicetime.count);
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
//logger.info("testing dynamically changing threads.");
|
||||
activitydef = {
|
||||
"alias" : "speedcheck",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
|
||||
print("running 5E5 cycles at 1E5 cps ~~ 5 seconds worth");
|
||||
scenario.start(activitydef);
|
||||
|
||||
while (scenario.isRunningActivity(activitydef)) {
|
||||
achievedRate = metrics.speedcheck.cycles.servicetime.meanRate;
|
||||
currentCycle = metrics.speedcheck.cycles.servicetime.count;
|
||||
print("currentCycle = " + currentCycle + ", mean rate = " + achievedRate);
|
||||
scenario.waitMillis(1000);
|
||||
}
|
||||
|
||||
achievedRate = metrics.speedcheck.cycles.servicetime.meanRate;
|
||||
currentCycle = metrics.speedcheck.cycles.servicetime.count;
|
||||
print("last update - currentCycle = " + currentCycle + ", mean rate = " + achievedRate);
|
||||
|
||||
|
||||
scenario.stop(activitydef);
|
||||
//print('stopped scenario');
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "teststartstopdiag",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1000000000",
|
||||
"threads" : "25",
|
||||
"interval" : "2000",
|
||||
"async" : "1000"
|
||||
};
|
||||
|
||||
print('starting activity teststartstopdiag');
|
||||
scenario.start(activitydef);
|
||||
|
||||
print('waiting 500 ms');
|
||||
|
||||
scenario.waitMillis(500);
|
||||
print('waited, stopping activity teststartstopdiag');
|
||||
scenario.stop(activitydef);
|
||||
|
||||
print('stopped activity teststartstopdiag');
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
stride_rate = {
|
||||
"alias" : "stride_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..12500",
|
||||
"stride" : "1",
|
||||
"threads" : "5",
|
||||
"striderate" : "2500",
|
||||
"interval" : "1000",
|
||||
"async" : 1000
|
||||
};
|
||||
|
||||
print('running stride_rate');
|
||||
scenario.run(10000,stride_rate);
|
||||
print('stride_rate finished');
|
||||
|
||||
print("metrics.stride_rate.strides.servicetime.meanRate = " + metrics.stride_rate.strides.servicetime.meanRate);
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
scenario.start('type=diag;alias=threadchange;cycles=0..60000;threads=1;interval=2000;modulo=1000000;async=1000;rate=1000');
|
||||
activities.threadchange.threads=1;
|
||||
print("threads now " + activities.threadchange.threads);
|
||||
print('waiting 500 ms');
|
||||
scenario.waitMillis(500);
|
||||
|
||||
activities.threadchange.threads=5;
|
||||
print("threads now " + activities.threadchange.threads);
|
||||
scenario.stop('threadchange');
|
@ -1,51 +0,0 @@
|
||||
activitydef = {
|
||||
"alias" : "threadspeeds",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..4000000000000",
|
||||
"threads" : "1",
|
||||
"interval" : "10000",
|
||||
"targetrate" : "1000000"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
|
||||
var speeds = [];
|
||||
var latencies = [];
|
||||
|
||||
function aTestCycle(threads, index) {
|
||||
activities.threadspeeds.threads = threads; // dynamically adjust the active threads for this activity
|
||||
scenario.waitMillis(60000); // wait for 1 minute to get a clean 1 minute average speed
|
||||
// scenario.waitMillis(5000); // wait for 1 minute to get a clean 1 minute average speed
|
||||
speeds[threads]= metrics.threadspeeds.cycles.oneMinuteRate; // record 1 minute avg speed
|
||||
print("speeds:" + speeds.toString());
|
||||
|
||||
}
|
||||
|
||||
var min=1;
|
||||
var max=256;
|
||||
var mid=Math.floor((min+max)/2)|0;
|
||||
|
||||
[min,mid,max].forEach(aTestCycle);
|
||||
|
||||
while (min<mid && mid<max && scenario.isRunningActivity(activitydef)) {
|
||||
print("speeds:" + speeds.toString());
|
||||
if (speeds[min]<speeds[max]) {
|
||||
min=mid;
|
||||
mid=Math.floor((mid+max) / 2)|0;
|
||||
} else {
|
||||
max=mid;
|
||||
mid=Math.floor((min+mid) / 2)|0;
|
||||
}
|
||||
aTestCycle(mid);
|
||||
}
|
||||
print("The optimum number of threads is " + mid + ", with " + speeds[mid] + " cps");
|
||||
var targetrate = (speeds[mid] * .7)|0;
|
||||
print("Measuring latency with threads=" + mid + " and targetrate=" + targetrate);
|
||||
|
||||
activities.threadspeeds.threads = mid;
|
||||
activities.threadspeeds.targetrate = targetrate;
|
||||
scenario.waitMillis(60000);
|
||||
|
||||
|
||||
scenario.stop(threadspeeds);
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
// With the API support for Polyglot, we lost the ability to expose
|
||||
// map operations (underlying Java Map API) as well as proxy methods
|
||||
// on ECMA objects. What works now is object semantics + non-map methods.
|
||||
// More testing and refinement may be needed to clarify the rules here.
|
||||
|
||||
print("params from command line:");
|
||||
print(params);
|
||||
print('before: params["three"]:' + params["three"]);
|
||||
print('before: params.three:' + params.three);
|
||||
|
||||
var overrides = {
|
||||
'three': "undef",
|
||||
};
|
||||
|
||||
print("params.three after overriding with three:UNDEF");
|
||||
params = params.withOverrides({'three':'UNDEF'});
|
||||
print(params);
|
||||
print('after: params["three"]:' + params["three"]);
|
||||
print('after: params.three:' + params.three);
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
activitydef1 = {
|
||||
"alias" : "erroring_activity",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1500000",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500"
|
||||
};
|
||||
|
||||
print('starting activity erroring_activity');
|
||||
scenario.start(activitydef1);
|
||||
scenario.waitMillis(2000);
|
||||
activities.erroring_activity.modulo="unparsable";
|
||||
scenario.awaitActivity("erroring_activity");
|
||||
print("awaited activity");
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef1 = {
|
||||
"alias" : "erroring_activity_init",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1500000",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500",
|
||||
"initdelay" : "unparsable"
|
||||
};
|
||||
|
||||
print('starting activity erroring_activity_init');
|
||||
scenario.start(activitydef1);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.awaitActivity("erroring_activity_init");
|
||||
print("awaited activity");
|
@ -1,12 +0,0 @@
|
||||
activitydef1 = {
|
||||
"alias" : "activity_to_await",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1500",
|
||||
"threads" : "1",
|
||||
"targetrate" : "500"
|
||||
};
|
||||
|
||||
print('starting activity teststartstopdiag');
|
||||
scenario.start(activitydef1);
|
||||
scenario.awaitActivity("activity_to_await");
|
||||
print("awaited activity");
|
@ -1,8 +0,0 @@
|
||||
basic_diag = params.withOverrides({
|
||||
"alias" : "basic_diag",
|
||||
"type" : "diag"
|
||||
});
|
||||
|
||||
|
||||
print('starting activity basic_diag');
|
||||
scenario.start(basic_diag);
|
@ -1,22 +0,0 @@
|
||||
activitydef1 = {
|
||||
"alias" : "blockingactivity1",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "1",
|
||||
"interval" : "2000"
|
||||
};
|
||||
activitydef2 = {
|
||||
"alias" : "blockingactivity2",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "1",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
|
||||
print('running blockingactivity1');
|
||||
scenario.run(10000,activitydef1);
|
||||
print('blockingactivity1 finished');
|
||||
print('running blockingactivity2');
|
||||
scenario.run(10000,activitydef2);
|
||||
print('blockingactivity2 finished');
|
@ -1,74 +0,0 @@
|
||||
co_cycle_delay = {
|
||||
"alias": "co_cycle_delay",
|
||||
"type": "diag",
|
||||
"diagrate": "500",
|
||||
"cycles": "0..1000000",
|
||||
"threads": "10",
|
||||
"cyclerate": "1000,1.5",
|
||||
"modulo": "1000"
|
||||
};
|
||||
|
||||
print('starting activity co_cycle_delay');
|
||||
scenario.start(co_cycle_delay);
|
||||
for (i = 0; i < 5; i++) {
|
||||
scenario.waitMillis(1000);
|
||||
if (!scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("backlogging, cycles=" + metrics.co_cycle_delay.cycles.servicetime.count +
|
||||
" waittime=" + metrics.co_cycle_delay.cycles.waittime.value +
|
||||
" diagrate=" + activities.co_cycle_delay.diagrate +
|
||||
" cyclerate=" + activities.co_cycle_delay.cyclerate
|
||||
);
|
||||
|
||||
// print("config: " +
|
||||
// " cycles.config_cyclerate=" + metrics.co_cycle_delay.cycles.config_cyclerate.value +
|
||||
// " cycles.config_burstrate=" + metrics.co_cycle_delay.cycles.config_burstrate.value +
|
||||
// " cycles.waittime=" + metrics.co_cycle_delay.cycles.waittime.value
|
||||
// );
|
||||
//
|
||||
// print("diag config: " +
|
||||
// " diag.config_cyclerate=" + metrics.co_cycle_delay.diag.config_cyclerate.value +
|
||||
// " diag.config_burstrate=" + metrics.co_cycle_delay.diag.config_burstrate.value +
|
||||
// " diag.waittime=" + metrics.co_cycle_delay.diag.waittime.value
|
||||
// );
|
||||
|
||||
}
|
||||
print('step1 metrics.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
activities.co_cycle_delay.diagrate = "10000";
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (!scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("recovering, cycles=" + metrics.co_cycle_delay.cycles.servicetime.count +
|
||||
" waittime=" + metrics.co_cycle_delay.cycles.waittime.value +
|
||||
" diagrate=" + activities.co_cycle_delay.diagrate +
|
||||
" cyclerate=" + activities.co_cycle_delay.cyclerate
|
||||
);
|
||||
|
||||
// print("cycles.config: " +
|
||||
// " cycles.config_cyclerate=" + metrics.co_cycle_delay.cycles.config_cyclerate.value +
|
||||
// " cycles.config_burstrate=" + metrics.co_cycle_delay.cycles.config_burstrate.value +
|
||||
// " cycles.waittime=" + metrics.co_cycle_delay.cycles.waittime.value
|
||||
// );
|
||||
//
|
||||
// print("diag config: " +
|
||||
// " diag.config_cyclerate=" + metrics.co_cycle_delay.diag.config_cyclerate.value +
|
||||
// " diag.config_burstrate=" + metrics.co_cycle_delay.diag.config_burstrate.value +
|
||||
// " diag.waittime=" + metrics.co_cycle_delay.diag.waittime.value
|
||||
// );
|
||||
|
||||
|
||||
scenario.waitMillis(1000);
|
||||
if (metrics.co_cycle_delay.cycles.waittime.value < 10000000) {
|
||||
print("waittime trended back down as expected, exiting on iteration " + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//scenario.awaitActivity("co_cycle_delay");
|
||||
print('step2 metrics.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
scenario.stop(co_cycle_delay);
|
||||
print("stopped activity co_cycle_delay");
|
@ -1,25 +0,0 @@
|
||||
co_cycle_delay = {
|
||||
"alias" : "co_cycle_delay",
|
||||
"type" : "diag",
|
||||
"diagrate" : "800",
|
||||
"cycles" : "0..10000",
|
||||
"threads" : "1",
|
||||
"cyclerate" : "1000,1.0"
|
||||
};
|
||||
|
||||
print('starting activity co_cycle_delay');
|
||||
scenario.start(co_cycle_delay);
|
||||
scenario.waitMillis(4000);
|
||||
print('step1 cycles.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
activities.co_cycle_delay.diagrate="10000";
|
||||
for(i=0;i<5;i++) {
|
||||
if (! scenario.isRunningActivity('co_cycle_delay')) {
|
||||
print("scenario exited prematurely, aborting.");
|
||||
break;
|
||||
}
|
||||
print("iteration " + i + " waittime now " + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
scenario.waitMillis(1000);
|
||||
}
|
||||
//scenario.awaitActivity("co_cycle_delay");
|
||||
print('step2 cycles.waittime=' + metrics.co_cycle_delay.cycles.waittime.value);
|
||||
print("awaited activity");
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
activitydef = {
|
||||
"alias" : "cycle_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..300000",
|
||||
"threads" : "10",
|
||||
"cyclerate" : "2000",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
print('starting cycle_rate');
|
||||
scenario.start(activitydef);
|
||||
print('started');
|
||||
print('cyclerate at 0ms:' + activities.cycle_rate.cyclerate);
|
||||
scenario.waitMillis(1000);
|
||||
activities.cycle_rate.cyclerate='50000';
|
||||
print("measured cycle increment per second is expected to adjust to 5000");
|
||||
print('cyclerate now:' + activities.cycle_rate.cyclerate);
|
||||
|
||||
var lastcount=metrics.cycle_rate.cycles.servicetime.count;
|
||||
for(i=0;i<10;i++) {
|
||||
scenario.waitMillis(1000);
|
||||
var nextcount=metrics.cycle_rate.cycles.servicetime.count;
|
||||
var cycles = (nextcount - lastcount);
|
||||
print("new this second: " + (nextcount - lastcount));
|
||||
lastcount=nextcount;
|
||||
if (cycles>4700 && cycles<5300) {
|
||||
print("cycles adjusted, exiting on iteration " + i)
|
||||
break;
|
||||
}
|
||||
}
|
||||
scenario.stop(activitydef);
|
||||
print('cycle_rate activity finished');
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
var csvlogger = csvmetrics.log("logs/csvmetricstestdir");
|
||||
|
||||
activitydef = {
|
||||
"alias" : "csvmetrics",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
csvlogger.add(metrics.csvmetrics.cycles.servicetime);
|
||||
csvlogger.start(500,"MILLISECONDS");
|
||||
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
||||
|
||||
csvlogger.report();
|
@ -1,15 +0,0 @@
|
||||
activitydef = {
|
||||
"alias" : "testhistologger",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
|
||||
histologger.logHistoIntervals("testing extention histologger", ".*", "hdrhistodata.log", "0.5s");
|
||||
print("started logging to hdrhistodata.log for all metrics at 1/2 second intervals.");
|
||||
|
||||
scenario.start(activitydef);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
@ -1,16 +0,0 @@
|
||||
activitydef = {
|
||||
"alias" : "testhistostatslogger",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
|
||||
histostatslogger.logHistoStats("testing extention histostatslogger", ".*", "logs/histostats.csv", "0.5s");
|
||||
print("started logging to logs/histostats.csv for all metrics at 1/2" +
|
||||
" second intervals.");
|
||||
|
||||
scenario.start(activitydef);
|
||||
scenario.waitMillis(2000);
|
||||
scenario.stop(activitydef);
|
@ -1,2 +0,0 @@
|
||||
var sum= adder.getSum(12,34);
|
||||
print('sum is ' + sum);
|
@ -1,24 +0,0 @@
|
||||
var leader = {
|
||||
type: 'diag',
|
||||
alias: 'leader',
|
||||
targetrate: '10000'
|
||||
};
|
||||
|
||||
var follower = {
|
||||
type: 'diag',
|
||||
alias: 'follower',
|
||||
linkinput: 'leader'
|
||||
};
|
||||
|
||||
scenario.start(leader);
|
||||
print("started leader");
|
||||
scenario.start(follower);
|
||||
print("started follower");
|
||||
|
||||
scenario.waitMillis(500);
|
||||
|
||||
scenario.stop(leader);
|
||||
print("stopped leader");
|
||||
scenario.stop(follower);
|
||||
print("stopped follower");
|
||||
|
@ -1,13 +0,0 @@
|
||||
print('params.get("one")=\'' + params.get("one") + "'");
|
||||
print('params.get("three")=\'' + params.get("three") + "'");
|
||||
print('params.size()=' + params.size());
|
||||
|
||||
var overrides = {
|
||||
'three': "five"
|
||||
};
|
||||
print('params.get("three") [overridden-three-five]=\'' + params.withOverrides(overrides).get("three") + "'");
|
||||
var defaults = {
|
||||
'four': "niner"
|
||||
};
|
||||
print('params.get("four") [defaulted-four-niner]=\'' + params.withDefaults(defaults).get("four") + "'");
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
phase_rate = {
|
||||
"alias" : "phase_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..100000",
|
||||
"threads" : "10",
|
||||
"phaserate" : "25000",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
print('running phase_rate');
|
||||
scenario.run(10000,phase_rate);
|
||||
print('phase_rate finished');
|
||||
|
||||
print("phase_rate.phases.servicetime.meanRate = " + metrics.phase_rate.phases.servicetime.meanRate);
|
||||
print("value is expected to be 25000 +-1000");
|
||||
|
@ -1,16 +0,0 @@
|
||||
activitydef = {
|
||||
"alias" : "testactivity",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1000000000",
|
||||
"threads" : "25",
|
||||
"interval" : "2000"
|
||||
};
|
||||
scenario.start(activitydef);
|
||||
|
||||
while (metrics.testactivity.cycles.servicetime.count < 1000) {
|
||||
print('waiting 10ms because cycles<10000 : ' + metrics.testactivity.cycles.servicetime.count);
|
||||
scenario.waitMillis(10);
|
||||
|
||||
}
|
||||
scenario.stop(activitydef);
|
||||
print("count: " + metrics.testactivity.cycles.servicetime.count);
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
//logger.info("testing dynamically changing threads.");
|
||||
activitydef = {
|
||||
"alias" : "speedcheck",
|
||||
"type" : "diag",
|
||||
"cycles" : "50000",
|
||||
"threads" : "20",
|
||||
"interval" : "2000",
|
||||
"targetrate" : "10000.0"
|
||||
};
|
||||
|
||||
print("running 5E5 cycles at 1E5 cps ~~ 5 seconds worth");
|
||||
scenario.start(activitydef);
|
||||
|
||||
while (scenario.isRunningActivity(activitydef)) {
|
||||
achievedRate = metrics.speedcheck.cycles.servicetime.meanRate;
|
||||
currentCycle = metrics.speedcheck.cycles.servicetime.count;
|
||||
print("currentCycle = " + currentCycle + ", mean rate = " + achievedRate);
|
||||
scenario.waitMillis(1000);
|
||||
}
|
||||
|
||||
achievedRate = metrics.speedcheck.cycles.servicetime.meanRate;
|
||||
currentCycle = metrics.speedcheck.cycles.servicetime.count;
|
||||
print("last update - currentCycle = " + currentCycle + ", mean rate = " + achievedRate);
|
||||
|
||||
|
||||
scenario.stop(activitydef);
|
||||
//print('stopped scenario');
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
activitydef = {
|
||||
"alias" : "teststartstopdiag",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..1000000000",
|
||||
"threads" : "25",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
print('starting activity teststartstopdiag');
|
||||
scenario.start(activitydef);
|
||||
|
||||
print('waiting 500 ms');
|
||||
|
||||
scenario.waitMillis(500);
|
||||
print('waited, stopping activity teststartstopdiag');
|
||||
scenario.stop(activitydef);
|
||||
|
||||
print('stopped activity teststartstopdiag');
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016 jshook
|
||||
* 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
stride_rate = {
|
||||
"alias" : "stride_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "0..50000",
|
||||
"stride" : "1",
|
||||
"threads" : "10",
|
||||
"striderate" : "10000",
|
||||
"interval" : "2000"
|
||||
};
|
||||
|
||||
print('running stride_rate');
|
||||
scenario.run(10000,stride_rate);
|
||||
print('stride_rate finished');
|
||||
|
||||
print("metrics.stride_rate.strides.servicetime.meanRate = " + metrics.stride_rate.strides.servicetime.meanRate);
|
||||
|
@ -1,17 +0,0 @@
|
||||
|
||||
activitydef = {
|
||||
"alias" : "sync_cycle_rate",
|
||||
"type" : "diag",
|
||||
"cycles" : "5K",
|
||||
"threads" : "10",
|
||||
"cyclerate" : "1K",
|
||||
"phases" : 15
|
||||
};
|
||||
|
||||
scenario.run(activitydef);
|
||||
|
||||
print("current cycle = " + metrics.sync_cycle_rate.cycles.servicetime.count);
|
||||
print("mean cycle rate = " + metrics.sync_cycle_rate.cycles.servicetime.meanRate);
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user