本文整理匯總了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;
}