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

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

Merge "pullers now cache data to throttle frequent pull requests. all pullers...

Merge "pullers now cache data to throttle frequent pull requests. all pullers have a default 1s cool down before next pull. We can adjust these later. Also add puller stats in StatsdStats"
parents 65b1cfe0 b038b709
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ statsd_common_src := \
    src/config/ConfigKey.cpp \
    src/config/ConfigListener.cpp \
    src/config/ConfigManager.cpp \
    src/external/StatsPuller.cpp \
    src/external/StatsCompanionServicePuller.cpp \
    src/external/ResourcePowerManagerPuller.cpp \
    src/external/CpuTimePerUidPuller.cpp \
+41 −34
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@
#include <fstream>
#include "external/CpuTimePerUidFreqPuller.h"

#include "../guardrail/StatsdStats.h"
#include "CpuTimePerUidFreqPuller.h"
#include "guardrail/StatsdStats.h"
#include "logd/LogEvent.h"
#include "statslog.h"

@@ -45,7 +48,11 @@ static const int kLineBufferSize = 1024;
 * This provides the times a UID's processes spent executing at each different cpu frequency.
 * The file contains a monotonically increasing count of time for a single boot.
 */
bool CpuTimePerUidFreqPuller::Pull(const int tagId, vector<shared_ptr<LogEvent>>* data) {
CpuTimePerUidFreqPuller::CpuTimePerUidFreqPuller()
    : StatsPuller(android::util::CPU_TIME_PER_UID_FREQ) {
}

bool CpuTimePerUidFreqPuller::PullInternal(vector<shared_ptr<LogEvent>>* data) {
    data->clear();

    ifstream fin;
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ namespace statsd {
 */
class CpuTimePerUidFreqPuller : public StatsPuller {
 public:
  bool Pull(const int tagId, vector<std::shared_ptr<LogEvent>>* data) override;
     CpuTimePerUidFreqPuller();
     bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
};

}  // namespace statsd
+35 −29
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include <fstream>
#include "external/CpuTimePerUidPuller.h"

#include "CpuTimePerUidPuller.h"
#include "guardrail/StatsdStats.h"
#include "logd/LogEvent.h"
#include "statslog.h"

@@ -42,7 +44,10 @@ static const int kLineBufferSize = 1024;
 * This provides the time a UID's processes spent executing in user-space and kernel-space.
 * The file contains a monotonically increasing count of time for a single boot.
 */
bool CpuTimePerUidPuller::Pull(const int tagId, vector<shared_ptr<LogEvent>>* data) {
CpuTimePerUidPuller::CpuTimePerUidPuller() : StatsPuller(android::util::CPU_TIME_PER_UID) {
}

bool CpuTimePerUidPuller::PullInternal(vector<shared_ptr<LogEvent>>* data) {
    data->clear();

    ifstream fin;
@@ -71,7 +76,8 @@ bool CpuTimePerUidPuller::Pull(const int tagId, vector<shared_ptr<LogEvent>>* da
        ptr->write(sysTimeMs);
        ptr->init();
        data->push_back(ptr);
    VLOG("uid %lld, user time %lld, sys time %lld", (long long)uid, (long long)userTimeMs, (long long)sysTimeMs);
        VLOG("uid %lld, user time %lld, sys time %lld", (long long)uid, (long long)userTimeMs,
             (long long)sysTimeMs);
    }
    return true;
}
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ namespace statsd {
 */
class CpuTimePerUidPuller : public StatsPuller {
 public:
  bool Pull(const int tagId, vector<std::shared_ptr<LogEvent>>* data) override;
     CpuTimePerUidPuller();
     bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
};

}  // namespace statsd
Loading