本文整理汇总了Java中org.apache.jmeter.samplers.SampleResult.getEndTime方法的典型用法代码示例。如果您正苦于以下问题:Java SampleResult.getEndTime方法的具体用法?Java SampleResult.getEndTime怎么用?Java SampleResult.getEndTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.samplers.SampleResult
的用法示例。
在下文中一共展示了SampleResult.getEndTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateIntervals
import org.apache.jmeter.samplers.SampleResult; //导入方法依赖的package包/类
private static JSONArray calculateIntervals(List<SampleResult> list) {
Map<Long, List<SampleResult>> intervals = new HashMap<>();
for (SampleResult sample : list) {
long time = sample.getEndTime() / 1000;
if (!intervals.containsKey(time)) {
intervals.put(time, new LinkedList<SampleResult>());
}
intervals.get(time).add(sample);
}
JSONArray result = new JSONArray();
for (Long second : intervals.keySet()) {
JSONObject intervalResult = new JSONObject();
List<SampleResult> intervalValues = intervals.get(second);
intervalResult.put("ts", second);
intervalResult.put("n", intervalValues.size());
intervalResult.put("rc", generateResponseCodec(intervalValues));
int fails = getFails(intervalValues);
intervalResult.put("ec", fails);
intervalResult.put("failed", fails);
intervalResult.put("na", getThreadsCount(intervalValues));
final Map<String, Object> mainMetrics = getMainMetrics(intervalValues);
int intervalSize = intervalValues.size();
intervalResult.put("t", generateTimestamp(mainMetrics, intervalSize));
intervalResult.put("lt", generateLatencyTime(mainMetrics, intervalSize));
intervalResult.put("by", generateBytes(mainMetrics, intervalSize));
result.add(intervalResult);
}
return result;
}
示例2: sortResults
import org.apache.jmeter.samplers.SampleResult; //导入方法依赖的package包/类
private SortedMap<Long, List<SampleResult>> sortResults(List<SampleResult> list) {
SortedMap<Long, List<SampleResult>> sortedResults = new TreeMap<>();
for (SampleResult result : list) {
long time = result.getEndTime() / 1000;
if (!sortedResults.containsKey(time)) {
sortedResults.put(time, new LinkedList<SampleResult>());
}
sortedResults.get(time).add(result);
}
return sortedResults;
}
示例3: getMainMetrics
import org.apache.jmeter.samplers.SampleResult; //导入方法依赖的package包/类
private static Map<String, Object> getMainMetrics(List<SampleResult> list) {
long first = Long.MAX_VALUE;
long last = 0;
long failed = 0;
long bytesCount = 0;
long sumTime = 0;
long sumLatency = 0;
Long[] rtimes = new Long[list.size()];
int counter = 0;
for (SampleResult sample : list) {
long endTime = sample.getEndTime();
if (endTime < first) {
first = endTime;
}
if (endTime > last) {
last = endTime;
}
if (!sample.isSuccessful()) {
failed++;
}
bytesCount += sample.getBytes();
sumTime += sample.getTime();
sumLatency += sample.getLatency();
rtimes[counter] = sample.getTime();
counter++;
}
final Map<String, Object> results = new HashMap<>();
results.put("first", first);
results.put("last", last);
results.put("failed", failed);
results.put("bytesCount", bytesCount);
results.put("sumTime", sumTime);
results.put("sumLatency", sumLatency);
results.put("rtimes", rtimes);
return results;
}