protected void measureUndo(IFile file) throws PartInitException { AbstractTextEditor editor = (AbstractTextEditor) EditorTestHelper.openInEditor(file, true); editor.showChangeInformation( false); // TODO: remove when undo does no longer trigger timing issue IAction selectAll = editor.getAction(ITextEditorActionConstants.SELECT_ALL); IAction shiftRight = editor.getAction(ITextEditorActionConstants.SHIFT_RIGHT); IAction undo = editor.getAction(ITextEditorActionConstants.UNDO); int warmUpRuns = getWarmUpRuns(); int measuredRuns = getMeasuredRuns(); for (int i = 0; i < warmUpRuns + measuredRuns; i++) { runAction(selectAll); runAction(shiftRight); sleep(5000); EditorTestHelper.runEventQueue(); if (i >= warmUpRuns) fPerformanceMeter.start(); runAction(undo); if (i >= warmUpRuns) fPerformanceMeter.stop(); sleep( 5000); // NOTE: runnables posted from other threads, while the main thread waits here, are // not measured at all } fPerformanceMeter.commit(); assertPerformance(fPerformanceMeter); }