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

Side by Side Diff: runtime/bin/vmstats/bargraph.dart

Issue 14308006: Resubmission of 21573, with corrected strndup call. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months 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 | runtime/bin/vmstats/isolate_list.dart » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.vmstats; 5 part of dart.vmstats;
6 6
7 class BarGraph { 7 class BarGraph {
8 CanvasElement _canvas; 8 CanvasElement _canvas;
9 GraphModel _model; 9 GraphModel _model;
10 List<Element> _elements; 10 List<Element> _elements;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 int get minTotal { 181 int get minTotal {
182 var min = _LARGE_LENGTH; 182 var min = _LARGE_LENGTH;
183 _samples.forEach((Sample s) => min = (s.total() < min ? s.total() : min)); 183 _samples.forEach((Sample s) => min = (s.total() < min ? s.total() : min));
184 return min; 184 return min;
185 } 185 }
186 186
187 /** 187 /**
188 * Returns the maximum total from all the samples. 188 * Returns the maximum total from all the samples.
189 */ 189 */
190 int get maxTotal { 190 int get maxTotal {
191 var max = 0; 191 var max = 1; // Must be non-zero.
192 _samples.forEach((Sample s) => max = (s.total() > max ? s.total() : max)); 192 _samples.forEach((Sample s) => max = (s.total() > max ? s.total() : max));
193 return max; 193 return max;
194 } 194 }
195 } 195 }
196 196
197 /** 197 /**
198 * An element is a data type that gets charted. Each element has a name for 198 * An element is a data type that gets charted. Each element has a name for
199 * the legend, and a color for the bar graph. The number of elements in a 199 * the legend, and a color for the bar graph. The number of elements in a
200 * graph should match the number of segments in each sample. 200 * graph should match the number of segments in each sample.
201 */ 201 */
(...skipping 14 matching lines...) Expand all
216 216
217 int get length => _segments.length; 217 int get length => _segments.length;
218 int operator[](int i) => _segments[i]; 218 int operator[](int i) => _segments[i];
219 219
220 Iterator<int> get iterator => _segments.iterator; 220 Iterator<int> get iterator => _segments.iterator;
221 221
222 int total() { 222 int total() {
223 return _segments.fold(0, (int prev, int element) => prev + element); 223 return _segments.fold(0, (int prev, int element) => prev + element);
224 } 224 }
225 } 225 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/vmstats/isolate_list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698