Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium 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 "content/browser/browser_shutdown_profile_dumper.h" | 5 #include "content/browser/browser_shutdown_profile_dumper.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/debug/trace_event_impl.h" | 10 #include "base/debug/trace_event_impl.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 | 27 |
| 28 BrowserShutdownProfileDumper::~BrowserShutdownProfileDumper() { | 28 BrowserShutdownProfileDumper::~BrowserShutdownProfileDumper() { |
| 29 WriteTracesToDisc(); | 29 WriteTracesToDisc(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void BrowserShutdownProfileDumper::WriteTracesToDisc() { | 32 void BrowserShutdownProfileDumper::WriteTracesToDisc() { |
| 33 // Note: I have seen a usage of 0.000xx% when dumping - which fits easily. | 33 // Note: I have seen a usage of 0.000xx% when dumping - which fits easily. |
| 34 // Since the tracer stops when the trace buffer is filled, we'd rather save | 34 // Since the tracer stops when the trace buffer is filled, we'd rather save |
| 35 // what we have than nothing since we might see from the amount of events | 35 // what we have than nothing since we might see from the amount of events |
| 36 // that caused the problem. | 36 // that caused the problem. |
| 37 DVLOG(1) << "Flushing shutdown traces to disc. The buffer is %" << | 37 DVLOG(1) << "Flushing shutdown traces to disc. The buffer is %" |
|
alph
2014/11/14 10:59:30
out of curiosity what does % mean here?
yurys
2014/11/14 13:03:47
No idea, it was here before. I believe it is just
| |
| 38 base::debug::TraceLog::GetInstance()->GetBufferPercentFull() << | 38 << base::debug::TraceLog::GetInstance() |
| 39 " full."; | 39 ->GetBufferUsage() |
| 40 .approximate_event_count << " full."; | |
|
alph
2014/11/14 10:59:30
is the change from percent to count intentional?
yurys
2014/11/14 13:03:47
Good catch. Done.
| |
| 40 DCHECK(!dump_file_); | 41 DCHECK(!dump_file_); |
| 41 dump_file_ = base::OpenFile(dump_file_name_, "w+"); | 42 dump_file_ = base::OpenFile(dump_file_name_, "w+"); |
| 42 if (!IsFileValid()) { | 43 if (!IsFileValid()) { |
| 43 LOG(ERROR) << "Failed to open performance trace file: " | 44 LOG(ERROR) << "Failed to open performance trace file: " |
| 44 << dump_file_name_.value(); | 45 << dump_file_name_.value(); |
| 45 return; | 46 return; |
| 46 } | 47 } |
| 47 WriteString("{\"traceEvents\":"); | 48 WriteString("{\"traceEvents\":"); |
| 48 WriteString("["); | 49 WriteString("["); |
| 49 | 50 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 } | 134 } |
| 134 | 135 |
| 135 void BrowserShutdownProfileDumper::CloseFile() { | 136 void BrowserShutdownProfileDumper::CloseFile() { |
| 136 if (!dump_file_) | 137 if (!dump_file_) |
| 137 return; | 138 return; |
| 138 base::CloseFile(dump_file_); | 139 base::CloseFile(dump_file_); |
| 139 dump_file_ = NULL; | 140 dump_file_ = NULL; |
| 140 } | 141 } |
| 141 | 142 |
| 142 } // namespace content | 143 } // namespace content |
| OLD | NEW |