mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Peter Major
12.31.2015 a51f42b1941e5c2fdf2a300cd5a049d51ee3e91d
OPENDJ-2001 CR-6885 Consistently format *rate tool output
4 files modified
62 ■■■■ changed files
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AddRate.java 3 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java 15 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java 30 ●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java 14 ●●●●● patch | view | raw | blame | history
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AddRate.java
@@ -26,6 +26,7 @@
package com.forgerock.opendj.ldap.tools;
import static java.util.Locale.ENGLISH;
import static java.util.concurrent.TimeUnit.*;
import static org.forgerock.opendj.ldap.LdapException.*;
@@ -151,7 +152,7 @@
                final int deleteStat = recentDeletes.getAndSet(0);
                final int total = adds + deleteStat;
                extraColumn[0] = String.format("%.2f", total > 0 ? ((double) adds / total) * 100 : 0.0);
                extraColumn[0] = String.format(ENGLISH, "%.2f", total > 0 ? ((double) adds / total) * 100 : 0.0);
                return extraColumn;
            }
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
@@ -26,6 +26,13 @@
 */
package com.forgerock.opendj.ldap.tools;
import static java.util.Locale.ENGLISH;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.*;
import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
import static com.forgerock.opendj.ldap.tools.Utils.*;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -65,11 +72,6 @@
import com.forgerock.opendj.cli.MultiChoiceArgument;
import com.forgerock.opendj.cli.StringArgument;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.*;
import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
import static com.forgerock.opendj.ldap.tools.Utils.*;
/**
 * A load generation tool that can be used to load a Directory Server with Bind
 * requests using one or more LDAP connections.
@@ -90,8 +92,7 @@
                if (extraColumn.length != 0) {
                    final long searchWaitTime = searchWaitRecentTime.getAndSet(0);
                    extraColumn[0] =
                            String.format("%.1f",
                                    ((float) (waitTime - searchWaitTime) / waitTime) * 100.0);
                            String.format(ENGLISH, "%.1f", ((float) (waitTime - searchWaitTime) / waitTime) * 100.0);
                }
                return extraColumn;
            }
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
@@ -26,6 +26,13 @@
 */
package com.forgerock.opendj.ldap.tools;
import static java.util.Locale.ENGLISH;
import static java.util.concurrent.TimeUnit.*;
import static org.forgerock.util.Utils.*;
import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.management.GarbageCollectorMXBean;
@@ -61,12 +68,6 @@
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.util.StaticUtils;
import static java.util.concurrent.TimeUnit.*;
import static org.forgerock.util.Utils.*;
import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
/**
 * Benchmark application framework.
 */
@@ -390,19 +391,19 @@
                averageDuration /= 1000.0;
                final String[] strings = new String[numColumns];
                strings[0] = String.format("%.1f", resultCount / recentDuration);
                strings[1] = String.format("%.1f", totalResultCount / averageDuration);
                strings[0] = String.format(ENGLISH, "%.1f", resultCount / recentDuration);
                strings[1] = String.format(ENGLISH, "%.1f", totalResultCount / averageDuration);
                if (resultCount > 0) {
                    strings[2] = String.format("%.3f", (waitTime - (gcDuration - lastGCDuration))
                    strings[2] = String.format(ENGLISH, "%.3f", (waitTime - (gcDuration - lastGCDuration))
                            / (double) resultCount / 1000000.0);
                } else {
                    strings[2] = "-";
                }
                if (totalResultCount > 0) {
                    strings[3] =
                            String.format("%.3f", (totalWaitTime - gcDuration) / (double) totalResultCount / 1000000.0);
                    strings[3] = String.format(ENGLISH, "%.3f",
                            (totalWaitTime - gcDuration) / (double) totalResultCount / 1000000.0);
                } else {
                    strings[3] = "-";
                }
@@ -410,11 +411,12 @@
                int i = 4;
                List<Long> computedPercentiles = eTimesBuckets.getPercentile(percentiles, totalOperationCount);
                for (int j = computedPercentiles.size() - 1; j >= 0; j--) {
                    strings[i++] = String.format("%.2f", computedPercentiles.get(j) / 1000.0);
                    strings[i++] = String.format(ENGLISH, "%.2f", computedPercentiles.get(j) / 1000.0);
                }
                strings[i++] = String.format("%.1f", failedCount / recentDuration);
                strings[i++] = String.format(ENGLISH, "%.1f", failedCount / recentDuration);
                if (isAsync) {
                    strings[i++] = resultCount > 0 ? String.format("%.1f", (double) operationCount / resultCount) : "-";
                    strings[i++] = resultCount > 0 ? String.format(ENGLISH, "%.1f", (double) operationCount
                            / resultCount) : "-";
                }
                for (final String column : getAdditionalColumns()) {
opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java
@@ -26,6 +26,12 @@
 */
package com.forgerock.opendj.ldap.tools;
import static java.util.Locale.ENGLISH;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.*;
import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -55,10 +61,6 @@
import com.forgerock.opendj.cli.MultiChoiceArgument;
import com.forgerock.opendj.cli.StringArgument;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.*;
import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
/**
 * A load generation tool that can be used to load a Directory Server with
 * Search requests using one or more LDAP connections.
@@ -100,9 +102,9 @@
            String[] getAdditionalColumns() {
                final int entryCount = entryRecentCount.getAndSet(0);
                if (successCount > 0) {
                    extraColumn[0] = String.format("%.1f", (double) entryCount / successCount);
                    extraColumn[0] = String.format(ENGLISH, "%.1f", (double) entryCount / successCount);
                } else {
                    extraColumn[0] = String.format("%.1f", 0.0);
                    extraColumn[0] = String.format(ENGLISH, "%.1f", 0.0);
                }
                return extraColumn;
            }