@Override public void add(SampleResult res) { String threadName = res.getThreadName(); threadName = threadName.lastIndexOf(" ") >= 0 ? threadName.substring(0, threadName.lastIndexOf(" ")) : threadName; // System.out.println(threadName); addCount(threadName, res.getGroupThreads(), res.getStartTime()); }
@Override public void add(SampleResult res) { String threadName = res.getThreadName(); threadName = threadName.lastIndexOf(" ") >= 0 ? threadName.substring(0, threadName.lastIndexOf(" ")) : threadName; // System.out.println(threadName); addCount(threadName, res.getGroupThreads(), res.getStartTime()); }
/** * Generates the key to be used for aggregating samples as follows:<br> * <code>sampleLabel</code> "-" <code>[threadName|threadGroup]</code> * <p> * N.B. the key should agree with the fixed items that are saved in the sample. * * @param event sample event whose key is to be calculated * @param keyOnThreadName true if key should use thread name, otherwise use thread group * @return the key to use for aggregating samples */ public static String getKey(SampleEvent event, boolean keyOnThreadName) { StringBuilder sb = new StringBuilder(80); sb.append(event.getResult().getSampleLabel()); if (keyOnThreadName){ sb.append('-').append(event.getResult().getThreadName()); } else { sb.append('-').append(event.getThreadGroup()); } return sb.toString(); } }
@Override public void add(SampleResult res) { if (!isSampleIncluded(res)) { return; } super.add(res); String threadName = res.getThreadName(); // SUBString to extract thread group name from thread name threadName = threadName.lastIndexOf(" ") >= 0 ? threadName.substring(0, threadName.lastIndexOf(" ")) : threadName; //fix response to fast can miss points long timeForAgg = Math.max(getGranulation(), res.getTime()); addThreadGroupRecord(threadName, normalizeTime(res.getEndTime()), res.getGroupThreads(), timeForAgg); updateGui(null); }
@Override public void add(SampleResult res) { if (!isSampleIncluded(res)) { return; } super.add(res); String threadName = res.getThreadName(); // SUBString to extract thread group name from thread name threadName = threadName.lastIndexOf(" ") >= 0 ? threadName.substring(0, threadName.lastIndexOf(" ")) : threadName; //fix response to fast can miss points long timeForAgg = Math.max(getGranulation(), res.getTime()); addThreadGroupRecord(threadName, normalizeTime(res.getEndTime()), res.getGroupThreads(), timeForAgg); updateGui(null); }
@Override public void add(SampleResult res) { if (!isSampleIncluded(res)) { return; } super.add(res); String threadName = res.getThreadName(); // SUBString to extract thread group name from thread name threadName = threadName.lastIndexOf(" ") >= 0 ? threadName.substring(0, threadName.lastIndexOf(" ")) : threadName; //fix response to fast can miss points long timeForAgg = Math.max(getGranulation(), res.getTime()); addThreadGroupRecord(threadName, normalizeTime(res.getEndTime()), res.getGroupThreads(), timeForAgg); updateGui(null); }
buf.put(result.getThreadName().getBytes(JMeterPluginsUtils.CHARSET)); break;
buf.put(result.getThreadName().getBytes(JMeterPluginsUtils.CHARSET)); break;
/** * 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; }
this.json.put("SampleCount", this.sampleResult.getSampleCount()); this.json.put("SampleLabel", this.sampleResult.getSampleLabel()); this.json.put("ThreadName", this.sampleResult.getThreadName()); this.json.put("URL", this.sampleResult.getURL()); this.json.put("ResponseCode", this.sampleResult.getResponseCode());
res.getSampleCount(), res.getStartTime(), res.getThreadName(), res.getSampleLabel(), res.getTime(),
/** * Add a subresult and adjust the parent byte count and end-time. * * @param subResult * the {@link SampleResult} to be added * @param renameSubResults boolean do we rename subResults based on position */ public void addSubResult(SampleResult subResult, boolean renameSubResults) { if(subResult == null) { // see https://bz.apache.org/bugzilla/show_bug.cgi?id=54778 return; } String tn = getThreadName(); if (tn.length()==0) { tn=Thread.currentThread().getName();//TODO do this more efficiently this.setThreadName(tn); } subResult.setThreadName(tn); // TODO is this really necessary? // Extend the time to the end of the added sample setEndTime(Math.max(getEndTime(), subResult.getEndTime() + nanoTimeOffset - subResult.nanoTimeOffset)); // Bug 51855 // Include the byte count for the added sample setBytes(getBytesAsLong() + subResult.getBytesAsLong()); setSentBytes(getSentBytes() + subResult.getSentBytes()); setHeadersSize(getHeadersSize() + subResult.getHeadersSize()); setBodySize(getBodySizeAsLong() + subResult.getBodySizeAsLong()); addRawSubResult(subResult, renameSubResults); }
/** * Processes sampler results. */ public void handleSampleResults(List<SampleResult> sampleResults, BackendListenerContext context) { // Gather all the listeners List<SampleResult> allSampleResults = new ArrayList<SampleResult>(); for (SampleResult sampleResult : sampleResults) { allSampleResults.add(sampleResult); if(recordSubSamples) { for (SampleResult subResult : sampleResult.getSubResults()) { allSampleResults.add(subResult); } } } for(SampleResult sampleResult: allSampleResults) { getUserMetrics().add(sampleResult); if ((null != regexForSamplerList && sampleResult.getSampleLabel().matches(regexForSamplerList)) || samplersToFilter.contains(sampleResult.getSampleLabel())) { Point point = Point.measurement(RequestMeasurement.MEASUREMENT_NAME).time( System.currentTimeMillis() * ONE_MS_IN_NANOSECONDS + getUniqueNumberForTheSamplerThread(), TimeUnit.NANOSECONDS) .tag(RequestMeasurement.Tags.REQUEST_NAME, sampleResult.getSampleLabel()) .addField(RequestMeasurement.Fields.ERROR_COUNT, sampleResult.getErrorCount()) .addField(RequestMeasurement.Fields.THREAD_NAME, sampleResult.getThreadName()) .tag(RequestMeasurement.Tags.RUN_ID, runId) .tag(RequestMeasurement.Tags.TEST_NAME, testName) .addField(RequestMeasurement.Fields.NODE_NAME, nodeName) .addField(RequestMeasurement.Fields.RESPONSE_TIME, sampleResult.getTime()).build(); influxDB.write(influxDBConfig.getInfluxDatabase(), influxDBConfig.getInfluxRetentionPolicy(), point); } } }
.append(JMeterUtils .getResString("view_results_thread_name")) //$NON-NLS-1$ .append(sampleResult.getThreadName()).append(NL); String startTime = dateFormat .format(new Date(sampleResult.getStartTime())); sampleResult.getThreadName())); resultModel.addRow(new RowResult( JMeterUtils.getParsedLabel("view_results_sample_start"), //$NON-NLS-1$
writer.addAttribute(ATT_THREADNAME, ConversionHelp.encode(res.getThreadName()));
@Override public void sampleOccurred(SampleEvent se) { if (!isGenerateParentSample()) { // Check if we are still sampling our children if(res != null && !se.isTransactionSampleEvent()) { SampleResult sampleResult = se.getResult(); res.setThreadName(sampleResult.getThreadName()); res.setBytes(res.getBytesAsLong() + sampleResult.getBytesAsLong()); res.setSentBytes(res.getSentBytes() + sampleResult.getSentBytes()); if (!isIncludeTimers()) {// Accumulate waiting time for later pauseTime += sampleResult.getEndTime() - sampleResult.getTime() - prevEndTime; prevEndTime = sampleResult.getEndTime(); } if(!sampleResult.isSuccessful()) { res.setSuccessful(false); noFailingSamples++; } res.setAllThreads(sampleResult.getAllThreads()); res.setGroupThreads(sampleResult.getGroupThreads()); res.setLatency(res.getLatency() + sampleResult.getLatency()); res.setConnectTime(res.getConnectTime() + sampleResult.getConnectTime()); } } }
text.append(sample.getThreadName());