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

Side by Side Diff: pkg/analysis_server/lib/src/domain_diagnostic.dart

Issue 1490623002: Fix rolling averages in diagnostic status. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/status/get_handler.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library src.domain_diagnostic; 5 library src.domain_diagnostic;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core' hide Resource; 9 import 'dart:core' hide Resource;
10 10
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 /// TOOD(pq): consider adding GC to remove mappings for deleted folders 131 /// TOOD(pq): consider adding GC to remove mappings for deleted folders
132 Map<Folder, Average> averages = new HashMap<Folder, Average>(); 132 Map<Folder, Average> averages = new HashMap<Folder, Average>();
133 133
134 final AnalysisServer server; 134 final AnalysisServer server;
135 Sampler(this.server) { 135 Sampler(this.server) {
136 start(); 136 start();
137 _sample(); 137 _sample();
138 } 138 }
139 139
140 /// Get the average for the context associated with the given [folder]. 140 /// Get the average for the context associated with the given [folder].
141 int getAverage(Folder folder) { 141 num getAverage(Folder folder) {
142 resetTimerCountdown(); 142 resetTimerCountdown();
143 return averages[folder].value; 143 return averages[folder].value;
144 } 144 }
145 145
146 /// Check if we're currently sampling. 146 /// Check if we're currently sampling.
147 bool isSampling() => timer?.isActive ?? false; 147 bool isSampling() => timer?.isActive ?? false;
148 148
149 /// Reset counter. 149 /// Reset counter.
150 void resetTimerCountdown() { 150 void resetTimerCountdown() {
151 sampleCount = 0; 151 sampleCount = 0;
(...skipping 29 matching lines...) Expand all
181 averages[folder] = average; 181 averages[folder] = average;
182 } 182 }
183 average.addSample(_workItemCount(context)); 183 average.addSample(_workItemCount(context));
184 } 184 }
185 }); 185 });
186 } on Exception { 186 } on Exception {
187 stop(); 187 stop();
188 } 188 }
189 } 189 }
190 } 190 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/status/get_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698