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

Commit e72252b6 authored by Chenjie Yu's avatar Chenjie Yu
Browse files

Add command to clear puller cache

Test: manual test
Change-Id: Id1fa48b5a6f2200d22f4a746763f65d0c8d65f72
parent 731f9fa6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@ statsd_common_src := \
    src/external/SubsystemSleepStatePuller.cpp \
    src/external/CpuTimePerUidPuller.cpp \
    src/external/CpuTimePerUidFreqPuller.cpp \
    src/external/KernelUidCpuActiveTimeReader.cpp \
    src/external/KernelUidCpuClusterTimeReader.cpp \
    src/external/StatsPullerManagerImpl.cpp \
    src/logd/LogEvent.cpp \
    src/logd/LogListener.cpp \
+6 −0
Original line number Diff line number Diff line
@@ -551,6 +551,12 @@ status_t StatsService::cmd_dump_memory_info(FILE* out) {
    return NO_ERROR;
}

status_t StatsService::cmd_clear_puller_cache(FILE* out) {
    mStatsPullerManager.ClearPullerCache();
    fprintf(out, "Puller cached data removed!\n");
    return NO_ERROR;
}

Status StatsService::informAllUidData(const vector<int32_t>& uid, const vector<int64_t>& version,
                                      const vector<String16>& app) {
    VLOG("StatsService::informAllUidData was called");
+5 −0
Original line number Diff line number Diff line
@@ -197,6 +197,11 @@ private:
     */
    status_t cmd_dump_memory_info(FILE* out);

  /*
     * Clear all puller cached data
     */
  status_t cmd_clear_puller_cache(FILE* out);

    /**
     * Update a configuration.
     */
+5 −0
Original line number Diff line number Diff line
@@ -59,6 +59,11 @@ bool StatsPuller::Pull(std::vector<std::shared_ptr<LogEvent>>* data) {
    return ret;
}

void StatsPuller::ClearCache() {
    lock_guard<std::mutex> lock(mLock);
    mCachedData.clear();
}

}  // namespace statsd
}  // namespace os
}  // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ public:

    bool Pull(std::vector<std::shared_ptr<LogEvent>>* data);

    void ClearCache();

protected:
    // The atom tag id this puller pulls
    const int mTagId;
Loading