當前位置: 首頁>>代碼示例>>Java>>正文


Java SampleResult.isSuccessful方法代碼示例

本文整理匯總了Java中org.apache.jmeter.samplers.SampleResult.isSuccessful方法的典型用法代碼示例。如果您正苦於以下問題:Java SampleResult.isSuccessful方法的具體用法?Java SampleResult.isSuccessful怎麽用?Java SampleResult.isSuccessful使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.jmeter.samplers.SampleResult的用法示例。


在下文中一共展示了SampleResult.isSuccessful方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAggregateSecond

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
private JSONObject getAggregateSecond(Long sec, List<SampleResult> raw) {
    /*
     "rc": item.http_codes,
     "net": item.net_codes
     */
    JSONObject result = new JSONObject();
    Date ts = new Date(sec * 1000);
    log.debug("Aggregating " + sec);
    result.put("ts", format.format(ts));

    int avg_rt = 0;
    Long[] rtimes = new Long[raw.size()];
    String[] rcodes = new String[raw.size()];
    int cnt = 0;
    int failedCount = 0;
    long maxThreadCount = 0;
    for (SampleResult res : raw) {
        if (maxThreadCount < res.getAllThreads()) {
            maxThreadCount = res.getAllThreads();
        }

        avg_rt += res.getTime();
        rtimes[cnt] = res.getTime();
        rcodes[cnt] = res.getResponseCode();
        if (!res.isSuccessful()) {
            failedCount++;
        }
        cnt++;
    }

    result.put("rps", cnt);
    result.put("threads", maxThreadCount);
    result.put("avg_rt", avg_rt / cnt);
    result.put("quantiles", getQuantilesJSON(rtimes));
    result.put("net", getNetJSON(failedCount, cnt - failedCount));
    result.put("rc", getRCJSON(rcodes));
    result.put("planned_rps", 0); // JMeter has no such feature like Yandex.Tank
    return result;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:40,代碼來源:LoadosophiaClient.java

示例2: getFails

import org.apache.jmeter.samplers.SampleResult; //導入方法依賴的package包/類
private static int getFails(List<SampleResult> list) {
    int res = 0;
    for (SampleResult result : list) {
        if (!result.isSuccessful()) {
            res++;
        }
    }
    return res;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:10,代碼來源:JSONConverter.java

示例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;
}
 
開發者ID:Blazemeter,項目名稱:jmeter-bzm-plugins,代碼行數:45,代碼來源:JSONConverter.java


注:本文中的org.apache.jmeter.samplers.SampleResult.isSuccessful方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。