@Override public boolean visit(final Result r) throws IOException { if (r != null && !r.isEmpty()) { long st = 0; if (LOG.isTraceEnabled()) { st = System.currentTimeMillis(); } visitMetaEntry(visitor, r); if (LOG.isTraceEnabled()) { long et = System.currentTimeMillis(); LOG.trace("[T] LOAD META PERF " + StringUtils.humanTimeDiff(et - st)); } } else if (isDebugEnabled) { LOG.debug("NULL result from meta - ignoring but this is strange."); } return true; } });
private void acceptPlan(final HashMap<RegionInfo, RegionStateNode> regions, final Map<ServerName, List<RegionInfo>> plan) throws HBaseIOException { final ProcedureEvent<?>[] events = new ProcedureEvent[regions.size()]; final long st = System.currentTimeMillis(); if (plan == null) { throw new HBaseIOException("unable to compute plans for regions=" + regions.size()); } if (plan.isEmpty()) return; int evcount = 0; for (Map.Entry<ServerName, List<RegionInfo>> entry: plan.entrySet()) { final ServerName server = entry.getKey(); for (RegionInfo hri: entry.getValue()) { final RegionStateNode regionNode = regions.get(hri); regionNode.setRegionLocation(server); events[evcount++] = regionNode.getProcedureEvent(); } } ProcedureEvent.wakeEvents(getProcedureScheduler(), events); final long et = System.currentTimeMillis(); if (LOG.isTraceEnabled()) { LOG.trace("ASSIGN ACCEPT " + events.length + " -> " + StringUtils.humanTimeDiff(et - st)); } }
et = System.nanoTime(); LOG.info("Recovered {} lease in {}", store.getClass().getSimpleName(), StringUtils.humanTimeDiff(TimeUnit.NANOSECONDS.toMillis(et - st))); et = System.nanoTime(); LOG.info("Loaded {} in {}", store.getClass().getSimpleName(), StringUtils.humanTimeDiff(TimeUnit.NANOSECONDS.toMillis(et - st)));
public void joinCluster() throws IOException { long startTime = System.nanoTime(); LOG.debug("Joining cluster..."); // Scan hbase:meta to build list of existing regions, servers, and assignment. // hbase:meta is online now or will be. Inside loadMeta, we keep trying. Can't make progress // w/o meta. loadMeta(); while (master.getServerManager().countOfRegionServers() < 1) { LOG.info("Waiting for RegionServers to join; current count={}", master.getServerManager().countOfRegionServers()); Threads.sleep(250); } LOG.info("Number of RegionServers={}", master.getServerManager().countOfRegionServers()); // Start the RIT chore master.getMasterProcedureExecutor().addChore(this.ritChore); long costMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); LOG.info("Joined the cluster in {}", StringUtils.humanTimeDiff(costMs)); }
/** * Called by the ProcedureExecutor when the timeout set by setTimeout() is expired. * <p/> * Another usage for this method is to implement retrying. A procedure can set the state to * {@code WAITING_TIMEOUT} by calling {@code setState} method, and throw a * {@link ProcedureSuspendedException} to halt the execution of the procedure, and do not forget a * call {@link #setTimeout(int)} method to set the timeout. And you should also override this * method to wake up the procedure, and also return false to tell the ProcedureExecutor that the * timeout event has been handled. * @return true to let the framework handle the timeout as abort, false in case the procedure * handled the timeout itself. */ protected synchronized boolean setTimeoutFailure(TEnvironment env) { if (state == ProcedureState.WAITING_TIMEOUT) { long timeDiff = EnvironmentEdgeManager.currentTime() - lastUpdate; setFailure("ProcedureExecutor", new TimeoutIOException("Operation timed out after " + StringUtils.humanTimeDiff(timeDiff))); return true; } return false; }
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanTimeDiff(entry.getValue().getAgeOfLastShippedOp())), jamonWriter); org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue().getReplicationDelay() == Long.MAX_VALUE ? "UNKNOWN" : StringUtils.humanTimeDiff(entry.getValue().getReplicationDelay())), jamonWriter);
if (LOG.isTraceEnabled() && (syncWaitMs > 10 || slotIndex < syncMaxSlot)) { LOG.trace(String.format("Sync wait %s, slotIndex=%s , totalSynced=%s (%s/sec)", StringUtils.humanTimeDiff(syncWaitMs), slotIndex, StringUtils.humanSize(totalSyncedToStore), StringUtils.humanSize(syncedPerSec)));
@Test public void testPerfSingleThread() { final TableName TABLE_NAME = TableName.valueOf("testPerf"); final int NRUNS = 1 * 1000000; // 1M final RegionStates stateMap = new RegionStates(); long st = System.currentTimeMillis(); for (int i = 0; i < NRUNS; ++i) { stateMap.createRegionStateNode(createRegionInfo(TABLE_NAME, i)); } long et = System.currentTimeMillis(); LOG.info(String.format("PERF SingleThread: %s %s/sec", StringUtils.humanTimeDiff(et - st), StringUtils.humanSize(NRUNS / ((et - st) / 1000.0f)))); } }
public void awaitTermination() { try { final long startTime = EnvironmentEdgeManager.currentTime(); for (int i = 0; isAlive(); ++i) { sendStopSignal(); join(250); // Log every two seconds; send interrupt too. if (i > 0 && (i % 8) == 0) { LOG.warn("Waiting termination of thread {}, {}; sending interrupt", getName(), StringUtils.humanTimeDiff(EnvironmentEdgeManager.currentTime() - startTime)); interrupt(); } } } catch (InterruptedException e) { LOG.warn("{} join wait got interrupted", getName(), e); } } }
org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(StringUtils.humanTimeDiff(pair.getSecond().getAgeOfLastShippedOp())), jamonWriter); org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(pair.getSecond().getReplicationLag() == Long.MAX_VALUE ? "UNKNOWN" : StringUtils.humanTimeDiff(pair.getSecond().getReplicationLag())), jamonWriter);
private void testAssign(MockRSExecutor executor, int nRegions) throws Exception { rsDispatcher.setMockRsExecutor(executor); TransitRegionStateProcedure[] assignments = new TransitRegionStateProcedure[nRegions]; long st = System.currentTimeMillis(); bulkSubmit(assignments); for (int i = 0; i < assignments.length; ++i) { ProcedureTestingUtility.waitProcedure(master.getMasterProcedureExecutor(), assignments[i]); assertTrue(assignments[i].toString(), assignments[i].isSuccess()); } long et = System.currentTimeMillis(); float sec = ((et - st) / 1000.0f); LOG.info(String.format("[T] Assigning %dprocs in %s (%.2fproc/sec)", assignments.length, StringUtils.humanTimeDiff(et - st), assignments.length / sec)); }
long et = System.currentTimeMillis(); LOG.info(String.format("PERF STATEMAP INSERT: %s %s/sec", StringUtils.humanTimeDiff(et - st), StringUtils.humanSize(NRUNS / ((et - st) / 1000.0f)))); et = System.currentTimeMillis(); LOG.info(String.format("PERF STATEMAP GET: %s %s/sec", StringUtils.humanTimeDiff(et - st), StringUtils.humanSize(NRUNS / ((et - st) / 1000.0f))));
long ms = System.currentTimeMillis() - start; System.out.println("Wrote " + procId + " procedures in " + StringUtils.humanTimeDiff(ms));
final float addBackTimeSec = addBackTime / 1000.0f; System.out.println("******************************************"); System.out.println("Time - addBack : " + StringUtils.humanTimeDiff(addBackTime)); System.out.println("Ops/sec - addBack : " + StringUtils.humanSize(numOps / addBackTimeSec)); System.out.println("Time - poll : " + StringUtils.humanTimeDiff(pollTime)); System.out.println("Ops/sec - poll : " + StringUtils.humanSize(numOps / pollTimeSec)); System.out.println("Num Operations : " + numOps);
private void writeWals() throws IOException { List<Integer> procStates = shuffleProcWriteSequence(); TestProcedure[] procs = new TestProcedure[numProcs + 1]; // 0 is not used. int numProcsPerWal = numWals > 0 ? procStates.size() / numWals : Integer.MAX_VALUE; long startTime = currentTimeMillis(); long lastTime = startTime; for (int i = 0; i < procStates.size(); ++i) { int procId = procStates.get(i); if (procId < 0) { store.delete(procs[-procId].getProcId()); procs[-procId] = null; } else if (procs[procId] == null) { procs[procId] = new TestProcedure(procId, 0); procs[procId].setData(serializedState); store.insert(procs[procId], null); } else { store.update(procs[procId]); } if (i > 0 && i % numProcsPerWal == 0) { long currentTime = currentTimeMillis(); System.out.println("Forcing wall roll. Time taken on last WAL: " + (currentTime - lastTime) / 1000.0f + " sec"); store.rollWriterForTesting(); lastTime = currentTime; } } long timeTaken = currentTimeMillis() - startTime; System.out.println("\n\nDone writing WALs.\nNum procs : " + numProcs + "\nTotal time taken : " + StringUtils.humanTimeDiff(timeTaken) + "\n\n"); }
LOG.info("Finished " + proc + " in " + StringUtils.humanTimeDiff(proc.elapsedTime()));
out.print( new Date(runtimeBean.getStartTime()) ); out.write("</td>\n <td>"); out.print( StringUtils.humanTimeDiff(runtimeBean.getUptime()) ); out.write("</td>\n <td>"); out.print( JSONMetricUtil.getProcessPID() ); out.print( collector1.getCollectionCount() ); out.write("</td>\n <td> "); out.print( StringUtils.humanTimeDiff(collector1.getCollectionTime()) ); out.write(" </td>\n <td> "); out.print( StringUtils.humanTimeDiff(JSONMetricUtil.getLastGcDuration( collector1.getObjectName())) ); out.write("</td>\n </tr>\n </table>\n </div>\n <div class=\"tab-pane\" id=\"tab_gc2\">\n <table class=\"table table-striped\">\n <tr>\n <th>Collection Count</th>\n <th>Collection Time</th>\n <th>Last duration</th>\n </tr>\n <tr>\n <td> "); out.print( collector2.getCollectionCount() ); out.write("</td>\n <td> "); out.print( StringUtils.humanTimeDiff(collector2.getCollectionTime()) ); out.write(" </td>\n <td> "); out.print( StringUtils.humanTimeDiff(JSONMetricUtil.getLastGcDuration( collector2.getObjectName())) ); out.write("</td>\n </tr>\n </table>\n </div>\n </div>\n </div>\n "); out.print( StringUtils.humanTimeDiff(collector1.getCollectionTime() + collector2.getCollectionTime())); out.write("\n</div>\n");
out.print( new Date(runtimeBean.getStartTime()) ); out.write("</td>\n <td>"); out.print( StringUtils.humanTimeDiff(runtimeBean.getUptime()) ); out.write("</td>\n <td>"); out.print( JSONMetricUtil.getProcessPID() ); out.print( collector1.getCollectionCount() ); out.write("</td>\n <td> "); out.print( StringUtils.humanTimeDiff(collector1.getCollectionTime()) ); out.write(" </td>\n <td> "); out.print( StringUtils.humanTimeDiff(JSONMetricUtil.getLastGcDuration( collector1.getObjectName())) ); out.write("</td>\n </tr>\n </table>\n </div>\n <div class=\"tab-pane\" id=\"tab_gc2\">\n <table class=\"table table-striped\">\n <tr>\n <th>Collection Count</th>\n <th>Collection Time</th>\n <th>Last duration</th>\n </tr>\n <tr>\n <td> "); out.print( collector2.getCollectionCount() ); out.write("</td>\n <td> "); out.print( StringUtils.humanTimeDiff(collector2.getCollectionTime()) ); out.write(" </td>\n <td> "); out.print( StringUtils.humanTimeDiff(JSONMetricUtil.getLastGcDuration( collector2.getObjectName())) ); out.write("</td>\n </tr>\n </table>\n </div>\n </div>\n </div>\n "); out.print( StringUtils.humanTimeDiff(collector1.getCollectionTime() + collector2.getCollectionTime())); out.write("\n</div>\n");
StringUtils.humanTimeDiff(rootProc.elapsedTime())); procedureFinished(rootProc); return LockState.LOCK_ACQUIRED;
out.print(StringUtils.humanTimeDiff(millisToNextRoll) ); out.write("</td>\n <td> "); out.print(StringUtils.humanTimeDiff(millisFromLastRoll) ); out.write("</td>\n </tr>\n </table>\n </div>\n <div class=\"tab-pane\" id=\"tab_SyncStats\">\n <table class=\"table table-striped\">\n <tr>\n <th> Time</th>\n <th> Sync Wait</th>\n <th> Last num of synced entries</th>\n <th> Total Synced</th>\n <th> Synced per second</th>\n </tr>\n "); for (int i = syncMetricsBuff.size() - 1; i >= 0; --i) { out.print( new Date(syncMetrics.getTimestamp()) ); out.write("</td>\n <td> "); out.print( StringUtils.humanTimeDiff(syncMetrics.getSyncWaitMs()) ); out.write("</td>\n <td> "); out.print( syncMetrics.getSyncedEntries() );