am 4c326c66: Merge "Log timing of commitChosenWord()"

* commit '4c326c66e983ece2b8fb6c8b3220c7281e26a7b8':
  Log timing of commitChosenWord()
main
Dan Zivkovic 2015-04-02 23:06:03 +00:00 committed by Android Git Automerger
commit 9be565404d
1 changed files with 6 additions and 9 deletions

View File

@ -2094,9 +2094,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. * Commits the chosen word to the text field and saves it for later retrieval.
* *
@ -2108,7 +2105,7 @@ public final class InputLogic {
private void commitChosenWord(final SettingsValues settingsValues, final String chosenWord, private void commitChosenWord(final SettingsValues settingsValues, final String chosenWord,
final int commitType, final String separatorString) { final int commitType, final String separatorString) {
long startTimeMillis = 0; long startTimeMillis = 0;
if (DEBUG_COMMIT_TIMING) { if (DebugFlags.DEBUG_ENABLED) {
startTimeMillis = System.currentTimeMillis(); startTimeMillis = System.currentTimeMillis();
Log.d(TAG, "commitChosenWord() : [" + chosenWord + "]"); Log.d(TAG, "commitChosenWord() : [" + chosenWord + "]");
} }
@ -2116,7 +2113,7 @@ public final class InputLogic {
final CharSequence chosenWordWithSuggestions = final CharSequence chosenWordWithSuggestions =
SuggestionSpanUtils.getTextWithSuggestionSpan(mLatinIME, chosenWord, SuggestionSpanUtils.getTextWithSuggestionSpan(mLatinIME, chosenWord,
suggestedWords); suggestedWords);
if (DEBUG_COMMIT_TIMING) { if (DebugFlags.DEBUG_ENABLED) {
long runTimeMillis = System.currentTimeMillis() - startTimeMillis; long runTimeMillis = System.currentTimeMillis() - startTimeMillis;
Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run "
+ "SuggestionSpanUtils.getTextWithSuggestionSpan()"); + "SuggestionSpanUtils.getTextWithSuggestionSpan()");
@ -2127,7 +2124,7 @@ public final class InputLogic {
// previous word. // previous word.
final NgramContext ngramContext = mConnection.getNgramContextFromNthPreviousWord( final NgramContext ngramContext = mConnection.getNgramContextFromNthPreviousWord(
settingsValues.mSpacingAndPunctuations, mWordComposer.isComposingWord() ? 2 : 1); settingsValues.mSpacingAndPunctuations, mWordComposer.isComposingWord() ? 2 : 1);
if (DEBUG_COMMIT_TIMING) { if (DebugFlags.DEBUG_ENABLED) {
long runTimeMillis = System.currentTimeMillis() - startTimeMillis; long runTimeMillis = System.currentTimeMillis() - startTimeMillis;
Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run "
+ "Connection.getNgramContextFromNthPreviousWord()"); + "Connection.getNgramContextFromNthPreviousWord()");
@ -2135,7 +2132,7 @@ public final class InputLogic {
startTimeMillis = System.currentTimeMillis(); startTimeMillis = System.currentTimeMillis();
} }
mConnection.commitText(chosenWordWithSuggestions, 1); mConnection.commitText(chosenWordWithSuggestions, 1);
if (DEBUG_COMMIT_TIMING) { if (DebugFlags.DEBUG_ENABLED) {
long runTimeMillis = System.currentTimeMillis() - startTimeMillis; long runTimeMillis = System.currentTimeMillis() - startTimeMillis;
Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run "
+ "Connection.commitText"); + "Connection.commitText");
@ -2143,7 +2140,7 @@ public final class InputLogic {
} }
// Add the word to the user history dictionary // Add the word to the user history dictionary
performAdditionToUserHistoryDictionary(settingsValues, chosenWord, ngramContext); performAdditionToUserHistoryDictionary(settingsValues, chosenWord, ngramContext);
if (DEBUG_COMMIT_TIMING) { if (DebugFlags.DEBUG_ENABLED) {
long runTimeMillis = System.currentTimeMillis() - startTimeMillis; long runTimeMillis = System.currentTimeMillis() - startTimeMillis;
Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run "
+ "performAdditionToUserHistoryDictionary()"); + "performAdditionToUserHistoryDictionary()");
@ -2155,7 +2152,7 @@ public final class InputLogic {
// strings. // strings.
mLastComposedWord = mWordComposer.commitWord(commitType, mLastComposedWord = mWordComposer.commitWord(commitType,
chosenWordWithSuggestions, separatorString, ngramContext); chosenWordWithSuggestions, separatorString, ngramContext);
if (DEBUG_COMMIT_TIMING) { if (DebugFlags.DEBUG_ENABLED) {
long runTimeMillis = System.currentTimeMillis() - startTimeMillis; long runTimeMillis = System.currentTimeMillis() - startTimeMillis;
Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run " Log.d(TAG, "commitChosenWord() : " + runTimeMillis + " ms to run "
+ "WordComposer.commitWord()"); + "WordComposer.commitWord()");