Prep for GCC 4.7
On Galaxy Nexus (./vendor/google/apps/LatinImeGoogle/tests/etc/run-profile.sh -g)
Before
==== test finished, terminate logcat =====
(0) 2506.11 (10.48%)
(1) 21289.22 (89.01%)
(2) 108.29 (0.45%)
(3) 0.00 (0.00%)
(4) 0.00 (0.00%)
(5) 0.00 (0.00%)
(6) 0.00 (0.00%)
(20) 0.00 (0.00%)
Total 23917.44 (sum of others 23903.62)
After
==== test finished, terminate logcat =====
(0) 2499.58 (10.98%)
(1) 20145.66 (88.51%)
(2) 103.17 (0.45%)
(3) 0.00 (0.00%)
(4) 0.00 (0.00%)
(5) 0.00 (0.00%)
(6) 0.00 (0.00%)
(20) 0.00 (0.00%)
Total 22761.98 (sum of others 22748.42)
Change-Id: I662cb361ff9205ef87d640c458b8473df7d54659
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h
index 894e5f1..f32ebec 100644
--- a/native/jni/src/defines.h
+++ b/native/jni/src/defines.h
@@ -167,15 +167,15 @@
}
AKLOGI("Total time is %6.3f ms.",
profile_buf[PROF_BUF_SIZE - 1] * 1000.0f / static_cast<float>(CLOCKS_PER_SEC));
- float all = 0;
+ float all = 0.0f;
for (int i = 0; i < PROF_BUF_SIZE - 1; ++i) {
all += profile_buf[i];
}
- if (all == 0) all = 1;
+ if (all < 1.0f) all = 1.0f;
for (int i = 0; i < PROF_BUF_SIZE - 1; ++i) {
- if (profile_buf[i]) {
+ if (profile_buf[i] > 0.0f) {
AKLOGI("(%d): Used %4.2f%%, %8.4f ms. Called %d times.",
- i, (profile_buf[i] * 100 / all),
+ i, (profile_buf[i] * 100.0f / all),
profile_buf[i] * 1000.0f / static_cast<float>(CLOCKS_PER_SEC),
profile_counter[i]);
}