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

Commit dc1ef3c3 authored by Nathan Bullock's avatar Nathan Bullock Committed by chrome-internal-fetch
Browse files

metrics: read /sys/class/block/*/stat correctly

TEST=unit tests, manual tested on panther_embedded
BUG=chromium:415118

Change-Id: I849a9b7849a27d29d9d24bb1575f113e43716bd5
Reviewed-on: https://chromium-review.googlesource.com/218504


Reviewed-by: default avatarBertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
Tested-by: default avatarNathan Bullock <nathanbullock@google.com>
parent 0be0f736
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -495,7 +495,7 @@ bool MetricsDaemon::DiskStatsReadStats(uint64_t* read_sectors,
    LOG_IF(WARNING, nchars == sizeof(line))
        << "line too long in " << diskstats_path_;
    line[nchars] = '\0';
    nitems = sscanf(line, "%*d %*d %" PRIu64 "d %*d %*d %*d %" PRIu64 "d",
    nitems = sscanf(line, "%*d %*d %" PRIu64 " %*d %*d %*d %" PRIu64,
                    read_sectors, write_sectors);
    if (nitems == 2) {
      success = true;
+2 −2
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@ using chromeos_metrics::PersistentIntegerMock;

static const char kFakeDiskStatsName[] = "fake-disk-stats";
static const char kFakeDiskStatsFormat[] =
    "    1793     1788    %" PRIu64 "d   105580    "
    "    196      175     %" PRIu64 "d    30290    "
    "    1793     1788    %" PRIu64 "   105580    "
    "    196      175     %" PRIu64 "    30290    "
    "    0    44060   135850\n";
static const uint64_t kFakeReadSectors[] = {80000, 100000};
static const uint64_t kFakeWriteSectors[] = {3000, 4000};