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

Commit 102f7e4d authored by David Anderson's avatar David Anderson Committed by Gerrit Code Review
Browse files

Merge "libsnapshot: Add boot_complete metrics."

parents f85f3d62 a0992300
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ message SnapshotUpdateStatus {
    MergePhase merge_phase = 6;
}

// Next: 7
// Next: 9
message SnapshotMergeReport {
    // Status of the update after the merge attempts.
    UpdateState state = 1;
@@ -182,4 +182,10 @@ message SnapshotMergeReport {

    // Sum of the estimated COW fields in the OTA manifest.
    uint64 estimated_cow_size_bytes = 6;

    // Time from boot to sys.boot_completed, in milliseconds.
    uint32 boot_complete_time_ms = 7;

    // Time from sys.boot_completed to merge start, in milliseconds.
    uint32 boot_complete_to_merge_start_time_ms = 8;
}
+8 −0
Original line number Diff line number Diff line
@@ -32,9 +32,13 @@ class ISnapshotMergeStats {
    virtual void set_cow_file_size(uint64_t cow_file_size) = 0;
    virtual void set_total_cow_size_bytes(uint64_t bytes) = 0;
    virtual void set_estimated_cow_size_bytes(uint64_t bytes) = 0;
    virtual void set_boot_complete_time_ms(uint32_t ms) = 0;
    virtual void set_boot_complete_to_merge_start_time_ms(uint32_t ms) = 0;
    virtual uint64_t cow_file_size() = 0;
    virtual uint64_t total_cow_size_bytes() = 0;
    virtual uint64_t estimated_cow_size_bytes() = 0;
    virtual uint32_t boot_complete_time_ms() = 0;
    virtual uint32_t boot_complete_to_merge_start_time_ms() = 0;

    // Called when merge ends. Properly clean up permanent storage.
    class Result {
@@ -62,6 +66,10 @@ class SnapshotMergeStats : public ISnapshotMergeStats {
    void set_estimated_cow_size_bytes(uint64_t bytes) override;
    uint64_t total_cow_size_bytes() override;
    uint64_t estimated_cow_size_bytes() override;
    void set_boot_complete_time_ms(uint32_t ms) override;
    uint32_t boot_complete_time_ms() override;
    void set_boot_complete_to_merge_start_time_ms(uint32_t ms) override;
    uint32_t boot_complete_to_merge_start_time_ms() override;
    std::unique_ptr<Result> Finish() override;

  private:
+16 −0
Original line number Diff line number Diff line
@@ -114,6 +114,22 @@ uint64_t SnapshotMergeStats::estimated_cow_size_bytes() {
    return report_.estimated_cow_size_bytes();
}

void SnapshotMergeStats::set_boot_complete_time_ms(uint32_t ms) {
    report_.set_boot_complete_time_ms(ms);
}

uint32_t SnapshotMergeStats::boot_complete_time_ms() {
    return report_.boot_complete_time_ms();
}

void SnapshotMergeStats::set_boot_complete_to_merge_start_time_ms(uint32_t ms) {
    report_.set_boot_complete_to_merge_start_time_ms(ms);
}

uint32_t SnapshotMergeStats::boot_complete_to_merge_start_time_ms() {
    return report_.boot_complete_to_merge_start_time_ms();
}

class SnapshotMergeStatsResultImpl : public SnapshotMergeStats::Result {
  public:
    SnapshotMergeStatsResultImpl(const SnapshotMergeReport& report,
+4 −0
Original line number Diff line number Diff line
@@ -131,6 +131,10 @@ class SnapshotMergeStatsStub : public ISnapshotMergeStats {
    void set_estimated_cow_size_bytes(uint64_t) override {}
    uint64_t total_cow_size_bytes() override { return 0; }
    uint64_t estimated_cow_size_bytes() override { return 0; }
    void set_boot_complete_time_ms(uint32_t) override {}
    uint32_t boot_complete_time_ms() override { return 0; }
    void set_boot_complete_to_merge_start_time_ms(uint32_t) override {}
    uint32_t boot_complete_to_merge_start_time_ms() override { return 0; }
};

ISnapshotMergeStats* SnapshotManagerStub::GetSnapshotMergeStatsInstance() {