当前位置: 首页>>代码示例>>Java>>正文


Java ThreadCounts类代码示例

本文整理汇总了Java中org.apache.jmeter.threads.JMeterContextService.ThreadCounts的典型用法代码示例。如果您正苦于以下问题:Java ThreadCounts类的具体用法?Java ThreadCounts怎么用?Java ThreadCounts使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ThreadCounts类属于org.apache.jmeter.threads.JMeterContextService包,在下文中一共展示了ThreadCounts类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.apache.jmeter.threads.JMeterContextService.ThreadCounts; //导入依赖的package包/类
/**
 * Periodically writes virtual users metrics to influxDB.
 */
public void run() {
	try {
		ThreadCounts tc = JMeterContextService.getThreadCounts();
		addVirtualUsersMetrics(getUserMetrics().getMinActiveThreads(), getUserMetrics().getMeanActiveThreads(), getUserMetrics().getMaxActiveThreads(), tc.startedThreads, tc.finishedThreads);
	} catch (Exception e) {
		LOGGER.error("Failed writing to influx", e);
	}
}
 
开发者ID:NovaTecConsulting,项目名称:JMeter-InfluxDB-Writer,代码行数:12,代码来源:JMeterInfluxDBBackendListenerClient.java

示例2: format

import org.apache.jmeter.threads.JMeterContextService.ThreadCounts; //导入依赖的package包/类
/**
 * Formats summariserRunningSample
 * @param name Summariser name
 * @param summariserRunningSample {@link SummariserRunningSample}
 * @param type Type of summariser (difference or total)
 * @return the summary information
 */
private static String format(String name, SummariserRunningSample summariserRunningSample, String type) {
    DecimalFormat dfDouble = new DecimalFormat("#0.0"); // $NON-NLS-1$
    StringBuilder tmp = new StringBuilder(20); // for intermediate use
    StringBuilder sb = new StringBuilder(100); // output line buffer
    sb.append(name);
    sb.append(" ");
    sb.append(type);
    sb.append(" ");
    sb.append(longToSb(tmp, summariserRunningSample.getNumSamples(), 6));
    sb.append(" in ");
    long elapsed = summariserRunningSample.getElapsed();
    long elapsedSec = (elapsed + 500) / 1000; // rounded seconds
    sb.append(JOrphanUtils.formatDuration(elapsedSec));
    sb.append(" = ");
    if (elapsed > 0) {
        sb.append(doubleToSb(dfDouble, tmp, summariserRunningSample.getRate(), 6, 1));
    } else {
        sb.append("******");// Rate is effectively infinite
    }
    sb.append("/s Avg: ");
    sb.append(longToSb(tmp, summariserRunningSample.getAverage(), 5));
    sb.append(" Min: ");
    sb.append(longToSb(tmp, summariserRunningSample.getMin(), 5));
    sb.append(" Max: ");
    sb.append(longToSb(tmp, summariserRunningSample.getMax(), 5));
    sb.append(" Err: ");
    sb.append(longToSb(tmp, summariserRunningSample.getErrorCount(), 5));
    sb.append(" (");
    sb.append(summariserRunningSample.getErrorPercentageString());
    sb.append(")");
    if ("+".equals(type)) {
        ThreadCounts tc = JMeterContextService.getThreadCounts();
        sb.append(" Active: ");
        sb.append(tc.activeThreads);
        sb.append(" Started: ");
        sb.append(tc.startedThreads);
        sb.append(" Finished: ");
        sb.append(tc.finishedThreads);
    }
    return sb.toString();
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:49,代码来源:Summariser.java

示例3: format

import org.apache.jmeter.threads.JMeterContextService.ThreadCounts; //导入依赖的package包/类
/**
 * @param myTotal
 * @param string
 * @return the sunnary information
 */
private static String format(String name, RunningSample s, String type) {
    DecimalFormat dfDouble = new DecimalFormat("#0.0"); // $NON-NLS-1$
    StringBuilder tmp = new StringBuilder(20); // for intermediate use
    StringBuilder sb = new StringBuilder(100); // output line buffer
    sb.append(name);
    sb.append(" ");
    sb.append(type);
    sb.append(" ");
    sb.append(longToSb(tmp, s.getNumSamples(), 6));
    sb.append(" in ");
    long elapsed = s.getElapsed();
    long elapsedSec = (elapsed + 500) / 1000; // rounded seconds
    if (elapsedSec > 100       // No point displaying decimals (less than 1% error)
     || (elapsed - elapsedSec * 1000) < 50 // decimal would be zero
     ) {
        sb.append(longToSb(tmp, elapsedSec, 5));
    } else {
        double elapsedSecf = elapsed / 1000.0d; // fractional seconds
        sb.append(doubleToSb(dfDouble, tmp, elapsedSecf, 5, 1)); // This will round
    }
    sb.append("s = ");
    if (elapsed > 0) {
        sb.append(doubleToSb(dfDouble, tmp, s.getRate(), 6, 1));
    } else {
        sb.append("******");// Rate is effectively infinite
    }
    sb.append("/s Avg: ");
    sb.append(longToSb(tmp, s.getAverage(), 5));
    sb.append(" Min: ");
    sb.append(longToSb(tmp, s.getMin(), 5));
    sb.append(" Max: ");
    sb.append(longToSb(tmp, s.getMax(), 5));
    sb.append(" Err: ");
    sb.append(longToSb(tmp, s.getErrorCount(), 5));
    sb.append(" (");
    sb.append(s.getErrorPercentageString());
    sb.append(")");
    if ("+".equals(type)) {
        ThreadCounts tc = JMeterContextService.getThreadCounts();
        sb.append(" Active: ");
        sb.append(tc.activeThreads);
        sb.append(" Started: ");
        sb.append(tc.startedThreads);
        sb.append(" Finished: ");
        sb.append(tc.finishedThreads);
    }
    return sb.toString();
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:54,代码来源:Summariser.java


注:本文中的org.apache.jmeter.threads.JMeterContextService.ThreadCounts类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。