Fix 2 bugs in fast mixer statistics
Was losing the upper half of the bounds, and MHz was off.
Change-Id: I61c98027b35ce7c3578ea6f3acf05aa5c48a5831
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index 1492a36..04d0f65 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -467,7 +467,7 @@
#ifdef FAST_MIXER_STATISTICS
// advance the FIFO queue bounds
size_t i = bounds & (FastMixerDumpState::kSamplingN - 1);
- bounds = (bounds + 1) & 0xFFFF;
+ bounds = (bounds & 0xFFFF0000) | ((bounds + 1) & 0xFFFF);
if (full) {
bounds += 0x10000;
} else if (!(bounds & (FastMixerDumpState::kSamplingN - 1))) {
@@ -621,7 +621,7 @@
loadNs.sample(sampleLoadNs);
kHz.sample(sampleCpukHz & ~0xF);
if (sampleCpukHz == previousCpukHz) {
- double megacycles = (double) sampleLoadNs * (double) sampleCpukHz;
+ double megacycles = (double) sampleLoadNs * (double) sampleCpukHz * 1e-12;
double adjMHz = megacycles / mixPeriodSec; // _not_ wallNs * 1e9
loadMHz.sample(adjMHz);
}