From 5d2314fea09fa86580b756b7d7bac59cd73898d9 Mon Sep 17 00:00:00 2001 From: Dan Zivkovic Date: Thu, 2 Apr 2015 15:54:28 -0700 Subject: [PATCH] Log timing of commitChosenWord() Bug 19987461. Change-Id: If5bb798a350e9083ee8b67a84af132c100f0a7eb --- .../inputmethod/latin/inputlogic/InputLogic.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 5e2b945ba..374417b1c 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -2065,9 +2065,6 @@ public final class InputLogic { } } - // TODO: Remove this before going live. - private static final boolean DEBUG_COMMIT_TIMING = true; - /** * Commits the chosen word to the text field and saves it for later retrieval. * @@ -2079,7 +2076,7 @@ public final class InputLogic { private void commitChosenWord(final SettingsValues settingsValues, final String chosenWord, final int commitType, final String separatorString) { long startTimeMillis = 0; - if (DEBUG_COMMIT_TIMING) { + if (DebugFlags.DEBUG_ENABLED) { startTimeMillis = System.currentTimeMillis(); Log.d(TAG, "commitChosenWord() : [" + chosenWord + "]"); } @@ -2087,7 +2084,7 @@ public final class InputLogic { final CharSequence chosenWordWithSuggestions = SuggestionSpanUtils.getTextWithSuggestionSpan(mLatinIME, chosenWord, suggestedWords); - if (DEBUG_COMMIT_TIMING) { + if (DebugFlags.DEBUG_ENABLED) { long runTimeMillis = System.currentTimeMillis() - startTimeMillis; Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " + "SuggestionSpanUtils.getTextWithSuggestionSpan()"); @@ -2098,7 +2095,7 @@ public final class InputLogic { // previous word. final NgramContext ngramContext = mConnection.getNgramContextFromNthPreviousWord( settingsValues.mSpacingAndPunctuations, mWordComposer.isComposingWord() ? 2 : 1); - if (DEBUG_COMMIT_TIMING) { + if (DebugFlags.DEBUG_ENABLED) { long runTimeMillis = System.currentTimeMillis() - startTimeMillis; Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " + "Connection.getNgramContextFromNthPreviousWord()"); @@ -2106,7 +2103,7 @@ public final class InputLogic { startTimeMillis = System.currentTimeMillis(); } mConnection.commitText(chosenWordWithSuggestions, 1); - if (DEBUG_COMMIT_TIMING) { + if (DebugFlags.DEBUG_ENABLED) { long runTimeMillis = System.currentTimeMillis() - startTimeMillis; Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " + "Connection.commitText"); @@ -2114,7 +2111,7 @@ public final class InputLogic { } // Add the word to the user history dictionary performAdditionToUserHistoryDictionary(settingsValues, chosenWord, ngramContext); - if (DEBUG_COMMIT_TIMING) { + if (DebugFlags.DEBUG_ENABLED) { long runTimeMillis = System.currentTimeMillis() - startTimeMillis; Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " + "performAdditionToUserHistoryDictionary()"); @@ -2126,7 +2123,7 @@ public final class InputLogic { // strings. mLastComposedWord = mWordComposer.commitWord(commitType, chosenWordWithSuggestions, separatorString, ngramContext); - if (DEBUG_COMMIT_TIMING) { + if (DebugFlags.DEBUG_ENABLED) { long runTimeMillis = System.currentTimeMillis() - startTimeMillis; Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " + "WordComposer.commitWord()");