diff options
| author | 2018-02-09 03:10:20 +0000 | |
|---|---|---|
| committer | 2018-02-09 03:10:20 +0000 | |
| commit | bde353c36f908c71842683f2c9e7d0565beb4be9 (patch) | |
| tree | c2151d76842f603e88e33d35c5cdd5586fd8bed5 | |
| parent | bd6be624f618a8abf495cdece795732b0a99fcf3 (diff) | |
| parent | 484524a246ffe453f8cd89b698a279c23b0bde1f (diff) | |
Merge "Turn off debug logging in statsd"
22 files changed, 50 insertions, 48 deletions
diff --git a/cmds/statsd/src/StatsLogProcessor.cpp b/cmds/statsd/src/StatsLogProcessor.cpp index 24243afa71df..7662c4025c42 100644 --- a/cmds/statsd/src/StatsLogProcessor.cpp +++ b/cmds/statsd/src/StatsLogProcessor.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "statslog.h" @@ -169,7 +169,7 @@ void StatsLogProcessor::OnLogEvent(LogEvent* event) { void StatsLogProcessor::OnConfigUpdated(const ConfigKey& key, const StatsdConfig& config) { std::lock_guard<std::mutex> lock(mMetricsMutex); - ALOGD("Updated configuration for key %s", key.ToString().c_str()); + VLOG("Updated configuration for key %s", key.ToString().c_str()); sp<MetricsManager> newMetricsManager = new MetricsManager(key, config, mTimeBaseSec, mUidMap); auto it = mMetricsManagers.find(key); if (it == mMetricsManagers.end() && mMetricsManagers.size() > StatsdStats::kMaxConfigCount) { diff --git a/cmds/statsd/src/StatsService.cpp b/cmds/statsd/src/StatsService.cpp index 183a99501024..c24efec4c4fc 100644 --- a/cmds/statsd/src/StatsService.cpp +++ b/cmds/statsd/src/StatsService.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "StatsService.h" diff --git a/cmds/statsd/src/anomaly/AnomalyMonitor.cpp b/cmds/statsd/src/anomaly/AnomalyMonitor.cpp index 4912648b648d..72d29d03c863 100644 --- a/cmds/statsd/src/anomaly/AnomalyMonitor.cpp +++ b/cmds/statsd/src/anomaly/AnomalyMonitor.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true +#define DEBUG false #include "Log.h" #include "anomaly/AnomalyMonitor.h" @@ -36,10 +36,10 @@ void AnomalyMonitor::setStatsCompanionService(sp<IStatsCompanionService> statsCo sp<IStatsCompanionService> tmpForLock = mStatsCompanionService; mStatsCompanionService = statsCompanionService; if (statsCompanionService == nullptr) { - if (DEBUG) ALOGD("Erasing link to statsCompanionService"); + VLOG("Erasing link to statsCompanionService"); return; } - if (DEBUG) ALOGD("Creating link to statsCompanionService"); + VLOG("Creating link to statsCompanionService"); const sp<const AnomalyAlarm> top = mPq.top(); if (top != nullptr) { updateRegisteredAlarmTime_l(top->timestampSec); @@ -58,7 +58,7 @@ void AnomalyMonitor::add(sp<const AnomalyAlarm> alarm) { return; } // TODO: Ensure that refractory period is respected. - if (DEBUG) ALOGD("Adding alarm with time %u", alarm->timestampSec); + VLOG("Adding alarm with time %u", alarm->timestampSec); mPq.push(alarm); if (mRegisteredAlarmTimeSec < 1 || alarm->timestampSec + mMinUpdateTimeSec < mRegisteredAlarmTimeSec) { @@ -72,16 +72,16 @@ void AnomalyMonitor::remove(sp<const AnomalyAlarm> alarm) { ALOGW("Asked to remove a null alarm."); return; } - if (DEBUG) ALOGD("Removing alarm with time %u", alarm->timestampSec); + VLOG("Removing alarm with time %u", alarm->timestampSec); bool wasPresent = mPq.remove(alarm); if (!wasPresent) return; if (mPq.empty()) { - if (DEBUG) ALOGD("Queue is empty. Cancel any alarm."); + VLOG("Queue is empty. Cancel any alarm."); cancelRegisteredAlarmTime_l(); return; } uint32_t soonestAlarmTimeSec = mPq.top()->timestampSec; - if (DEBUG) ALOGD("Soonest alarm is %u", soonestAlarmTimeSec); + VLOG("Soonest alarm is %u", soonestAlarmTimeSec); if (soonestAlarmTimeSec > mRegisteredAlarmTimeSec + mMinUpdateTimeSec) { updateRegisteredAlarmTime_l(soonestAlarmTimeSec); } @@ -91,7 +91,7 @@ void AnomalyMonitor::remove(sp<const AnomalyAlarm> alarm) { // updates to the registered alarm. unordered_set<sp<const AnomalyAlarm>, SpHash<AnomalyAlarm>> AnomalyMonitor::popSoonerThan( uint32_t timestampSec) { - if (DEBUG) ALOGD("Removing alarms with time <= %u", timestampSec); + VLOG("Removing alarms with time <= %u", timestampSec); unordered_set<sp<const AnomalyAlarm>, SpHash<AnomalyAlarm>> oldAlarms; std::lock_guard<std::mutex> lock(mLock); @@ -103,7 +103,7 @@ unordered_set<sp<const AnomalyAlarm>, SpHash<AnomalyAlarm>> AnomalyMonitor::popS // Always update registered alarm time (if anything has changed). if (!oldAlarms.empty()) { if (mPq.empty()) { - if (DEBUG) ALOGD("Queue is empty. Cancel any alarm."); + VLOG("Queue is empty. Cancel any alarm."); cancelRegisteredAlarmTime_l(); } else { // Always update the registered alarm in this case (unlike remove()). @@ -114,7 +114,7 @@ unordered_set<sp<const AnomalyAlarm>, SpHash<AnomalyAlarm>> AnomalyMonitor::popS } void AnomalyMonitor::updateRegisteredAlarmTime_l(uint32_t timestampSec) { - if (DEBUG) ALOGD("Updating reg alarm time to %u", timestampSec); + VLOG("Updating reg alarm time to %u", timestampSec); mRegisteredAlarmTimeSec = timestampSec; if (mStatsCompanionService != nullptr) { mStatsCompanionService->setAnomalyAlarm(secToMs(mRegisteredAlarmTimeSec)); @@ -123,7 +123,7 @@ void AnomalyMonitor::updateRegisteredAlarmTime_l(uint32_t timestampSec) { } void AnomalyMonitor::cancelRegisteredAlarmTime_l() { - if (DEBUG) ALOGD("Cancelling reg alarm."); + VLOG("Cancelling reg alarm."); mRegisteredAlarmTimeSec = 0; if (mStatsCompanionService != nullptr) { mStatsCompanionService->cancelAnomalyAlarm(); diff --git a/cmds/statsd/src/anomaly/AnomalyTracker.cpp b/cmds/statsd/src/anomaly/AnomalyTracker.cpp index 7c5e45e100a5..63f6e2acd9df 100644 --- a/cmds/statsd/src/anomaly/AnomalyTracker.cpp +++ b/cmds/statsd/src/anomaly/AnomalyTracker.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "AnomalyTracker.h" diff --git a/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp b/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp index e459f7681f26..fa0bc0c400b0 100644 --- a/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp +++ b/cmds/statsd/src/anomaly/DurationAnomalyTracker.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "DurationAnomalyTracker.h" diff --git a/cmds/statsd/src/external/CpuTimePerUidFreqPuller.cpp b/cmds/statsd/src/external/CpuTimePerUidFreqPuller.cpp index a75127324745..d0d2f938cf0c 100644 --- a/cmds/statsd/src/external/CpuTimePerUidFreqPuller.cpp +++ b/cmds/statsd/src/external/CpuTimePerUidFreqPuller.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include <fstream> diff --git a/cmds/statsd/src/external/CpuTimePerUidPuller.cpp b/cmds/statsd/src/external/CpuTimePerUidPuller.cpp index e7ea4b9abf0c..d9aeb4656bfe 100644 --- a/cmds/statsd/src/external/CpuTimePerUidPuller.cpp +++ b/cmds/statsd/src/external/CpuTimePerUidPuller.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include <fstream> diff --git a/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp b/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp index 7a2d1991a538..0e126e7a4b44 100644 --- a/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp +++ b/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include <fstream> diff --git a/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.cpp b/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.cpp index 7426e743c40f..7684ed4eb44b 100644 --- a/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.cpp +++ b/cmds/statsd/src/external/KernelUidCpuClusterTimeReader.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include <fstream> diff --git a/cmds/statsd/src/external/Perfetto.cpp b/cmds/statsd/src/external/Perfetto.cpp index 1d8a96850c4b..b09d373a5f3b 100644 --- a/cmds/statsd/src/external/Perfetto.cpp +++ b/cmds/statsd/src/external/Perfetto.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "frameworks/base/cmds/statsd/src/statsd_config.pb.h" // Alert @@ -36,7 +37,7 @@ namespace os { namespace statsd { bool CollectPerfettoTraceAndUploadToDropbox(const PerfettoDetails& config) { - ALOGD("Starting trace collection through perfetto"); + VLOG("Starting trace collection through perfetto"); if (!config.has_trace_config()) { ALOGE("The perfetto trace config is empty, aborting"); @@ -118,7 +119,7 @@ bool CollectPerfettoTraceAndUploadToDropbox(const PerfettoDetails& config) { return false; } - ALOGD("CollectPerfettoTraceAndUploadToDropbox() succeeded"); + VLOG("CollectPerfettoTraceAndUploadToDropbox() succeeded"); return true; } diff --git a/cmds/statsd/src/external/StatsCompanionServicePuller.cpp b/cmds/statsd/src/external/StatsCompanionServicePuller.cpp index b955f1cdaf5a..8210c8dcd63d 100644 --- a/cmds/statsd/src/external/StatsCompanionServicePuller.cpp +++ b/cmds/statsd/src/external/StatsCompanionServicePuller.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true +#define DEBUG false #include "Log.h" #include <android/os/IStatsCompanionService.h> @@ -64,7 +64,7 @@ bool StatsCompanionServicePuller::PullInternal(vector<shared_ptr<LogEvent> >* da std::copy(it.bytes.begin(), it.bytes.end(), tmp.buf + kLogMsgHeaderSize); data->push_back(make_shared<LogEvent>(tmp)); } - ALOGD("StatsCompanionServicePuller::pull succeeded for %d", mTagId); + VLOG("StatsCompanionServicePuller::pull succeeded for %d", mTagId); return true; } else { ALOGW("statsCompanion not found!"); diff --git a/cmds/statsd/src/external/StatsPullerManagerImpl.cpp b/cmds/statsd/src/external/StatsPullerManagerImpl.cpp index 754f81312b12..4c676a70363f 100644 --- a/cmds/statsd/src/external/StatsPullerManagerImpl.cpp +++ b/cmds/statsd/src/external/StatsPullerManagerImpl.cpp @@ -122,14 +122,14 @@ StatsPullerManagerImpl::StatsPullerManagerImpl() } bool StatsPullerManagerImpl::Pull(int tagId, vector<shared_ptr<LogEvent>>* data) { - if (DEBUG) ALOGD("Initiating pulling %d", tagId); + VLOG("Initiating pulling %d", tagId); if (kAllPullAtomInfo.find(tagId) != kAllPullAtomInfo.end()) { - bool ret = kAllPullAtomInfo.find(tagId)->second.puller->Pull(data); - ALOGD("pulled %d items", (int)data->size()); - return ret; + bool ret = kAllPullAtomInfo.find(tagId)->second.puller->Pull(data); + VLOG("pulled %d items", (int)data->size()); + return ret; } else { - ALOGD("Unknown tagId %d", tagId); + VLOG("Unknown tagId %d", tagId); return false; // Return early since we don't know what to pull. } } diff --git a/cmds/statsd/src/external/SubsystemSleepStatePuller.cpp b/cmds/statsd/src/external/SubsystemSleepStatePuller.cpp index 550a06497b84..65a1df0eda20 100644 --- a/cmds/statsd/src/external/SubsystemSleepStatePuller.cpp +++ b/cmds/statsd/src/external/SubsystemSleepStatePuller.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include <android/hardware/power/1.0/IPower.h> diff --git a/cmds/statsd/src/guardrail/MemoryLeakTrackUtil.cpp b/cmds/statsd/src/guardrail/MemoryLeakTrackUtil.cpp index e1947c4a5fe8..01c75873fdf9 100644 --- a/cmds/statsd/src/guardrail/MemoryLeakTrackUtil.cpp +++ b/cmds/statsd/src/guardrail/MemoryLeakTrackUtil.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include <sstream> @@ -63,7 +63,7 @@ std::string dumpMemInfo(size_t limit) { size_t count; if (info == nullptr || overallSize == 0 || infoSize == 0 || (count = overallSize / infoSize) == 0) { - ALOGD("no malloc info, libc.debug.malloc.program property should be set"); + VLOG("no malloc info, libc.debug.malloc.program property should be set"); return std::string(); } diff --git a/cmds/statsd/src/guardrail/StatsdStats.cpp b/cmds/statsd/src/guardrail/StatsdStats.cpp index 77f54569cb47..06c5b0049a3b 100644 --- a/cmds/statsd/src/guardrail/StatsdStats.cpp +++ b/cmds/statsd/src/guardrail/StatsdStats.cpp @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "StatsdStats.h" diff --git a/cmds/statsd/src/logd/LogEvent.cpp b/cmds/statsd/src/logd/LogEvent.cpp index c8857aa9102f..e1ab5d529370 100644 --- a/cmds/statsd/src/logd/LogEvent.cpp +++ b/cmds/statsd/src/logd/LogEvent.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "logd/LogEvent.h" #include "frameworks/base/cmds/statsd/src/statsd_config.pb.h" diff --git a/cmds/statsd/src/metrics/MetricsManager.cpp b/cmds/statsd/src/metrics/MetricsManager.cpp index eb6f0cb9c454..6c21b052e807 100644 --- a/cmds/statsd/src/metrics/MetricsManager.cpp +++ b/cmds/statsd/src/metrics/MetricsManager.cpp @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "MetricsManager.h" #include "statslog.h" diff --git a/cmds/statsd/src/metrics/metrics_manager_util.cpp b/cmds/statsd/src/metrics/metrics_manager_util.cpp index a0173ee9922f..205c8e4b22cd 100644 --- a/cmds/statsd/src/metrics/metrics_manager_util.cpp +++ b/cmds/statsd/src/metrics/metrics_manager_util.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "../condition/CombinationConditionTracker.h" @@ -541,7 +541,7 @@ bool initStatsdConfig(const ConfigKey& key, const StatsdConfig& config, ALOGE("initLogMatchingTrackers failed"); return false; } - ALOGD("initLogMatchingTrackers succeed..."); + VLOG("initLogMatchingTrackers succeed..."); if (!initConditions(key, config, logTrackerMap, conditionTrackerMap, allConditionTrackers, trackerToConditionMap)) { diff --git a/cmds/statsd/src/packages/UidMap.cpp b/cmds/statsd/src/packages/UidMap.cpp index 691423e054b2..0d7b722c40bc 100644 --- a/cmds/statsd/src/packages/UidMap.cpp +++ b/cmds/statsd/src/packages/UidMap.cpp @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "guardrail/StatsdStats.h" diff --git a/cmds/statsd/src/storage/StorageManager.cpp b/cmds/statsd/src/storage/StorageManager.cpp index 00d86582951f..23bd55616be2 100644 --- a/cmds/statsd/src/storage/StorageManager.cpp +++ b/cmds/statsd/src/storage/StorageManager.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include "android-base/stringprintf.h" diff --git a/core/java/android/app/StatsManager.java b/core/java/android/app/StatsManager.java index 86949cab08d4..c2c91c2bcbd6 100644 --- a/core/java/android/app/StatsManager.java +++ b/core/java/android/app/StatsManager.java @@ -33,6 +33,7 @@ import android.util.Slog; public final class StatsManager { IStatsManager mService; private static final String TAG = "StatsManager"; + private static final boolean DEBUG = false; /** * Long extra of uid that added the relevant stats config. @@ -96,12 +97,12 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - Slog.d(TAG, "Failed to find statsd when adding configuration"); + if (DEBUG) Slog.d(TAG, "Failed to find statsd when adding configuration"); return false; } return service.addConfiguration(configKey, config); } catch (RemoteException e) { - Slog.d(TAG, "Failed to connect to statsd when adding configuration"); + if (DEBUG) Slog.d(TAG, "Failed to connect to statsd when adding configuration"); return false; } } @@ -119,12 +120,12 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - Slog.d(TAG, "Failed to find statsd when removing configuration"); + if (DEBUG) Slog.d(TAG, "Failed to find statsd when removing configuration"); return false; } return service.removeConfiguration(configKey); } catch (RemoteException e) { - Slog.d(TAG, "Failed to connect to statsd when removing configuration"); + if (DEBUG) Slog.d(TAG, "Failed to connect to statsd when removing configuration"); return false; } } @@ -233,12 +234,12 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - Slog.d(TAG, "Failed to find statsd when getting data"); + if (DEBUG) Slog.d(TAG, "Failed to find statsd when getting data"); return null; } return service.getData(configKey); } catch (RemoteException e) { - Slog.d(TAG, "Failed to connecto statsd when getting data"); + if (DEBUG) Slog.d(TAG, "Failed to connecto statsd when getting data"); return null; } } @@ -257,12 +258,12 @@ public final class StatsManager { try { IStatsManager service = getIStatsManagerLocked(); if (service == null) { - Slog.d(TAG, "Failed to find statsd when getting metadata"); + if (DEBUG) Slog.d(TAG, "Failed to find statsd when getting metadata"); return null; } return service.getMetadata(); } catch (RemoteException e) { - Slog.d(TAG, "Failed to connecto statsd when getting metadata"); + if (DEBUG) Slog.d(TAG, "Failed to connecto statsd when getting metadata"); return null; } } diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java index d078d37ffa9d..ef6067a73716 100644 --- a/services/core/java/com/android/server/stats/StatsCompanionService.java +++ b/services/core/java/com/android/server/stats/StatsCompanionService.java @@ -85,7 +85,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { public static final String RESULT_RECEIVER_CONTROLLER_KEY = "controller_activity"; static final String TAG = "StatsCompanionService"; - static final boolean DEBUG = true; + static final boolean DEBUG = false; public static final int CODE_DATA_BROADCAST = 1; public static final int CODE_SUBSCRIBER_BROADCAST = 1; |