aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Dierking <aarond@fb.com>2018-05-29 16:53:53 -0700
committerLei Zhang <thestig@chromium.org>2018-05-30 19:05:54 +0000
commit7b3afa9258e58a57ffbeb395d445811f92616ae9 (patch)
tree341c0bfd7b56d3e8b009f5b81c3238534a3e5c35
parentAdd SEVERITY_CRITICAL to logging, that would help to suppress logs from the f... (diff)
downloadbreakpad-7b3afa9258e58a57ffbeb395d445811f92616ae9.tar.xz
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>
-rw-r--r--src/common/module.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/common/module.cc b/src/common/module.cc
index b5fcb623..13c46475 100644
--- a/src/common/module.cc
+++ b/src/common/module.cc
@@ -44,7 +44,6 @@
namespace google_breakpad {
using std::dec;
-using std::endl;
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) {
stream << "MODULE " << os_ << " " << architecture_ << " "
- << id_ << " " << name_ << endl;
+ << id_ << " " << name_ << "\n";
if (!stream.good())
return ReportError();
if (!code_id_.empty()) {
- stream << "INFO CODE_ID " << code_id_ << endl;
+ stream << "INFO CODE_ID " << code_id_ << "\n";
}
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 *file = file_it->second;
if (file->source_id >= 0) {
- stream << "FILE " << file->source_id << " " << file->name << endl;
+ stream << "FILE " << file->source_id << " " << file->name << "\n";
if (!stream.good())
return ReportError();
}
@@ -263,7 +262,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
<< (func->address - load_address_) << " "
<< func->size << " "
<< func->parameter_size << " "
- << func->name << dec << endl;
+ << func->name << dec << "\n";
if (!stream.good())
return ReportError();
@@ -274,7 +273,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
<< line_it->size << " "
<< dec
<< line_it->number << " "
- << line_it->file->source_id << endl;
+ << line_it->file->source_id << "\n";
if (!stream.good())
return ReportError();
}
@@ -286,7 +285,7 @@ bool Module::Write(std::ostream &stream, SymbolData symbol_data) {
Extern *ext = *extern_it;
stream << "PUBLIC " << hex
<< (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))
return ReportError();
- stream << endl;
+ stream << "\n";
// Write out this entry's delta rules as 'STACK CFI' records.
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))
return ReportError();
- stream << endl;
+ stream << "\n";
}
}
}