本文整理汇总了Java中org.databene.contiperf.PerformanceRequirement类的典型用法代码示例。如果您正苦于以下问题:Java PerformanceRequirement类的具体用法?Java PerformanceRequirement怎么用?Java PerformanceRequirement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PerformanceRequirement类属于org.databene.contiperf包,在下文中一共展示了PerformanceRequirement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatTestCase
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
private boolean formatTestCase(TestMethodReportDefinition def, Element currentTest, TestResult result,
PerformanceRequirement requirement, Document doc) {
boolean isFailed = false;
currentTest.setAttribute(NAME, def.getMethodName());
currentTest.setAttribute(CLASSNAME, def.getClassName());
currentTest.setAttribute(TIME, "" + (result.getLatency() / 1000.0));
if (requirement != null) {
try {
checkTestResult(result, requirement);
} catch (Throwable e) {
isFailed = true;
appendFailure(def, currentTest, e, doc);
}
}
return isFailed;
}
示例2: printThroughputStats
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
private static void printThroughputStats(LatencyCounter[] counters,
PerformanceRequirement requirement, PrintWriter out) {
Verdict verdict = ReportUtil
.throughputVerdict(counters[0], requirement);
Long required = (requirement != null && requirement.getThroughput() > 0 ? (long) requirement
.getThroughput() : null);
long[] secondaryValues = null;
if (counters.length > 1) {
secondaryValues = new long[counters.length - 1];
for (int i = 1; i < counters.length; i++) {
secondaryValues[i - 1] = (long) counters[i].throughput();
}
}
printStatLine("Throughput:", (long) counters[0].throughput(), "/ s",
required, secondaryValues, verdict, out);
}
示例3: printAverageStats
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
private static void printAverageStats(LatencyCounter[] counters,
PerformanceRequirement requirement, PrintWriter out) {
Verdict verdict = ReportUtil.averageVerdict(counters[0], requirement);
Long required = (requirement != null && requirement.getAverage() > 0 ? (long) requirement
.getAverage() : null);
long[] secondaryValues = null;
if (counters.length > 1) {
secondaryValues = new long[counters.length - 1];
for (int i = 1; i < counters.length; i++) {
secondaryValues[i - 1] = (long) counters[i].averageLatency();
}
}
printStatMsLine("Average latency:",
(long) counters[0].averageLatency(), required, secondaryValues,
verdict, out);
}
示例4: printErrorsStats
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
private static void printErrorsStats(LatencyCounter[] counters,
PerformanceRequirement requirement, PrintWriter out) {
Verdict verdict = ReportUtil.allowedErrorsVerdict(counters[0],
requirement);
long errors = counters[0].getAssertionErrors().size();
double errorsPercent = counters[0].errorsRate() * 100.;
out.println(" <tr>");
out.println(" <th align='right' valign='top'>"
+ format("- Errors:", verdict) + "</th>");
out.println(" <td align='right'>" + format(errors, null, verdict)
+ "</td>");
out.println(" <td align='right'>"
+ format(errorsPercent + " %", verdict) + "</td>");
out.println(" </tr>");
}
示例5: completed
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
public void completed(String serviceId, LatencyCounter[] counters, PerformanceRequirement requirement) {
if (!testsRegistry.isMethodRegistered(serviceId)) {
return;
}
resultsHolder.addCompletionResult(testsRegistry.getMethodDefinitionById(serviceId), counters[0], requirement);
testsRegistry.methodInvokationCompleted(serviceId);
if (!testsRegistry.isTestClassFinished(serviceId)) {
return;
}
TestMethodReportDefinition latestDefinition = testsRegistry.getMethodDefinitionById(serviceId);
String className = latestDefinition.getClassName();
printResults(className);
}
示例6: checkTestResult
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
private void checkTestResult(TestResult result, PerformanceRequirement requirement) {
long requiredMax = requirement.getMax();
if (requiredMax >= 0) {
if (result.getLatency() > requiredMax) {
context.fail(
"The maximum latency of " + requiredMax + " ms was exceeded, Measured: " + result.getLatency() + " ms");
}
}
}
示例7: requirements
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
private PerformanceRequirement requirements(FrameworkMethod method,
String testId) {
Required annotation = ContiPerfUtil.annotationOfMethodOrClass(method,
Required.class);
if (annotation != null) {
return ContiPerfUtil.mapRequired(annotation);
}
if (defaultRequirements != null) {
return defaultRequirements;
}
return null;
}
示例8: PerfTestStatement
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
PerfTestStatement(Statement base, String id, ExecutionConfig config,
PerformanceRequirement requirement, ReportContext context) {
this.base = base;
this.id = id;
this.config = config;
this.requirement = requirement;
this.context = context;
}
示例9: completed
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
@Override
public void completed(String serviceId, LatencyCounter[] counters,
ExecutionConfig executionConfig, PerformanceRequirement requirement) {
writeStats(serviceId, counters);
try {
out.close();
} catch (IOException e) {
throw new RuntimeException("Error closing " + file, e);
}
}
示例10: totalTimeVerdict
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
public static Verdict totalTimeVerdict(LatencyCounter counter,
PerformanceRequirement requirement) {
if (requirement == null || requirement.getTotalTime() < 0
|| counter.getAssertionErrors().size() > 0) {
return Verdict.IGNORED;
}
return (counter.duration() <= requirement.getTotalTime() ? Verdict.SUCCESS
: Verdict.FAILURE);
}
示例11: maxVerdict
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
public static Verdict maxVerdict(LatencyCounter counter,
PerformanceRequirement requirement) {
if (requirement == null || requirement.getMax() < 0
|| counter.getAssertionErrors().size() > 0) {
return Verdict.IGNORED;
}
return (counter.maxLatency() <= requirement.getMax() ? Verdict.SUCCESS
: Verdict.FAILURE);
}
示例12: throughputVerdict
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
public static Verdict throughputVerdict(LatencyCounter counter,
PerformanceRequirement requirement) {
if (requirement == null || requirement.getThroughput() < 0
|| counter.getAssertionErrors().size() > 0) {
return Verdict.IGNORED;
}
return (counter.throughput() >= requirement.getThroughput() ? Verdict.SUCCESS
: Verdict.FAILURE);
}
示例13: averageVerdict
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
public static Verdict averageVerdict(LatencyCounter counter,
PerformanceRequirement requirement) {
if (requirement == null || requirement.getAverage() < 0
|| counter.getAssertionErrors().size() > 0) {
return Verdict.IGNORED;
}
return (counter.averageLatency() <= requirement.getAverage() ? Verdict.SUCCESS
: Verdict.FAILURE);
}
示例14: functionalTestVerdict
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
public static Verdict functionalTestVerdict(final LatencyCounter counter,
final PerformanceRequirement requirement) {
if (requirement != null && requirement.isAllowedError()) {
return allowedErrorsVerdict(counter, requirement);
} else {
return (counter.getAssertionErrors().size() == 0 ? Verdict.SUCCESS
: Verdict.FAILURE);
}
}
示例15: updateReport
import org.databene.contiperf.PerformanceRequirement; //导入依赖的package包/类
private static synchronized void updateReport(String id,
LatencyCounter[] counters, ExecutionConfig executionConfig,
PerformanceRequirement requirement, ReportContext context) {
File reportFile = reportFile();
if (!initialized || !reportFile.exists()) {
initReportFile(reportFile, id, counters, executionConfig,
requirement, context);
} else {
extendReportFile(reportFile, id, counters, executionConfig,
requirement, context);
}
}