Fix build for profiling

Change-Id: I39cd0fa37fb738dcbbcf82839b6bb030e3af606b
main
satok 2011-07-14 08:32:57 +09:00
parent 6a6aad0758
commit 787945bf1e
4 changed files with 13 additions and 5 deletions

View File

@ -31,6 +31,10 @@ ifeq ($(FLAG_DBG), true)
TARGETING_UNBUNDLED_FROYO := false TARGETING_UNBUNDLED_FROYO := false
endif endif
ifeq ($(FLAG_DO_PROFILE), true)
TARGETING_UNBUNDLED_FROYO := false
endif
ifeq ($(TARGETING_UNBUNDLED_FROYO), true) ifeq ($(TARGETING_UNBUNDLED_FROYO), true)
LOCAL_NDK_VERSION := 4 LOCAL_NDK_VERSION := 4
LOCAL_SDK_VERSION := 8 LOCAL_SDK_VERSION := 8
@ -43,6 +47,7 @@ LOCAL_MODULE_TAGS := user
ifeq ($(FLAG_DO_PROFILE), true) ifeq ($(FLAG_DO_PROFILE), true)
$(warning Making profiling version of native library) $(warning Making profiling version of native library)
LOCAL_CFLAGS += -DFLAG_DO_PROFILE LOCAL_CFLAGS += -DFLAG_DO_PROFILE
LOCAL_SHARED_LIBRARIES := libcutils libutils
else # FLAG_DO_PROFILE else # FLAG_DO_PROFILE
ifeq ($(FLAG_DBG), true) ifeq ($(FLAG_DBG), true)
$(warning Making debug version of native library) $(warning Making debug version of native library)

View File

@ -45,8 +45,8 @@ bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequ
#ifdef FLAG_DBG #ifdef FLAG_DBG
char s[length + 1]; char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i]; for (int i = 0; i <= length; i++) s[i] = word[i];
#endif
LOGI("Bigram: Found word = %s, freq = %d :", s, frequency); LOGI("Bigram: Found word = %s, freq = %d :", s, frequency);
#endif
} }
// Find the right insertion point // Find the right insertion point

View File

@ -20,6 +20,7 @@
#ifdef FLAG_DO_PROFILE #ifdef FLAG_DO_PROFILE
// Profiler // Profiler
#include <cutils/log.h>
#include <time.h> #include <time.h>
#define PROF_BUF_SIZE 100 #define PROF_BUF_SIZE 100
static double profile_buf[PROF_BUF_SIZE]; static double profile_buf[PROF_BUF_SIZE];
@ -92,8 +93,10 @@ static void prof_out(void) {
#define DEBUG_PROXIMITY_INFO true #define DEBUG_PROXIMITY_INFO true
#else // FLAG_DBG #else // FLAG_DBG
#ifndef FLAG_DO_PROFILE
#define LOGE(fmt, ...) #define LOGE(fmt, ...)
#define LOGI(fmt, ...) #define LOGI(fmt, ...)
#endif // FLAG_DO_PROFILE
#define DEBUG_DICT false #define DEBUG_DICT false
#define DEBUG_DICT_FULL false #define DEBUG_DICT_FULL false
#define DEBUG_SHOW_FOUND_WORD false #define DEBUG_SHOW_FOUND_WORD false

View File

@ -172,8 +172,8 @@ int UnigramDictionary::getSuggestions(const ProximityInfo *proximityInfo, const
short unsigned int* w = mOutputChars + j * MAX_WORD_LENGTH; short unsigned int* w = mOutputChars + j * MAX_WORD_LENGTH;
char s[MAX_WORD_LENGTH]; char s[MAX_WORD_LENGTH];
for (int i = 0; i <= MAX_WORD_LENGTH; i++) s[i] = w[i]; for (int i = 0; i <= MAX_WORD_LENGTH; i++) s[i] = w[i];
#endif
LOGI("%s %i", s, mFrequencies[j]); LOGI("%s %i", s, mFrequencies[j]);
#endif
} }
LOGI("Next letters: "); LOGI("Next letters: ");
for (int k = 0; k < NEXT_LETTERS_SIZE; k++) { 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 #ifdef FLAG_DBG
char s[length + 1]; char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i]; for (int i = 0; i <= length; i++) s[i] = word[i];
#endif
LOGI("Found word = %s, freq = %d", s, frequency); LOGI("Found word = %s, freq = %d", s, frequency);
#endif
} }
if (length > MAX_WORD_LENGTH) { if (length > MAX_WORD_LENGTH) {
if (DEBUG_DICT) { if (DEBUG_DICT) {
@ -325,8 +325,8 @@ bool UnigramDictionary::addWord(unsigned short *word, int length, int frequency)
#ifdef FLAG_DBG #ifdef FLAG_DBG
char s[length + 1]; char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i]; for (int i = 0; i <= length; i++) s[i] = word[i];
#endif
LOGI("Added word = %s, freq = %d, %d", s, frequency, S_INT_MAX); LOGI("Added word = %s, freq = %d, %d", s, frequency, S_INT_MAX);
#endif
} }
memmove((char*) mFrequencies + (insertAt + 1) * sizeof(mFrequencies[0]), memmove((char*) mFrequencies + (insertAt + 1) * sizeof(mFrequencies[0]),
(char*) mFrequencies + insertAt * sizeof(mFrequencies[0]), (char*) mFrequencies + insertAt * sizeof(mFrequencies[0]),
@ -809,9 +809,9 @@ inline int UnigramDictionary::getMostFrequentWordLike(const int startInputIndex,
char s[inputLength + 1]; char s[inputLength + 1];
for (int i = 0; i < inputLength; ++i) s[i] = word[i]; for (int i = 0; i < inputLength; ++i) s[i] = word[i];
s[inputLength] = 0; s[inputLength] = 0;
#endif
LOGI("New missing space word found: %d > %d (%s), %d, %d", LOGI("New missing space word found: %d > %d (%s), %d, %d",
newFreq, maxFreq, s, inputLength, depth); newFreq, maxFreq, s, inputLength, depth);
#endif
} }
maxFreq = newFreq; maxFreq = newFreq;
} }