Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bc02409 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Pullers merge isolated process with host"

parents 9555c952 80f9112a
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@ statsd_common_src := \
    src/external/KernelUidCpuActiveTimeReader.cpp \
    src/external/KernelUidCpuActiveTimeReader.cpp \
    src/external/KernelUidCpuClusterTimeReader.cpp \
    src/external/KernelUidCpuClusterTimeReader.cpp \
    src/external/StatsPullerManagerImpl.cpp \
    src/external/StatsPullerManagerImpl.cpp \
    src/external/puller_util.cpp \
    src/logd/LogEvent.cpp \
    src/logd/LogEvent.cpp \
    src/logd/LogListener.cpp \
    src/logd/LogListener.cpp \
    src/logd/LogReader.cpp \
    src/logd/LogReader.cpp \
@@ -175,6 +176,7 @@ LOCAL_SRC_FILES := \
    tests/AnomalyMonitor_test.cpp \
    tests/AnomalyMonitor_test.cpp \
    tests/anomaly/AnomalyTracker_test.cpp \
    tests/anomaly/AnomalyTracker_test.cpp \
    tests/ConfigManager_test.cpp \
    tests/ConfigManager_test.cpp \
    tests/external/puller_util_test.cpp \
    tests/indexed_priority_queue_test.cpp \
    tests/indexed_priority_queue_test.cpp \
    tests/LogEntryMatcher_test.cpp \
    tests/LogEntryMatcher_test.cpp \
    tests/LogReader_test.cpp \
    tests/LogReader_test.cpp \
+3 −1
Original line number Original line Diff line number Diff line
@@ -181,7 +181,9 @@ bool MetricDimensionKey::operator<(const MetricDimensionKey& that) const {
    return toString().compare(that.toString()) < 0;
    return toString().compare(that.toString()) < 0;
};
};



bool compareDimensionsValue(const DimensionsValue& s1, const DimensionsValue& s2) {
    return EqualsTo(s1, s2);
}
}  // namespace statsd
}  // namespace statsd
}  // namespace os
}  // namespace os
}  // namespace android
}  // namespace android
 No newline at end of file
+1 −0
Original line number Original line Diff line number Diff line
@@ -77,6 +77,7 @@ StatsService::StatsService(const sp<Looper>& handlerLooper)
    : mAnomalyMonitor(new AnomalyMonitor(MIN_DIFF_TO_UPDATE_REGISTERED_ALARM_SECS))
    : mAnomalyMonitor(new AnomalyMonitor(MIN_DIFF_TO_UPDATE_REGISTERED_ALARM_SECS))
{
{
    mUidMap = new UidMap();
    mUidMap = new UidMap();
    StatsPuller::SetUidMap(mUidMap);
    mConfigManager = new ConfigManager();
    mConfigManager = new ConfigManager();
    mProcessor = new StatsLogProcessor(mUidMap, mAnomalyMonitor, time(nullptr), [this](const ConfigKey& key) {
    mProcessor = new StatsLogProcessor(mUidMap, mAnomalyMonitor, time(nullptr), [this](const ConfigKey& key) {
        sp<IStatsCompanionService> sc = getStatsCompanionService();
        sp<IStatsCompanionService> sc = getStatsCompanionService();
+6 −1
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@


#include "StatsPuller.h"
#include "StatsPuller.h"
#include "guardrail/StatsdStats.h"
#include "guardrail/StatsdStats.h"
#include "puller_util.h"


namespace android {
namespace android {
namespace os {
namespace os {
@@ -26,6 +27,9 @@ namespace statsd {


using std::lock_guard;
using std::lock_guard;


sp<UidMap> StatsPuller::mUidMap = nullptr;
void StatsPuller::SetUidMap(const sp<UidMap>& uidMap) { mUidMap = uidMap; }

// ValueMetric has a minimum bucket size of 10min so that we don't pull too frequently
// ValueMetric has a minimum bucket size of 10min so that we don't pull too frequently
StatsPuller::StatsPuller(const int tagId)
StatsPuller::StatsPuller(const int tagId)
    : mTagId(tagId) {
    : mTagId(tagId) {
@@ -54,6 +58,7 @@ bool StatsPuller::Pull(std::vector<std::shared_ptr<LogEvent>>* data) {
    mLastPullTimeSec = curTime;
    mLastPullTimeSec = curTime;
    bool ret = PullInternal(&mCachedData);
    bool ret = PullInternal(&mCachedData);
    if (ret) {
    if (ret) {
      mergeIsolatedUidsToHostUid(mCachedData, mUidMap, mTagId);
      (*data) = mCachedData;
      (*data) = mCachedData;
    }
    }
    return ret;
    return ret;
+10 −3
Original line number Original line Diff line number Diff line
@@ -18,11 +18,14 @@


#include <android/os/StatsLogEventWrapper.h>
#include <android/os/StatsLogEventWrapper.h>
#include <utils/String16.h>
#include <utils/String16.h>
#include <utils/RefBase.h>
#include <mutex>
#include <mutex>
#include <vector>
#include <vector>
#include "packages/UidMap.h"


#include "logd/LogEvent.h"
#include "guardrail/StatsdStats.h"
#include "guardrail/StatsdStats.h"
#include "logd/LogEvent.h"
#include "puller_util.h"


using android::os::StatsLogEventWrapper;
using android::os::StatsLogEventWrapper;


@@ -30,7 +33,7 @@ namespace android {
namespace os {
namespace os {
namespace statsd {
namespace statsd {


class StatsPuller {
class StatsPuller : public virtual RefBase {
public:
public:
    StatsPuller(const int tagId);
    StatsPuller(const int tagId);


@@ -44,6 +47,8 @@ public:
    // Clear cache if elapsed time is more than cooldown time
    // Clear cache if elapsed time is more than cooldown time
    int ClearCacheIfNecessary(long timestampSec);
    int ClearCacheIfNecessary(long timestampSec);


    static void SetUidMap(const sp<UidMap>& uidMap);

   protected:
   protected:
    // The atom tag id this puller pulls
    // The atom tag id this puller pulls
    const int mTagId;
    const int mTagId;
@@ -67,6 +72,8 @@ private:
    long mLastPullTimeSec;
    long mLastPullTimeSec;


    int clearCache();
    int clearCache();

    static sp<UidMap> mUidMap;
};
};


}  // namespace statsd
}  // namespace statsd
Loading