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

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

Merge "Pass metrics buffer as std::array" into main

parents 03bb0fb6 aed22829
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ static_assert(static_cast<int>(FrameInfoIndex::NumIndexes) == 24,
              "Must update value in FrameMetrics.java#FRAME_STATS_COUNT (and here)");

void FrameInfo::importUiThreadInfo(int64_t* info) {
    memcpy(mFrameInfo, info, UI_THREAD_FRAME_INFO_SIZE * sizeof(int64_t));
    memcpy(mFrameInfo.data(), info, UI_THREAD_FRAME_INFO_SIZE * sizeof(int64_t));
    mSkippedFrameReason.reset();
}

+4 −2
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@ enum {
};
};

using FrameInfoBuffer = std::array<int64_t, static_cast<size_t>(FrameInfoIndex::NumIndexes)>;

class UiFrameInfoBuilder {
public:
    static constexpr int64_t INVALID_VSYNC_ID = -1;
@@ -152,7 +154,7 @@ public:
        set(FrameInfoIndex::Flags) |= static_cast<uint64_t>(frameInfoFlag);
    }

    const int64_t* data() const { return mFrameInfo; }
    const FrameInfoBuffer& data() const { return mFrameInfo; }

    inline int64_t operator[](FrameInfoIndex index) const { return get(index); }

@@ -201,7 +203,7 @@ public:
    }

private:
    int64_t mFrameInfo[static_cast<int>(FrameInfoIndex::NumIndexes)];
    FrameInfoBuffer mFrameInfo;
    std::optional<SkippedFrameReason> mSkippedFrameReason;
};

+3 −1
Original line number Diff line number Diff line
@@ -18,12 +18,14 @@

#include <utils/RefBase.h>

#include "FrameInfo.h"

namespace android {
namespace uirenderer {

class FrameMetricsObserver : public VirtualLightRefBase {
public:
    virtual void notify(const int64_t* buffer) = 0;
    virtual void notify(const FrameInfoBuffer& buffer) = 0;
    bool waitForPresentTime() const { return mWaitForPresentTime; };

    void reportMetricsFrom(uint64_t frameNumber, int32_t surfaceControlId) {
+3 −1
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@

#include "FrameMetricsReporter.h"

#include "FrameInfo.h"

namespace android {
namespace uirenderer {

void FrameMetricsReporter::reportFrameMetrics(const int64_t* stats, bool hasPresentTime,
void FrameMetricsReporter::reportFrameMetrics(const FrameInfoBuffer& stats, bool hasPresentTime,
                                              uint64_t frameNumber, int32_t surfaceControlId) {
    FatVector<sp<FrameMetricsObserver>, 10> copy;
    {
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ public:
     * stats of frames that are from "old" surfaces (i.e. with surfaceControlIds older than the one
     * the observer was attached on) nor those that are from "old" frame numbers.
     */
    void reportFrameMetrics(const int64_t* stats, bool hasPresentTime, uint64_t frameNumber,
    void reportFrameMetrics(const FrameInfoBuffer& stats, bool hasPresentTime, uint64_t frameNumber,
                            int32_t surfaceControlId);

private:
Loading