/** * Create a statistical sample result from an ordinary sample result. * * @param res the sample result */ public StatisticalSampleResult(SampleResult res) { // Copy data that is shared between samples (i.e. the key items): setSampleLabel(res.getSampleLabel()); setThreadName(res.getThreadName()); setSuccessful(true); // Assume result is OK setSampleCount(0); // because we add the sample count in later elapsed = 0; }
private String getRespCodeLabel(SampleResult res) { //double ref to be thread safe on clearData call String ret = prefix; if (ret == null) { prefix = ""; ret = ""; } return ret + res.getResponseCode(); }
/** * Returns the display name. * * @return display name of this sample result */ @Override public String toString() { return getSampleLabel(); }
/** * Start the sample request and set the {@code samplerData} to {@code data}. * * @param result * the sample result to update * @param data * the request to set as {@code samplerData} */ private void sampleResultStart(SampleResult result, String data) { result.setSamplerData(data); result.sampleStart(); }
/** * Strip response but fill in bytes field. * @param result {@link SampleResult} */ private void stripResponse(SampleResult result) { result.setBytes(result.getBytesAsLong()); result.setResponseData(EMPTY_BA); }
/** * Convert a result into a string, where the fields of the result are * separated by the default delimiter. * * @param event * the sample event to be converted * @return the separated value representation of the result */ public static String resultToDelimitedString(SampleEvent event) { return resultToDelimitedString(event, event.getResult().getSaveConfig() .getDelimiter()); }
/** * @param res */ private void setStartTime(SampleResult res) { long startTime = res.getStartTime(); if (firstTime > startTime) { // this is our first sample, set the start time to current timestamp firstTime = startTime; } }
/** {@inheritDoc} */ // TODO does not work yet; need to determine the sample type @Override public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { SampleEvent evt = new SampleEvent(); return evt; } }
/** * Add a subresult and adjust the parent byte count and end-time. * * @param subResult * the {@link SampleResult} to be added */ public void addSubResult(SampleResult subResult) { addSubResult(subResult, true); } /**
public void addTestElement(TestElement el) { if (el instanceof HeaderManager) { headerManager = (HeaderManager) el; } else { super.addTestElement(el); } }
/** * Returns the dataEncoding or the default if no dataEncoding was provided. * * @return the value of the dataEncoding or DEFAULT_ENCODING */ public String getDataEncodingWithDefault() { return getDataEncodingWithDefault(DEFAULT_ENCODING); }
@Override public void sampleOccurred(SampleEvent e) { if (sampleListener != null) { sampleListener.sampleOccurred(e); } }
/** * Add a subresult to the collection without updating any parent fields. * * @param subResult * the {@link SampleResult} to be added */ public void addRawSubResult(SampleResult subResult){ storeSubResult(subResult, true); }
SampleResult(boolean nanoTime, long nanoThreadSleep) { this.elapsedTime = 0; this.useNanoTime = nanoTime; this.nanoThreadSleep = nanoThreadSleep; this.nanoTimeOffset = initOffset(); }
/** * @return capacity */ private int getCapacity() { return isClientConfigured() ? clientConfiguredCapacity : SERVER_CONFIGURED_CAPACITY; }
public RemoteListenerWrapper(RemoteSampleListener l) { listener = l; // Get appropriate sender class governed by the behaviour set in the JMeter property sender = SampleSenderFactory.getInstance(listener); }
/** * A sample has started. */ @Override public void sampleStarted(SampleEvent e) { if (sampleListener != null) { sampleListener.sampleStarted(e); } }
private String getRespCodeLabel(SampleResult res) { //double ref to be thread safe on clearData call String ret = prefix; if (ret == null) { prefix = ""; ret = ""; } return ret + res.getResponseCode(); }
/** * Add a subresult to the collection without updating any parent fields. * * @param subResult * the {@link SampleResult} to be added */ private void addRawSubResult(SampleResult subResult, boolean renameSubResults){ storeSubResult(subResult, renameSubResults); }