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

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

Merge "storaged: change uid_io reporting"

parents b7cbe4bf 284bd76d
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -37,5 +37,3 @@
2732 storaged_disk_stats (type|3),(start_time|2|3),(end_time|2|3),(read_ios|2|1),(read_merges|2|1),(read_sectors|2|1),(read_ticks|2|3),(write_ios|2|1),(write_merges|2|1),(write_sectors|2|1),(write_ticks|2|3),(o_in_flight|2|1),(io_ticks|2|3),(io_in_queue|2|1)

2733 storaged_emmc_info (mmc_ver|3),(eol|1),(lifetime_a|1),(lifetime_b|1)
 No newline at end of file

2734 storaged_uid_io_alert (name|3),(read|2),(write|2),(interval|2)
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ public:
#define DEFAULT_PERIODIC_CHORES_INTERVAL_UNIT ( 60 )
#define DEFAULT_PERIODIC_CHORES_INTERVAL_DISK_STATS_PUBLISH ( 3600 )
#define DEFAULT_PERIODIC_CHORES_INTERVAL_EMMC_INFO_PUBLISH ( 86400 )
#define DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO ( 3600 )
#define DEFAULT_PERIODIC_CHORES_INTERVAL_UID_IO ( 86400 )

// UID IO threshold in bytes
#define DEFAULT_PERIODIC_CHORES_UID_IO_THRESHOLD ( 1024 * 1024 * 1024ULL )
+4 −2
Original line number Diff line number Diff line
@@ -44,8 +44,10 @@ struct uid_info {

struct uid_event {
    std::string name;
    uint64_t read_bytes;
    uint64_t write_bytes;
    uint64_t fg_read_bytes;
    uint64_t fg_write_bytes;
    uint64_t bg_read_bytes;
    uint64_t bg_write_bytes;
    uint64_t interval;
};

+5 −3
Original line number Diff line number Diff line
@@ -90,9 +90,11 @@ status_t Storaged::dump(int fd, const Vector<String16>& /* args */) {

    const std::vector<struct uid_event>& events = storaged.get_uid_events();
    for (const auto& event : events) {
        dprintf(fd, "%s %llu %llu %llu\n", event.name.c_str(),
            (unsigned long long)event.read_bytes,
            (unsigned long long)event.write_bytes,
        dprintf(fd, "%s %llu %llu %llu %llu %llu\n", event.name.c_str(),
            (unsigned long long)event.fg_read_bytes,
            (unsigned long long)event.fg_write_bytes,
            (unsigned long long)event.bg_read_bytes,
            (unsigned long long)event.bg_write_bytes,
            (unsigned long long)event.interval);
    }
    return NO_ERROR;
+14 −17
Original line number Diff line number Diff line
@@ -145,23 +145,20 @@ void uid_monitor::report()

    for (const auto& it : uids) {
        const struct uid_info& uid = it.second;
        uint64_t bg_read_delta = uid.io[UID_BACKGROUND].read_bytes -
            last_uids[uid.uid].io[UID_BACKGROUND].read_bytes;
        uint64_t bg_write_delta = uid.io[UID_BACKGROUND].write_bytes -
            last_uids[uid.uid].io[UID_BACKGROUND].write_bytes;

        if (bg_read_delta + bg_write_delta >= adjusted_threshold) {
        struct uid_event event;

        event.name = uid.name;
            event.read_bytes = bg_read_delta;
            event.write_bytes = bg_write_delta;
        event.fg_read_bytes = uid.io[UID_FOREGROUND].read_bytes -
            last_uids[uid.uid].io[UID_FOREGROUND].read_bytes;;
        event.fg_write_bytes = uid.io[UID_FOREGROUND].write_bytes -
            last_uids[uid.uid].io[UID_FOREGROUND].write_bytes;;
        event.bg_read_bytes = uid.io[UID_BACKGROUND].read_bytes -
            last_uids[uid.uid].io[UID_BACKGROUND].read_bytes;;
        event.bg_write_bytes = uid.io[UID_BACKGROUND].write_bytes -
            last_uids[uid.uid].io[UID_BACKGROUND].write_bytes;;
        event.interval = uint64_t(ts_delta / NS_PER_SEC);
            add_event(event);

            android_log_event_list(EVENTLOGTAG_UID_IO_ALERT)
                << uid.name << bg_read_delta << bg_write_delta
                << uint64_t(ts_delta / NS_PER_SEC) << LOG_ID_EVENTS;
        }
        add_event(event);
    }

    set_last_uids(std::move(uids), curr_ts);