Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: full_update_generator.cc

Issue 4704002: AU: Reduce full payload generation log output. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: remove some whitespace Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "update_engine/full_update_generator.h" 5 #include "update_engine/full_update_generator.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 9
10 #include <tr1/memory> 10 #include <tr1/memory>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 image_size <= utils::FileSize(new_image)); 126 image_size <= utils::FileSize(new_image));
127 const off_t kernel_size = utils::FileSize(new_kernel_part); 127 const off_t kernel_size = utils::FileSize(new_kernel_part);
128 TEST_AND_RETURN_FALSE(kernel_size >= 0); 128 TEST_AND_RETURN_FALSE(kernel_size >= 0);
129 129
130 off_t part_sizes[] = { image_size, kernel_size }; 130 off_t part_sizes[] = { image_size, kernel_size };
131 string paths[] = { new_image, new_kernel_part }; 131 string paths[] = { new_image, new_kernel_part };
132 132
133 for (int partition = 0; partition < 2; ++partition) { 133 for (int partition = 0; partition < 2; ++partition) {
134 const string& path = paths[partition]; 134 const string& path = paths[partition];
135 LOG(INFO) << "compressing " << path; 135 LOG(INFO) << "compressing " << path;
136
137 int in_fd = open(path.c_str(), O_RDONLY, 0); 136 int in_fd = open(path.c_str(), O_RDONLY, 0);
138 TEST_AND_RETURN_FALSE(in_fd >= 0); 137 TEST_AND_RETURN_FALSE(in_fd >= 0);
139 ScopedFdCloser in_fd_closer(&in_fd); 138 ScopedFdCloser in_fd_closer(&in_fd);
140
141 deque<shared_ptr<ChunkProcessor> > threads; 139 deque<shared_ptr<ChunkProcessor> > threads;
142 140 int last_progress_update = INT_MIN;
143 off_t bytes_left = part_sizes[partition], counter = 0, offset = 0; 141 off_t bytes_left = part_sizes[partition], counter = 0, offset = 0;
144 while (bytes_left > 0 || !threads.empty()) { 142 while (bytes_left > 0 || !threads.empty()) {
145 // Check and start new chunk processors if possible. 143 // Check and start new chunk processors if possible.
146 while (threads.size() < max_threads && bytes_left > 0) { 144 while (threads.size() < max_threads && bytes_left > 0) {
147 shared_ptr<ChunkProcessor> processor( 145 shared_ptr<ChunkProcessor> processor(
148 new ChunkProcessor(in_fd, offset, min(bytes_left, chunk_size))); 146 new ChunkProcessor(in_fd, offset, min(bytes_left, chunk_size)));
149 threads.push_back(processor); 147 threads.push_back(processor);
150 TEST_AND_RETURN_FALSE(processor->Start()); 148 TEST_AND_RETURN_FALSE(processor->Start());
151 bytes_left -= chunk_size; 149 bytes_left -= chunk_size;
152 offset += chunk_size; 150 offset += chunk_size;
(...skipping 24 matching lines...) Expand all
177 DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ : 175 DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ :
178 DeltaArchiveManifest_InstallOperation_Type_REPLACE); 176 DeltaArchiveManifest_InstallOperation_Type_REPLACE);
179 op->set_data_offset(*data_file_size); 177 op->set_data_offset(*data_file_size);
180 TEST_AND_RETURN_FALSE(utils::WriteAll(fd, &use_buf[0], use_buf.size())); 178 TEST_AND_RETURN_FALSE(utils::WriteAll(fd, &use_buf[0], use_buf.size()));
181 *data_file_size += use_buf.size(); 179 *data_file_size += use_buf.size();
182 op->set_data_length(use_buf.size()); 180 op->set_data_length(use_buf.size());
183 Extent* dst_extent = op->add_dst_extents(); 181 Extent* dst_extent = op->add_dst_extents();
184 dst_extent->set_start_block(processor->offset() / block_size); 182 dst_extent->set_start_block(processor->offset() / block_size);
185 dst_extent->set_num_blocks(chunk_size / block_size); 183 dst_extent->set_num_blocks(chunk_size / block_size);
186 184
187 LOG(INFO) 185 int progress = static_cast<int>(
188 << StringPrintf("%.1f", 186 (processor->offset() + processor->buffer_in().size()) * 100.0 /
189 processor->offset() * 100.0 / part_sizes[partition]) 187 part_sizes[partition]);
190 << "% complete (output size: " << *data_file_size << ")"; 188 if (last_progress_update < progress &&
189 (last_progress_update + 10 <= progress || progress == 100)) {
190 LOG(INFO) << progress << "% complete (output size: "
191 << *data_file_size << ")";
192 last_progress_update = progress;
193 }
191 } 194 }
192 } 195 }
193 196
194 return true; 197 return true;
195 } 198 }
196 199
197 } // namespace chromeos_update_engine 200 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698