Avoid endl when writing symbol files
endl flushes output after each line. Using "\n" instead significantly improves I/O efficiency. Change-Id: If6a5549fc3613ca3a7c9a71838ec36c5b7a20580 Reviewed-on: https://chromium-review.googlesource.com/1077626 Reviewed-by: Ivan Penkov <ivanpe@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
This commit is contained in:
parent
27c001192b
commit
7b3afa9258
1 changed files with 8 additions and 9 deletions
|
@ -44,7 +44,6 @@
|
||||||
namespace google_breakpad {
|
namespace google_breakpad {
|
||||||
|
|
||||||
using std::dec;
|
using std::dec;
|
||||||
using std::endl;
|
|
||||||
using std::hex;
|
using std::hex;
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,12 +232,12 @@ bool Module::WriteRuleMap(const RuleMap &rule_map, std::ostream &stream) {
|
||||||
|
|
||||||
bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
|
bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
|
||||||
stream << "MODULE " << os_ << " " << architecture_ << " "
|
stream << "MODULE " << os_ << " " << architecture_ << " "
|
||||||
<< id_ << " " << name_ << endl;
|
<< id_ << " " << name_ << "\n";
|
||||||
if (!stream.good())
|
if (!stream.good())
|
||||||
return ReportError();
|
return ReportError();
|
||||||
|
|
||||||
if (!code_id_.empty()) {
|
if (!code_id_.empty()) {
|
||||||
stream << "INFO CODE_ID " << code_id_ << endl;
|
stream << "INFO CODE_ID " << code_id_ << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol_data != ONLY_CFI) {
|
if (symbol_data != ONLY_CFI) {
|
||||||
|
@ -249,7 +248,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
|
||||||
file_it != files_.end(); ++file_it) {
|
file_it != files_.end(); ++file_it) {
|
||||||
File *file = file_it->second;
|
File *file = file_it->second;
|
||||||
if (file->source_id >= 0) {
|
if (file->source_id >= 0) {
|
||||||
stream << "FILE " << file->source_id << " " << file->name << endl;
|
stream << "FILE " << file->source_id << " " << file->name << "\n";
|
||||||
if (!stream.good())
|
if (!stream.good())
|
||||||
return ReportError();
|
return ReportError();
|
||||||
}
|
}
|
||||||
|
@ -263,7 +262,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
|
||||||
<< (func->address - load_address_) << " "
|
<< (func->address - load_address_) << " "
|
||||||
<< func->size << " "
|
<< func->size << " "
|
||||||
<< func->parameter_size << " "
|
<< func->parameter_size << " "
|
||||||
<< func->name << dec << endl;
|
<< func->name << dec << "\n";
|
||||||
if (!stream.good())
|
if (!stream.good())
|
||||||
return ReportError();
|
return ReportError();
|
||||||
|
|
||||||
|
@ -274,7 +273,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
|
||||||
<< line_it->size << " "
|
<< line_it->size << " "
|
||||||
<< dec
|
<< dec
|
||||||
<< line_it->number << " "
|
<< line_it->number << " "
|
||||||
<< line_it->file->source_id << endl;
|
<< line_it->file->source_id << "\n";
|
||||||
if (!stream.good())
|
if (!stream.good())
|
||||||
return ReportError();
|
return ReportError();
|
||||||
}
|
}
|
||||||
|
@ -286,7 +285,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
|
||||||
Extern *ext = *extern_it;
|
Extern *ext = *extern_it;
|
||||||
stream << "PUBLIC " << hex
|
stream << "PUBLIC " << hex
|
||||||
<< (ext->address - load_address_) << " 0 "
|
<< (ext->address - load_address_) << " 0 "
|
||||||
<< ext->name << dec << endl;
|
<< ext->name << dec << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +302,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
|
||||||
|| !WriteRuleMap(entry->initial_rules, stream))
|
|| !WriteRuleMap(entry->initial_rules, stream))
|
||||||
return ReportError();
|
return ReportError();
|
||||||
|
|
||||||
stream << endl;
|
stream << "\n";
|
||||||
|
|
||||||
// Write out this entry's delta rules as 'STACK CFI' records.
|
// Write out this entry's delta rules as 'STACK CFI' records.
|
||||||
for (RuleChangeMap::const_iterator delta_it = entry->rule_changes.begin();
|
for (RuleChangeMap::const_iterator delta_it = entry->rule_changes.begin();
|
||||||
|
@ -314,7 +313,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
|
||||||
|| !WriteRuleMap(delta_it->second, stream))
|
|| !WriteRuleMap(delta_it->second, stream))
|
||||||
return ReportError();
|
return ReportError();
|
||||||
|
|
||||||
stream << endl;
|
stream << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue