Changeset 15755 in josm for trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
- Timestamp:
- 2020-01-23T22:57:46+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
r12620 r15755 10 10 import org.openstreetmap.josm.tools.JosmRuntimeException; 11 11 import org.openstreetmap.josm.tools.Logging; 12 import org.openstreetmap.josm.tools. Utils;12 import org.openstreetmap.josm.tools.Stopwatch; 13 13 14 14 /** … … 46 46 */ 47 47 public void checkReferrers() { 48 long startTime = System.currentTimeMillis();48 final Stopwatch stopwatch = Stopwatch.createStarted(); 49 49 // It's also error when referred primitive's dataset is null but it's already covered by referredPrimitiveNotInDataset check 50 50 for (Way way : dataSet.getWays()) { … … 67 67 } 68 68 } 69 printElapsedTime(st artTime);69 printElapsedTime(stopwatch); 70 70 } 71 71 … … 74 74 */ 75 75 public void checkCompleteWaysWithIncompleteNodes() { 76 long startTime = System.currentTimeMillis();76 final Stopwatch stopwatch = Stopwatch.createStarted(); 77 77 for (Way way : dataSet.getWays()) { 78 78 if (way.isUsable()) { … … 84 84 } 85 85 } 86 printElapsedTime(st artTime);86 printElapsedTime(stopwatch); 87 87 } 88 88 … … 91 91 */ 92 92 public void checkCompleteNodesWithoutCoordinates() { 93 long startTime = System.currentTimeMillis();93 final Stopwatch stopwatch = Stopwatch.createStarted(); 94 94 for (Node node : dataSet.getNodes()) { 95 95 if (!node.isIncomplete() && node.isVisible() && !node.isLatLonKnown()) { … … 97 97 } 98 98 } 99 printElapsedTime(st artTime);99 printElapsedTime(stopwatch); 100 100 } 101 101 … … 104 104 */ 105 105 public void searchNodes() { 106 long startTime = System.currentTimeMillis();106 final Stopwatch stopwatch = Stopwatch.createStarted(); 107 107 dataSet.getReadLock().lock(); 108 108 try { … … 116 116 dataSet.getReadLock().unlock(); 117 117 } 118 printElapsedTime(st artTime);118 printElapsedTime(stopwatch); 119 119 } 120 120 … … 123 123 */ 124 124 public void searchWays() { 125 long startTime = System.currentTimeMillis();125 final Stopwatch stopwatch = Stopwatch.createStarted(); 126 126 dataSet.getReadLock().lock(); 127 127 try { … … 134 134 dataSet.getReadLock().unlock(); 135 135 } 136 printElapsedTime(st artTime);136 printElapsedTime(stopwatch); 137 137 } 138 138 … … 155 155 */ 156 156 public void referredPrimitiveNotInDataset() { 157 long startTime = System.currentTimeMillis();157 final Stopwatch stopwatch = Stopwatch.createStarted(); 158 158 for (Way way : dataSet.getWays()) { 159 159 for (Node node : way.getNodes()) { … … 167 167 } 168 168 } 169 printElapsedTime(st artTime);169 printElapsedTime(stopwatch); 170 170 } 171 171 … … 174 174 */ 175 175 public void checkZeroNodesWays() { 176 long startTime = System.currentTimeMillis();176 final Stopwatch stopwatch = Stopwatch.createStarted(); 177 177 for (Way way : dataSet.getWays()) { 178 178 if (way.isUsable() && way.getNodesCount() == 0) { … … 182 182 } 183 183 } 184 printElapsedTime(st artTime);185 } 186 187 private void printElapsedTime( long startTime) {184 printElapsedTime(stopwatch); 185 } 186 187 private void printElapsedTime(Stopwatch stopwatch) { 188 188 if (Logging.isDebugEnabled()) { 189 189 StackTraceElement item = Thread.currentThread().getStackTrace()[2]; 190 190 String operation = getClass().getSimpleName() + '.' + item.getMethodName(); 191 long elapsedTime = System.currentTimeMillis() - startTime;192 191 Logging.debug(tr("Test ''{0}'' completed in {1}", 193 operation, Utils.getDurationString(elapsedTime)));192 operation, stopwatch)); 194 193 } 195 194 } … … 200 199 public void runTest() { 201 200 try { 202 long startTime = System.currentTimeMillis();201 final Stopwatch stopwatch = Stopwatch.createStarted(); 203 202 referredPrimitiveNotInDataset(); 204 203 checkReferrers(); … … 208 207 searchWays(); 209 208 checkZeroNodesWays(); 210 printElapsedTime(st artTime);209 printElapsedTime(stopwatch); 211 210 if (errorCount > MAX_ERRORS) { 212 211 writer.println((errorCount - MAX_ERRORS) + " more...");
Note:
See TracChangeset
for help on using the changeset viewer.
