summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--native/Android.mk5
-rw-r--r--native/src/bigram_dictionary.cpp2
-rw-r--r--native/src/defines.h3
-rw-r--r--native/src/unigram_dictionary.cpp8
4 files changed, 13 insertions, 5 deletions
diff --git a/native/Android.mk b/native/Android.mk
index c22191319..f8cc45d0a 100644
--- a/native/Android.mk
+++ b/native/Android.mk
@@ -31,6 +31,10 @@ ifeq ($(FLAG_DBG), true)
TARGETING_UNBUNDLED_FROYO := false
endif
+ifeq ($(FLAG_DO_PROFILE), true)
+ TARGETING_UNBUNDLED_FROYO := false
+endif
+
ifeq ($(TARGETING_UNBUNDLED_FROYO), true)
LOCAL_NDK_VERSION := 4
LOCAL_SDK_VERSION := 8
@@ -43,6 +47,7 @@ LOCAL_MODULE_TAGS := user
ifeq ($(FLAG_DO_PROFILE), true)
$(warning Making profiling version of native library)
LOCAL_CFLAGS += -DFLAG_DO_PROFILE
+ LOCAL_SHARED_LIBRARIES := libcutils libutils
else # FLAG_DO_PROFILE
ifeq ($(FLAG_DBG), true)
$(warning Making debug version of native library)
diff --git a/native/src/bigram_dictionary.cpp b/native/src/bigram_dictionary.cpp
index d11aee28e..6ed4d0982 100644
--- a/native/src/bigram_dictionary.cpp
+++ b/native/src/bigram_dictionary.cpp
@@ -45,8 +45,8 @@ bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequ
#ifdef FLAG_DBG
char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i];
-#endif
LOGI("Bigram: Found word = %s, freq = %d :", s, frequency);
+#endif
}
// Find the right insertion point
diff --git a/native/src/defines.h b/native/src/defines.h
index a516190af..e460f1ef4 100644
--- a/native/src/defines.h
+++ b/native/src/defines.h
@@ -20,6 +20,7 @@
#ifdef FLAG_DO_PROFILE
// Profiler
+#include <cutils/log.h>
#include <time.h>
#define PROF_BUF_SIZE 100
static double profile_buf[PROF_BUF_SIZE];
@@ -92,8 +93,10 @@ static void prof_out(void) {
#define DEBUG_PROXIMITY_INFO true
#else // FLAG_DBG
+#ifndef FLAG_DO_PROFILE
#define LOGE(fmt, ...)
#define LOGI(fmt, ...)
+#endif // FLAG_DO_PROFILE
#define DEBUG_DICT false
#define DEBUG_DICT_FULL false
#define DEBUG_SHOW_FOUND_WORD false
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp
index 698584e54..5e72c764f 100644
--- a/native/src/unigram_dictionary.cpp
+++ b/native/src/unigram_dictionary.cpp
@@ -172,8 +172,8 @@ int UnigramDictionary::getSuggestions(const ProximityInfo *proximityInfo, const
short unsigned int* w = mOutputChars + j * MAX_WORD_LENGTH;
char s[MAX_WORD_LENGTH];
for (int i = 0; i <= MAX_WORD_LENGTH; i++) s[i] = w[i];
-#endif
LOGI("%s %i", s, mFrequencies[j]);
+#endif
}
LOGI("Next letters: ");
for (int k = 0; k < NEXT_LETTERS_SIZE; k++) {
@@ -301,8 +301,8 @@ bool UnigramDictionary::addWord(unsigned short *word, int length, int frequency)
#ifdef FLAG_DBG
char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i];
-#endif
LOGI("Found word = %s, freq = %d", s, frequency);
+#endif
}
if (length > MAX_WORD_LENGTH) {
if (DEBUG_DICT) {
@@ -325,8 +325,8 @@ bool UnigramDictionary::addWord(unsigned short *word, int length, int frequency)
#ifdef FLAG_DBG
char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i];
-#endif
LOGI("Added word = %s, freq = %d, %d", s, frequency, S_INT_MAX);
+#endif
}
memmove((char*) mFrequencies + (insertAt + 1) * sizeof(mFrequencies[0]),
(char*) mFrequencies + insertAt * sizeof(mFrequencies[0]),
@@ -809,9 +809,9 @@ inline int UnigramDictionary::getMostFrequentWordLike(const int startInputIndex,
char s[inputLength + 1];
for (int i = 0; i < inputLength; ++i) s[i] = word[i];
s[inputLength] = 0;
-#endif
LOGI("New missing space word found: %d > %d (%s), %d, %d",
newFreq, maxFreq, s, inputLength, depth);
+#endif
}
maxFreq = newFreq;
}