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

Commit b8e4dbdb authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10180570 from 1dd15d0d to udc-release

Change-Id: Iadaf8eafbb1a0f9294cd0b0e86178ac6c8173f1e
parents a998c4fe 1dd15d0d
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -611,10 +611,14 @@ typedef struct AHeadingEvent {
 * sensors_event_t
 */
typedef struct ASensorEvent {
    int32_t version; /* sizeof(struct ASensorEvent) */
    int32_t sensor;  /** The sensor that generates this event */
    int32_t type;    /** Sensor type for the event, such as {@link ASENSOR_TYPE_ACCELEROMETER} */
    int32_t reserved0; /** do not use */
    /* sizeof(struct ASensorEvent) */
    int32_t version;
    /** The sensor that generates this event */
    int32_t sensor;
    /** Sensor type for the event, such as {@link ASENSOR_TYPE_ACCELEROMETER} */
    int32_t type;
    /** do not use */
    int32_t reserved0;
    /**
     * The time in nanoseconds at which the event happened, and its behavior
     * is identical to <a href="/reference/android/hardware/SensorEvent#timestamp">
+23 −9
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ static uint32_t gNPolicies = 0;
static uint32_t gNCpus = 0;
static std::vector<std::vector<uint32_t>> gPolicyFreqs;
static std::vector<std::vector<uint32_t>> gPolicyCpus;
static std::vector<uint32_t> gCpuIndexMap;
static std::set<uint32_t> gAllFreqs;
static unique_fd gTisTotalMapFd;
static unique_fd gTisMapFd;
@@ -108,7 +109,7 @@ static bool initGlobals() {
        free(dirlist[i]);
    }
    free(dirlist);

    uint32_t max_cpu_number = 0;
    for (const auto &policy : policyFileNames) {
        std::vector<uint32_t> freqs;
        for (const auto &name : {"available", "boost"}) {
@@ -127,8 +128,19 @@ static bool initGlobals() {
        std::string path = StringPrintf("%s/%s/%s", basepath, policy.c_str(), "related_cpus");
        auto cpus = readNumbersFromFile(path);
        if (!cpus) return false;
        for (auto cpu : *cpus) {
            if(cpu > max_cpu_number)
                max_cpu_number = cpu;
        }
        gPolicyCpus.emplace_back(*cpus);
    }
    gCpuIndexMap = std::vector<uint32_t>(max_cpu_number+1, -1);
    uint32_t cpuorder = 0;
    for (const auto &cpuList : gPolicyCpus) {
        for (auto cpu : cpuList) {
            gCpuIndexMap[cpu] = cpuorder++;
        }
    }

    gTisTotalMapFd =
            unique_fd{bpf_obj_get(BPF_FS_PATH "map_timeInState_total_time_in_state_map")};
@@ -277,7 +289,7 @@ std::optional<std::vector<std::vector<uint64_t>>> getTotalCpuFreqTimes() {
        for (uint32_t policyIdx = 0; policyIdx < gNPolicies; ++policyIdx) {
            if (freqIdx >= gPolicyFreqs[policyIdx].size()) continue;
            for (const auto &cpu : gPolicyCpus[policyIdx]) {
                out[policyIdx][freqIdx] += vals[cpu];
                out[policyIdx][freqIdx] += vals[gCpuIndexMap[cpu]];
            }
        }
    }
@@ -316,7 +328,8 @@ std::optional<std::vector<std::vector<uint64_t>>> getUidCpuFreqTimes(uint32_t ui
            auto end = nextOffset < gPolicyFreqs[j].size() ? begin + FREQS_PER_ENTRY : out[j].end();

            for (const auto &cpu : gPolicyCpus[j]) {
                std::transform(begin, end, std::begin(vals[cpu].ar), begin, std::plus<uint64_t>());
                std::transform(begin, end, std::begin(vals[gCpuIndexMap[cpu]].ar), begin,
                               std::plus<uint64_t>());
            }
        }
    }
@@ -382,7 +395,8 @@ getUidsUpdatedCpuFreqTimes(uint64_t *lastUpdate) {
            auto end = nextOffset < gPolicyFreqs[i].size() ? begin + FREQS_PER_ENTRY :
                map[key.uid][i].end();
            for (const auto &cpu : gPolicyCpus[i]) {
                std::transform(begin, end, std::begin(vals[cpu].ar), begin, std::plus<uint64_t>());
                std::transform(begin, end, std::begin(vals[gCpuIndexMap[cpu]].ar), begin,
                               std::plus<uint64_t>());
            }
        }
        prevKey = key;
@@ -437,8 +451,8 @@ std::optional<concurrent_time_t> getUidConcurrentTimes(uint32_t uid, bool retry)
                                                                     : ret.policy[policy].end();

            for (const auto &cpu : gPolicyCpus[policy]) {
                std::transform(policyBegin, policyEnd, std::begin(vals[cpu].policy), policyBegin,
                               std::plus<uint64_t>());
                std::transform(policyBegin, policyEnd, std::begin(vals[gCpuIndexMap[cpu]].policy),
                               policyBegin, std::plus<uint64_t>());
            }
        }
    }
@@ -506,8 +520,8 @@ std::optional<std::unordered_map<uint32_t, concurrent_time_t>> getUidsUpdatedCon
                                                                : ret[key.uid].policy[policy].end();

            for (const auto &cpu : gPolicyCpus[policy]) {
                std::transform(policyBegin, policyEnd, std::begin(vals[cpu].policy), policyBegin,
                               std::plus<uint64_t>());
                std::transform(policyBegin, policyEnd, std::begin(vals[gCpuIndexMap[cpu]].policy),
                               policyBegin, std::plus<uint64_t>());
            }
        }
    } while (prevKey = key, !getNextMapKey(gConcurrentMapFd, &prevKey, &key));
@@ -640,7 +654,7 @@ getAggregatedTaskCpuFreqTimes(pid_t tgid, const std::vector<uint16_t> &aggregati
                auto end = nextOffset < gPolicyFreqs[j].size() ? begin + FREQS_PER_ENTRY
                                                               : map[key.aggregation_key][j].end();
                for (const auto &cpu : gPolicyCpus[j]) {
                    std::transform(begin, end, std::begin(vals[cpu].ar), begin,
                    std::transform(begin, end, std::begin(vals[gCpuIndexMap[cpu]].ar), begin,
                                   std::plus<uint64_t>());
                }
            }
+591 −0

File changed.

Preview size limit exceeded, changes collapsed.

+7 −4
Original line number Diff line number Diff line
@@ -2674,12 +2674,15 @@ void SurfaceFlinger::composite(TimePoint frameTime, VsyncId vsyncId)

    mTimeStats->recordFrameDuration(frameTime.ns(), systemTime());

    // Send a power hint hint after presentation is finished
    // Send a power hint after presentation is finished.
    if (mPowerHintSessionEnabled) {
        const nsecs_t pastPresentTime =
                getPreviousPresentFence(frameTime, vsyncPeriod)->getSignalTime();
        // Now that the current frame has been presented above, PowerAdvisor needs the present time
        // of the previous frame (whose fence is signaled by now) to determine how long the HWC had
        // waited on that fence to retire before presenting.
        const auto& previousPresentFence = mPreviousPresentFences[0].fenceTime;

        mPowerAdvisor->setSfPresentTiming(TimePoint::fromNs(pastPresentTime), TimePoint::now());
        mPowerAdvisor->setSfPresentTiming(TimePoint::fromNs(previousPresentFence->getSignalTime()),
                                          TimePoint::now());
        mPowerAdvisor->reportActualWorkDuration();
    }