Skip to content

Commit

Permalink
added hdr histo logging builder
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkWolters committed Oct 5, 2023
1 parent 44fd5cd commit 55fc0d1
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 174 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.nosqlbench.engine.extensions.globalvars;

import io.nosqlbench.api.config.LabeledScenarioContext;
import io.nosqlbench.api.extensions.ScriptingExtensionPluginInfo;
import io.nosqlbench.components.NBComponent;
import io.nosqlbench.nb.annotations.Service;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package io.nosqlbench.api.engine.conversions;
package io.nosqlbench.api.conversions;

public class ConverterUtils {
public static int[] toIntArray(String[] strings) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 nosqlbench
* Copyright (c) 2022-2023 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -12,9 +12,10 @@
* 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 io.nosqlbench.engine.extensions.files;
package io.nosqlbench.api.files;

import io.nosqlbench.api.content.NBIO;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022-2023 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.
*
*/

package io.nosqlbench.api.histologger;

import io.nosqlbench.api.engine.metrics.HistoIntervalLogger;
import io.nosqlbench.api.engine.util.Unit;
import io.nosqlbench.components.NBBaseComponent;
import io.nosqlbench.components.NBComponent;

import java.io.File;
import java.util.regex.Pattern;

public class HdrHistoLog extends NBBaseComponent {

public HdrHistoLog(NBComponent baseComponent) {
super(baseComponent);
}

public void logHistoIntervals(String session, String pattern, String filename, String interval) {
if (filename.contains("_SESSION_")) {
filename = filename.replace("_SESSION_", session);
}
Pattern compiledPattern = Pattern.compile(pattern);
File logfile = new File(filename);
long intervalMillis = Unit.msFor(interval).orElseThrow(() ->
new RuntimeException("Unable to parse interval spec:'" + interval + '\''));

HistoIntervalLogger histoIntervalLogger =
new HistoIntervalLogger(session, logfile, compiledPattern, intervalMillis);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package io.nosqlbench.api.engine.optimizers;
package io.nosqlbench.api.optimizers;

import io.nosqlbench.components.NBBaseComponent;
import io.nosqlbench.components.NBComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package io.nosqlbench.api.engine.optimizers;
package io.nosqlbench.api.optimizers;

import org.apache.commons.math3.analysis.MultivariateFunction;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package io.nosqlbench.api.engine.optimizers;
package io.nosqlbench.api.optimizers;

import java.util.ArrayList;
import java.util.Iterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package io.nosqlbench.api.engine.optimizers;
package io.nosqlbench.api.optimizers;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/

package io.nosqlbench.api.engine.optimizers;
package io.nosqlbench.api.optimizers;

import org.apache.commons.math3.analysis.MultivariateFunction;
import org.graalvm.polyglot.proxy.ProxyObject;
Expand Down
13 changes: 11 additions & 2 deletions nb-api/src/main/java/io/nosqlbench/components/NBBuilders.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
import io.nosqlbench.api.engine.metrics.reporters.CsvReporter;
import io.nosqlbench.api.engine.metrics.reporters.MetricInstanceFilter;
import io.nosqlbench.api.engine.metrics.reporters.PromPushReporterComponent;
import io.nosqlbench.api.engine.optimizers.BobyqaOptimizerInstance;
import io.nosqlbench.api.histologger.HdrHistoLog;
import io.nosqlbench.api.optimizers.BobyqaOptimizerInstance;
import io.nosqlbench.api.files.FileAccess;
import io.nosqlbench.api.labels.NBLabels;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.File;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.DoubleSummaryStatistics;
Expand Down Expand Up @@ -112,6 +113,14 @@ public BobyqaOptimizerInstance bobyqaOptimizer(final NBComponent component) {
return new BobyqaOptimizerInstance(component);
}

public FileAccess fileAccess(String filename) {
return new FileAccess();
}

public HdrHistoLog hdrHistoLog(NBComponent component) {
return new HdrHistoLog(component);
}

public static class CsvOutputWriterBuilder {
//CsvOutputPluginWriter(NBComponent component, String filename, String... headers) {
private final NBComponent component;
Expand Down

0 comments on commit 55fc0d1

Please sign in to comment.