incubator-olio-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r747456 - in /incubator/olio/workload/php/trunk/src/org/apache/olio/workload: driver/UIDriver.java harness/OlioBenchmark.java util/MemCacheUtility.java util/UserName.java
Date Tue, 24 Feb 2009 17:43:25 GMT
Author: shanti
Date: Tue Feb 24 17:43:24 2009
New Revision: 747456

URL: http://svn.apache.org/viewvc?rev=747456&view=rev
Log:
More fixes for OLIO-33. These files didn't get updated with the new pkgnames and driver change
from web20 to olio.

Modified:
    incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java
    incubator/olio/workload/php/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java
    incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/MemCacheUtility.java
    incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/UserName.java

Modified: incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java
URL: http://svn.apache.org/viewvc/incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java?rev=747456&r1=747455&r2=747456&view=diff
==============================================================================
--- incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java (original)
+++ incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java Tue
Feb 24 17:43:24 2009
@@ -288,11 +288,11 @@
         driverMetrics = new UIDriverMetrics();
         ctx.attachMetrics(driverMetrics);
         String hostPorts = ctx.getXPathValue(
-                                "/web20/webServer/fa:hostConfig/fa:hostPorts");
+                                "/olio/webServer/fa:hostConfig/fa:hostPorts");
         List<NameValuePair<Integer>> hostPortList =
                                             Utilities.parseHostPorts(hostPorts);
         int loadedScale = Integer.parseInt(
-                                    ctx.getXPathValue("/web20/dbServer/scale"));
+                                    ctx.getXPathValue("/olio/dbServer/scale"));
         loadedUsers = ScaleFactors.USERS_RATIO * loadedScale;
         if (scale > loadedScale)
             throw new FatalException("Data loaded only for " + loadedScale +

Modified: incubator/olio/workload/php/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java
URL: http://svn.apache.org/viewvc/incubator/olio/workload/php/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java?rev=747456&r1=747455&r2=747456&view=diff
==============================================================================
--- incubator/olio/workload/php/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java
(original)
+++ incubator/olio/workload/php/trunk/src/org/apache/olio/workload/harness/OlioBenchmark.java
Tue Feb 24 17:43:24 2009
@@ -141,7 +141,7 @@
             ArrayList<String> cmdList = new ArrayList<String>();
             if (autoCommit)
                 cmdList.add("-Dcommit.tx=false");
-            cmdList.add("com.sun.web20.loader.LoadController");
+            cmdList.add("org.apache.olio.workload.loader.LoadController");
             cmdList.add(driver);
             cmdList.add(connectURL);
             cmdList.add(String.valueOf(scale));
@@ -155,7 +155,7 @@
             String mediaHost = params.getParameter(
                                         "dataStorage/fa:hostConfig/fa:host");
             String mediaDir = params.getParameter("dataStorage/mediaDir");
-            Command c = new Command("com.sun.web20.fsloader.FileLoader",
+            Command c = new Command("org.apache.olio.workload.fsloader.FileLoader",
                         getBenchmarkDir() + "resources", mediaDir,
                         String.valueOf(scale));
             c.setSynchronous(false);

Modified: incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/MemCacheUtility.java
URL: http://svn.apache.org/viewvc/incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/MemCacheUtility.java?rev=747456&r1=747455&r2=747456&view=diff
==============================================================================
--- incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/MemCacheUtility.java
(original)
+++ incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/MemCacheUtility.java
Tue Feb 24 17:43:24 2009
@@ -225,8 +225,8 @@
     * -e end time: the steady state, in seconds. (time to do the statistics data collection)
     * -i interval time: the snapshot period to collect the stats, in seconds.
     *
-    *     Usage:  java com.sun.web20.MemCacheUtility server:port [server2:port server3:port]
-s startTime -e endTime -i interval
-    *     eg. java com.sun.web20.util.MemCacheUtility server1:12100 server2:12100 -s 300
-e 600 -i 3
+    *     Usage:  java org.apache.olio.workload.util.MemCacheUtility server:port [server2:port
server3:port] -s startTime -e endTime -i interval
+    *     eg. java org.apache.olio.workload.util.MemCacheUtility server1:12100 server2:12100
-s 300 -e 600 -i 3
     *     This will sleep for 300 seconds during ramp up, collect for 600 seconds with an
interval of 3 seconds between
     *     each snapshot.
     *     @param args String []
@@ -235,7 +235,7 @@
     public static void main (String[] args) {
 
         if (args==null || args.length < 4) {//minimum amount of args - one server, -s,
-e, -i
-            System.out.println("Usage:  java com.sun.web20.MemCacheUtility server:port [server2:port
server3:port] -s startTime -e endTime -i interval");
+            System.out.println("Usage:  java org.apache.olio.workload.MemCacheUtility server:port
[server2:port server3:port] -s startTime -e endTime -i interval");
             System.out.println(" where startTime = ramp up time in seconds.  Statistics collection
will NOT occur during ramp up time and will sleep for startTime period");
             System.out.println(" endTime = steady State time in seconds.  Statistics collection
will only occur during the steady state period");
             System.out.println(" interval = time between statistics collection snapshots,
in seconds.");

Modified: incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/UserName.java
URL: http://svn.apache.org/viewvc/incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/UserName.java?rev=747456&r1=747455&r2=747456&view=diff
==============================================================================
--- incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/UserName.java (original)
+++ incubator/olio/workload/php/trunk/src/org/apache/olio/workload/util/UserName.java Tue
Feb 24 17:43:24 2009
@@ -26,52 +26,19 @@
  * The user utility creates usernames and passwords from user ids.
  * It uses the scrambled character sequences generated by the Scramble
  * class. The username length distribution are controlled so 5% of the
- * users have 3 letter names, 8% of the users have 4 letter names,
- * 17% of the users have 5 letter names, 25% of the users have 6 letter
- * names, 24% of the users have 7 letter names, and 21% of the users
- * have 8 letter names. This ratio is based on Sun's own users that
- * DO NOT use standard names such as ab123456.<p>
- * At the current state, this utility can generate 711,880 non-duplicate
+ * users have 6 letter names, 8% of the users have 7 letter names,
+ * 17% of the users have 8 letter names, 25% of the users have 9 letter
+ * names, 24% of the users have 10 letter names, and 21% of the users
+ * have 11 letter names.<p>
+ * At the current state, this utility can generate 36,058,857,640 non-duplicate
  * names.
  *
  * @author Akara Sucharitakul
  */
 public class UserName {
 
-    private static final char[][][] scramble = {{{'0'}}, {{'0'}},
-    {{'s', 'k', 'u', 'p', 'n', 't', 'j', 'z', 'b', 'g', 'q', 'l', 'w', 'd',
-    'v', 'y', 'm', 'f', 'x', 'i', 'c', 'h', 'r', 'o', 'e', 'a'},
-    {'w', '_', 'q', 'l', 'z', 'h', 'j', 'k', '1', '6', 'e', '5', '4', 't', 'b',
-    '2', 'p', 'r', 'g', 'm', '8', '3', 'c', 'u', '7', 'v', 'i', 'y', 'o', 'a',
-    'x', 'n', '0', '9', 's', 'd', 'f'},
-    {'8', '7', '2', 'm', 'l', 's', 'q', '6', '1', 'j', 'b', 'n', '3', 'i', '_',
-    'w', 'a', 'z', '4', 'x', 'e', 'f', '9', 'c', 'g', 't', 'h', '0', 'd', 'y',
-    'k', 'v', 'u', 'p', 'r', '5', 'o'}},
-    {{'q', 'c', 'r', 'p', 'm', 'o', 'n', 'y', 't', 'x', 'a', 'k', 'l', 's',
-    'e', 'g', 'z', 'h', 'w', 'j', 'v', 'u', 'b', 'f', 'i', 'd'},
-    {'0', 'g', 'l', '8', 'f', 'p', 'x', 'q', 'm', '6', 's', 'y', 'c', '2', '7',
-    'e', '4', '5', 'v', 'b', 'z', 'i', 'd', 'h', '1', 'n', '3', '9', 'w', 'o',
-    '_', 'r', 'j', 't', 'k', 'u', 'a'},
-    {'5', 'e', '0', '4', 'j', 'd', 'a', 'b', 'g', 'w', 'n', 'v', '3', 'u', '9',
-    'x', 'i', 'c', 'h', 'q', 'y', 'r', '_', 'm', 't', '6', '8', '2', 'l', 'k',
-    'p', '7', 's', 'o', 'z', 'f', '1'},
-    {'r', 'v', 'g', 'a', '0', 'w', 't', '7', '5', '_', 'o', '6', 'f', 'z', 'j',
-    '2', 'c', 'e', '4', '1', 's', 'y', 'p', '8', 'n', 'u', '3', 'l', 'k', 'h',
-    'd', 'b', 'q', 'x', 'i', '9', 'm'}},
-    {{'p', 's', 'c', 'o', 'r', 't', 'u', 'i', 'k', 'q', 'v', 'e', 'f', 'x',
-    'n', 'j', 'y', 'w', 'z', 'd', 'a', 'b', 'g', 'm', 'l', 'h'},
-    {'i', 'f', 'w', '0', '5', 'p', '7', 'o', '6', 'z', '8', 'h', 't', '2', '4',
-    'u', 'a', 'x', 'r', 's', '9', 'v', 'k', 'j', 'e', 'g', '3', 'q', 'm', '1',
-    'l', 'y', 'd', 'n', '_', 'c', 'b'},
-    {'n', 'z', 'q', 'd', '8', '1', '5', 'o', 'b', 'u', 'e', 'a', 'c', '2', 'y',
-    'w', 'k', '9', 'i', '7', 'h', '_', '3', '0', 'j', 'g', 'l', 'm', 'p', 's',
-    'v', 't', '4', 'x', '6', 'f', 'r'},
-    {'f', 'd', '5', 't', 'j', 'e', 'h', 'q', 'u', 'c', 'b', 'w', 'l', 'k', 'a',
-    'n', 'r', 'm', '1', 'o', '_', 'y', '6', 's', '7', 'g', 'i', '2', '0', 'p',
-    'x', 'v', '3', '4', 'z', '9', '8'},
-    {'4', 'm', 'q', 'o', '9', 'v', 'z', 'w', '7', '6', '5', '8', 'f', 'g', 'd',
-    'a', 'p', 'j', '1', '_', 'y', '3', 'h', 'r', 't', 'c', 'n', 'l', '0', 'e',
-    'k', 'b', 'x', 'i', '2', 's', 'u'}},
+private static final char[][][] scramble =
+        {{{'0'}}, {{'0'}}, {{'0'}}, {{'0'}}, {{'0'}},
     {{'r', 'b', 'd', 'm', 'f', 't', 'x', 'e', 'i', 'o', 's', 'p', 'a', 'l',
     'g', 'h', 'n', 'w', 'z', 'q', 'u', 'v', 'k', 'j', 'c', 'y'},
     {'h', 'i', 'b', 'f', '2', 'o', 'd', 'u', '7', '9', 'w', 'v', 'j', '3', '6',
@@ -131,11 +98,98 @@
     'd', 'r', 't', '7', 'f', 'l', 'c'},
     {'t', 'z', 'n', 'y', '6', 'm', 'i', 'w', 'c', '2', 'f', 'q', 'e', 'h', '_',
     'v', 'j', '9', '0', '8', 's', '5', 'g', 'd', 'p', 'l', '4', 'u', 'o', '1',
-    'k', '3', 'r', 'b', 'a', 'x', '7'}}};
-
+'k', '3', 'r', 'b', 'a', 'x', '7'}},
+{{'n', 'w', 'e', 'q', 'k', 'p', 's', 'a', 'j', 'm', 'i', 'c', 'h', 'g',
+'z', 'u', 'd', 'l', 'y', 'v', 'f', 'o', 'b', 't', 'r', 'x'},
+{'l', 'x', 'd', 'k', 'u', 'q', '5', 'r', 'w', 's', '_', 'h', 'i', 'z', 'p',
+'g', 'a', 'c', 'y', 'v', 'e', 'f', '6', 'j', 'o', '4', '8', 't', '0', '9',
+'7', '3', 'b', 'n', '1', '2', 'm'},
+{'h', '_', 'y', 'm', 'a', 'v', 'r', 'k', 'j', 'i', 't', '3', '5', '2', 'f',
+'u', 'd', '4', 'n', 'b', 'e', '1', 'q', '0', 'c', 'p', '8', '7', 'x', '6',
+'9', 'o', 's', 'w', 'l', 'g', 'z'},
+{'k', 'y', 'a', '4', 'f', 'i', '0', '_', '1', 'b', 'p', '9', 'x', 'w', 'v',
+'n', 'd', 't', 'm', 'u', 'q', 'l', '6', 'o', '5', 'j', 's', '8', '7', 'h',
+'z', 'e', 'r', '3', 'c', '2', 'g'},
+{'y', 'q', '2', 'j', 'z', 'f', 'h', 'r', 'x', 'g', 'w', '9', '5', '0', '3',
+'4', 't', 'a', 'e', '7', 'b', 'p', 'd', 'c', 's', 'v', '_', '6', 'k', 'o',
+'i', 'l', 'n', 'u', '8', 'm', '1'},
+{'a', '0', 's', '5', 'h', '4', 'c', 'x', '8', 'w', 'r', '1', 't', '6', 'u',
+'7', 'e', 'b', 'd', 'j', 'i', '3', 'f', 'y', '2', 'v', 'n', 'o', '_', 'q',
+'9', 'm', 'g', 'k', 'p', 'l', 'z'},
+{'o', '7', 'n', 'r', 'g', 'v', 't', 'h', 'w', '_', '5', 'z', '1', '4', 'y',
+'a', '3', 'u', 'k', 'f', 'e', 'b', 'm', 'i', 'x', 'l', 'd', '0', 'c', '9',
+'p', '2', 'j', '8', 's', 'q', '6'},
+{'u', '2', 'o', 'a', 'k', '3', '_', 'i', 'z', 'r', 'e', 'x', '6', 'v', '4',
+'y', 'n', 'f', 'm', 'd', '7', '1', 'p', 'h', 't', 'l', '0', '8', '5', 'w',
+'c', '9', 'g', 's', 'b', 'q', 'j'},
+{'h', 'o', '3', '5', 'g', 'j', 'p', 'y', 'r', '4', 'q', '7', '9', '6', 't',
+'e', 'z', 'v', 'f', 'w', '1', 'i', 'b', '0', 'l', 's', 'a', 'x', '_', 'k',
+'u', 'c', 'd', 'n', '2', '8', 'm'}},
+{{'p', 'f', 'x', 'n', 'v', 'q', 'w', 'r', 'd', 'i', 'h', 'z', 'b', 't',
+'g', 'l', 'o', 'c', 'y', 's', 'u', 'm', 'e', 'k', 'a', 'j'},
+{'k', 'e', 'u', '0', 't', 'o', 'd', 'x', '_', '4', 'l', 'y', '7', '2', 'z',
+'9', 'a', 'm', 'r', 'b', 'f', '8', 'q', 's', 'n', 'g', '5', 'i', 'j', 'p',
+'6', '1', 'v', 'h', 'w', 'c', '3'},
+{'r', '4', '5', 'q', '_', 's', '2', 'p', 'z', 'n', 'o', 'm', 'g', 'a', 'c',
+'u', 'v', 'j', 'e', 'k', 'x', '7', 'l', 'd', 'w', '0', '8', 'i', '6', 'h',
+'3', '1', 'y', '9', 'f', 't', 'b'},
+{'q', 'x', 'i', 'g', 'z', 'v', '2', 'u', '4', 's', '1', 'd', 'k', 'n', 'a',
+'5', '7', 't', 'y', '9', 'm', 'r', '8', 'j', '0', 'b', 'c', 'o', 'l', 'h',
+'f', '6', 'e', 'p', '3', 'w', '_'},
+{'c', 'k', '1', 'd', '6', '_', 'o', '5', 'm', 'w', 'e', 'g', 'b', '0', 'q',
+'t', '8', 'r', 'u', 'i', 'n', 'j', 'x', 's', '7', '2', 'z', 'f', 'l', '4',
+'v', 'y', 'a', 'p', 'h', '9', '3'},
+{'t', 'v', '_', 'j', 'w', '5', 'l', '8', 's', 'n', '9', 'e', '0', 'd', 'x',
+'r', 'c', '2', '6', 'a', 'k', '3', 'g', '1', 'u', 'y', '4', 'o', 'q', 'f',
+'m', 'p', 'b', 'z', '7', 'i', 'h'},
+{'k', 'm', 'v', 'p', 'w', '9', 'x', 'j', 't', '_', 'i', 'h', 'a', '5', 'd',
+'e', 'z', 'n', 'f', '4', 'o', '0', 'l', '6', 'c', '8', 's', 'b', 'g', '2',
+'1', '3', 'r', 'y', '7', 'u', 'q'},
+{'i', 'a', 'b', 'v', 'l', 'y', 't', 'f', 'z', '8', '3', 'e', '2', 'p', 'r',
+'u', '6', '7', 's', '5', 'c', 'k', '0', 'j', 'm', 'n', 'h', 'd', '1', 'g',
+'o', 'w', 'x', '4', 'q', '9', '_'},
+{'8', '9', 'x', 'f', 'h', '7', '0', '4', 'o', '2', 'g', 'v', 'j', 't', 'e',
+'1', '3', 'q', 'w', 'a', '_', 'n', 'd', 'l', 'i', '6', 'm', 's', 'c', 'b',
+'y', 'z', '5', 'u', 'k', 'p', 'r'},
+{'f', '5', '_', 's', 'p', 'o', 'r', 'w', '1', 'y', '4', 'g', 'e', '8', 'b',
+'a', 'c', '0', 'v', 'h', 'm', 'q', 't', '6', 'u', 'n', 'd', '3', 'x', 'i',
+'7', 'z', 'j', 'k', '9', 'l', '2'}},
+{{'o', 't', 'q', 'k', 'b', 'p', 'a', 'f', 'x', 'd', 'c', 's', 'w', 'e',
+'y', 'r', 'l', 'm', 'z', 'i', 'v', 'g', 'n', 'j', 'h', 'u'},
+{'1', 'f', '5', 'u', 'j', 'q', 'r', 'w', 'i', 'x', '2', 'h', 'o', '0', '6',
+'p', 'c', 'd', 'z', 't', 'l', 'n', '_', '7', '3', 'b', 'a', 'g', 'e', '9',
+'y', '4', 'v', 's', '8', 'k', 'm'},
+{'v', '9', 'u', '0', 'r', 'g', '_', '4', 'y', 'n', 'j', '7', 'p', 'k', '2',
+'t', '1', 'o', 'e', 'b', 'f', 'i', 'x', 'z', 'c', 'q', '6', '8', 'w', 'm',
+'d', 'h', '5', 'a', 's', '3', 'l'},
+{'_', 'v', '8', 'y', 'g', 'e', 'o', 'b', 'r', 't', 'n', '1', 'm', '6', '5',
+'k', 'h', 'd', 'w', 's', 'x', 'q', 'l', '4', 'j', 'z', 'i', '7', '3', 'c',
+'p', 'a', '2', 'u', 'f', '0', '9'},
+{'j', 'z', 'd', '_', '3', '5', '9', 'p', '8', 'l', 'k', 'r', '7', 'q', '6',
+'a', 's', 'w', 'b', '0', 'f', 'x', 'e', 'v', 't', 'o', '4', 'h', '2', '1',
+'c', 'm', 'i', 'u', 'y', 'g', 'n'},
+{'a', 'f', '0', 'n', 'h', 'v', 'u', '7', '6', 'j', 'p', 'b', 'm', '_', '5',
+'9', 'q', 'd', '3', 'y', '4', 'i', '2', 'k', 'z', 't', 'w', 'g', '8', 'c',
+'r', '1', 'e', 'x', 'l', 'o', 's'},
+{'e', 'o', 'p', '9', 'f', 'u', 'j', 'y', '0', 'g', 's', 'r', '6', 't', 'n',
+'b', 'a', 'x', 'w', 'l', 'i', 'c', '1', 'k', 'q', '5', '7', 'd', 'h', '_',
+'2', 'z', '4', '3', 'v', 'm', '8'},
+{'5', 'f', 'b', 'g', 'v', 'a', '8', 'd', 'm', '_', 'k', 'o', 'u', '2', 'w',
+'x', 'c', '9', 'j', '7', 'n', 'e', '4', 'l', 'p', 'r', 'h', 'q', 'i', '1',
+'0', 't', '6', 's', 'z', 'y', '3'},
+{'s', 'j', 'h', 'z', '1', 'b', 'w', '2', 'y', 'l', 'u', '8', 'd', 'q', 'a',
+'5', 'x', 'k', '0', 'e', 't', 'v', '9', '7', 'n', 'i', 'p', 'm', 'r', '_',
+'3', '4', '6', 'o', 'c', 'g', 'f'},
+{'v', 'c', 'q', '1', 'a', '0', 'o', 'i', '3', '6', 'e', 'b', '9', 'w', 'x',
+'2', '5', 'l', 'd', 'z', 's', 'n', 'h', 'g', 'r', 'y', '8', 't', 'k', '4',
+'_', 'p', 'j', 'f', 'u', 'm', '7'},
+{'k', '4', 's', 'q', 'i', 'j', 'v', 'e', 'y', '8', 'l', 'u', '_', 'o', 'c',
+'g', 'd', 'r', 'x', 'b', 'a', 'w', '9', 'p', '3', '5', 'n', 'f', '1', '2',
+'0', 'h', 'z', 't', '7', '6', 'm'}}};
 
     // Note that these sum up to 100
-    private static final int[] length_percent = { 0, 0, 5, 8, 17, 25, 24, 21 };
+    // private static final int[] length_percent = { 0, 0, 5, 8, 17, 25, 24, 21 };
+    private static final int[] length_percent = { 0, 0, 0, 0, 0, 5, 8, 17, 25, 24, 21 };
 
     private static int[] selector = new int[length_percent.length];
 
@@ -223,30 +277,61 @@
         return new String(name);
     }
 
+    private static void spaceSize() {
+        long minSpace = Long.MAX_VALUE;
+        int digit = 0;
+        for (int i = 0; i < length_percent.length; i++) {
+            if (length_percent[i] == 0)
+                continue;
+            long space = 26l;
+            for (int j = 1; j < i + 1; j++) {
+                space *= 37l;
+            }
+            space = space * 100l / length_percent[i];
+            if (space >= 0 && space < minSpace) {
+                minSpace = space;
+                digit = i + 1;
+            }
+        }
+        System.out.println("The maximum names of the current config is " +
+                            minSpace);
+        System.out.print("The space is limited by length " + digit);
+    }
+
     /**
      * The main method is used for testing user name generation.
      * It prints out all the user names generated and the
      * percentages of user names for each length. It also
      * reports duplicate users, whenever found.
      */
-    public static void main (String[] args) throws Exception {
+    public static void main(String[] args) throws Exception {
+        if (args.length == 0) {
+            spaceSize();
+        } else {
         long limit = Long.parseLong(args[0]) * 100;
 	FileWriter tmpfile;
-	if (args.length <= 1)
+            if (args.length <= 1) {
 		tmpfile = new FileWriter("/tmp/users.txt");
-	else    tmpfile = new FileWriter(args[1]);
+            } else {
+                tmpfile = new FileWriter(args[1]);
+            }
+            testGen(limit, tmpfile);
+        }
+    }
 		
-        int[] nameLength = new int[8];
+    private static void testGen(long limit, FileWriter tmpfile)
+            throws IOException {
+        int[] nameLength = new int[length_percent.length];
         HashSet<String> set = new HashSet<String>((int) (limit - 1));
-
         for (long i = 1; i <= limit; i++) {
             String name = getUserName(i);
             System.out.println("User " + i + ": " + name);
             tmpfile.write(name + "\n");
             ++nameLength[name.length() - 1];
-            if (!set.add(name))
+            if (!set.add(name)) {
                 System.out.println("Alert! Duplicate name: " + name);
         }
+        }
 	tmpfile.close();
         long count = 0;
         for (int i = 0; i < nameLength.length; i++) {
@@ -254,7 +339,7 @@
         }
         for (int i = 0; i < nameLength.length; i++) {
             System.out.println("Length " + (i + 1) + ", count " +
-                    nameLength[i] + ", " + (100d * nameLength[i]/count) + "%");
+                   nameLength[i] + ", " + (100d * nameLength[i] / count) + "%");
         }
     }
 }



Mime
View raw message