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

Side by Side Diff: src/compilation-statistics.cc

Issue 676693002: [turbofan] add absolute peak to stats (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « src/compilation-statistics.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project 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 <ostream> // NOLINT(readability/streams) 5 #include <ostream> // NOLINT(readability/streams)
6 #include <vector> 6 #include <vector>
7 7
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/compilation-statistics.h" 9 #include "src/compilation-statistics.h"
10 10
(...skipping 29 matching lines...) Expand all
40 void CompilationStatistics::RecordTotalStats(size_t source_size, 40 void CompilationStatistics::RecordTotalStats(size_t source_size,
41 const BasicStats& stats) { 41 const BasicStats& stats) {
42 source_size += source_size; 42 source_size += source_size;
43 total_stats_.Accumulate(stats); 43 total_stats_.Accumulate(stats);
44 } 44 }
45 45
46 46
47 void CompilationStatistics::BasicStats::Accumulate(const BasicStats& stats) { 47 void CompilationStatistics::BasicStats::Accumulate(const BasicStats& stats) {
48 delta_ += stats.delta_; 48 delta_ += stats.delta_;
49 total_allocated_bytes_ += stats.total_allocated_bytes_; 49 total_allocated_bytes_ += stats.total_allocated_bytes_;
50 if (stats.max_allocated_bytes_ > max_allocated_bytes_) { 50 if (stats.absolute_max_allocated_bytes_ > absolute_max_allocated_bytes_) {
51 absolute_max_allocated_bytes_ = stats.absolute_max_allocated_bytes_;
51 max_allocated_bytes_ = stats.max_allocated_bytes_; 52 max_allocated_bytes_ = stats.max_allocated_bytes_;
52 function_name_ = stats.function_name_; 53 function_name_ = stats.function_name_;
53 } 54 }
54 } 55 }
55 56
56 57
57 static void WriteLine(std::ostream& os, const char* name, 58 static void WriteLine(std::ostream& os, const char* name,
58 const CompilationStatistics::BasicStats& stats, 59 const CompilationStatistics::BasicStats& stats,
59 const CompilationStatistics::BasicStats& total_stats) { 60 const CompilationStatistics::BasicStats& total_stats) {
60 const size_t kBufferSize = 128; 61 const size_t kBufferSize = 128;
61 char buffer[kBufferSize]; 62 char buffer[kBufferSize];
62 63
63 double ms = stats.delta_.InMillisecondsF(); 64 double ms = stats.delta_.InMillisecondsF();
64 double percent = stats.delta_.PercentOf(total_stats.delta_); 65 double percent = stats.delta_.PercentOf(total_stats.delta_);
65 double size_percent = 66 double size_percent =
66 static_cast<double>(stats.total_allocated_bytes_ * 100) / 67 static_cast<double>(stats.total_allocated_bytes_ * 100) /
67 static_cast<double>(total_stats.total_allocated_bytes_); 68 static_cast<double>(total_stats.total_allocated_bytes_);
68 base::OS::SNPrintF(buffer, kBufferSize, 69 base::OS::SNPrintF(buffer, kBufferSize,
69 "%28s %10.3f ms / %5.1f %% %10u total / %5.1f %% %10u max", 70 "%28s %10.3f ms / %5.1f %%"
71 "%10u total / %5.1f %% "
72 "%10u max %10u abs_max",
70 name, ms, percent, stats.total_allocated_bytes_, 73 name, ms, percent, stats.total_allocated_bytes_,
71 size_percent, stats.max_allocated_bytes_); 74 size_percent, stats.max_allocated_bytes_,
75 stats.absolute_max_allocated_bytes_);
72 76
73 os << buffer; 77 os << buffer;
74 if (stats.function_name_.size() > 0) { 78 if (stats.function_name_.size() > 0) {
75 os << " : " << stats.function_name_.c_str(); 79 os << " : " << stats.function_name_.c_str();
76 } 80 }
77 os << std::endl; 81 os << std::endl;
78 } 82 }
79 83
80 84
81 static void WriteFullLine(std::ostream& os) { 85 static void WriteFullLine(std::ostream& os) {
82 os << "-----------------------------------------------" 86 os << "--------------------------------------------------------"
83 "-----------------------------------------------\n"; 87 "--------------------------------------------------------\n";
84 } 88 }
85 89
86 90
87 static void WriteHeader(std::ostream& os) { 91 static void WriteHeader(std::ostream& os) {
88 WriteFullLine(os); 92 WriteFullLine(os);
89 os << " Turbofan timing results:\n"; 93 os << " Turbofan timing results:\n";
90 WriteFullLine(os); 94 WriteFullLine(os);
91 } 95 }
92 96
93 97
94 static void WritePhaseKindBreak(std::ostream& os) { 98 static void WritePhaseKindBreak(std::ostream& os) {
95 os << " ------------------" 99 os << " ---------------------------"
96 "-----------------------------------------------\n"; 100 "--------------------------------------------------------\n";
97 } 101 }
98 102
99 103
100 std::ostream& operator<<(std::ostream& os, const CompilationStatistics& s) { 104 std::ostream& operator<<(std::ostream& os, const CompilationStatistics& s) {
101 // phase_kind_map_ and phase_map_ don't get mutated, so store a bunch of 105 // phase_kind_map_ and phase_map_ don't get mutated, so store a bunch of
102 // pointers into them. 106 // pointers into them.
103 107
104 typedef std::vector<CompilationStatistics::PhaseKindMap::const_iterator> 108 typedef std::vector<CompilationStatistics::PhaseKindMap::const_iterator>
105 SortedPhaseKinds; 109 SortedPhaseKinds;
106 SortedPhaseKinds sorted_phase_kinds(s.phase_kind_map_.size()); 110 SortedPhaseKinds sorted_phase_kinds(s.phase_kind_map_.size());
(...skipping 24 matching lines...) Expand all
131 os << std::endl; 135 os << std::endl;
132 } 136 }
133 WriteFullLine(os); 137 WriteFullLine(os);
134 WriteLine(os, "totals", s.total_stats_, s.total_stats_); 138 WriteLine(os, "totals", s.total_stats_, s.total_stats_);
135 139
136 return os; 140 return os;
137 } 141 }
138 142
139 } // namespace internal 143 } // namespace internal
140 } // namespace v8 144 } // namespace v8
OLDNEW
« no previous file with comments | « src/compilation-statistics.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698