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

Commit dbcede00 authored by Felipe Leme's avatar Felipe Leme Committed by Android (Google) Code Review
Browse files

Merge "Fixed performance issue by moving buffer allocation outside loop."

parents 98a9a7b6 770410dc
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -357,6 +357,8 @@ static void print_header() {


/* adds a new entry to the existing zip file. */
/* adds a new entry to the existing zip file. */
static bool add_zip_entry_from_fd(const std::string& entry_name, int fd) {
static bool add_zip_entry_from_fd(const std::string& entry_name, int fd) {
    DurationReporter duration_reporter(("ADD ZIP ENTRY " + entry_name).c_str());
    ALOGD("Adding zip entry %s", entry_name.c_str());
    int32_t err = zip_writer->StartEntryWithTime(entry_name.c_str(),
    int32_t err = zip_writer->StartEntryWithTime(entry_name.c_str(),
            ZipWriter::kCompress, get_mtime(fd, now));
            ZipWriter::kCompress, get_mtime(fd, now));
    if (err) {
    if (err) {
@@ -364,8 +366,8 @@ static bool add_zip_entry_from_fd(const std::string& entry_name, int fd) {
        return false;
        return false;
    }
    }


    while (1) {
    std::vector<uint8_t> buffer(65536);
    std::vector<uint8_t> buffer(65536);
    while (1) {
        ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer.data(), sizeof(buffer)));
        ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer.data(), sizeof(buffer)));
        if (bytes_read == 0) {
        if (bytes_read == 0) {
            break;
            break;
@@ -413,7 +415,7 @@ void add_dir(const char *dir, bool recursive) {
}
}


static void dumpstate(const std::string& screenshot_path) {
static void dumpstate(const std::string& screenshot_path) {
    std::unique_ptr<DurationReporter> duration_reporter(new DurationReporter("DUMPSTATE"));
    DurationReporter duration_reporter("DUMPSTATE");
    unsigned long timeout;
    unsigned long timeout;


    dump_dev_files("TRUSTY VERSION", "/sys/bus/platform/drivers/trusty", "trusty_version");
    dump_dev_files("TRUSTY VERSION", "/sys/bus/platform/drivers/trusty", "trusty_version");
+0 −1
Original line number Original line Diff line number Diff line
@@ -566,7 +566,6 @@ int run_command_always(const char *title, int timeout_seconds, const char *args[
    } else if (WIFEXITED(status) && WEXITSTATUS(status) > 0) {
    } else if (WIFEXITED(status) && WEXITSTATUS(status) > 0) {
        printf("*** %s: Exit code %d\n", command, WEXITSTATUS(status));
        printf("*** %s: Exit code %d\n", command, WEXITSTATUS(status));
    }
    }
    if (title) printf("[%s: %.3fs elapsed]\n\n", command, (float)elapsed / NANOS_PER_SEC);


    if (weight > 0) {
    if (weight > 0) {
        update_progress(weight);
        update_progress(weight);