OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:core'; | 7 import 'dart:core'; |
8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
9 import 'dart:math' show max; | 9 import 'dart:math' show max; |
10 | 10 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 */ | 246 */ |
247 ServerPerformance performanceDuringStartup = new ServerPerformance(); | 247 ServerPerformance performanceDuringStartup = new ServerPerformance(); |
248 | 248 |
249 /** | 249 /** |
250 * Performance information after initial analysis is complete | 250 * Performance information after initial analysis is complete |
251 * or `null` if the initial analysis is not yet complete | 251 * or `null` if the initial analysis is not yet complete |
252 */ | 252 */ |
253 ServerPerformance performanceAfterStartup; | 253 ServerPerformance performanceAfterStartup; |
254 | 254 |
255 /** | 255 /** |
| 256 * Return the total time the server's been alive. |
| 257 */ |
| 258 Duration get uptime { |
| 259 DateTime start = new DateTime.fromMillisecondsSinceEpoch( |
| 260 performanceDuringStartup.startTime); |
| 261 return new DateTime.now().difference(start); |
| 262 } |
| 263 |
| 264 /** |
256 * The class into which performance information is currently being recorded. | 265 * The class into which performance information is currently being recorded. |
257 * During startup, this will be the same as [performanceDuringStartup] | 266 * During startup, this will be the same as [performanceDuringStartup] |
258 * and after startup is complete, this switches to [performanceAfterStartup]. | 267 * and after startup is complete, this switches to [performanceAfterStartup]. |
259 */ | 268 */ |
260 ServerPerformance _performance; | 269 ServerPerformance _performance; |
261 | 270 |
262 /** | 271 /** |
263 * The [Completer] that completes when analysis is complete. | 272 * The [Completer] that completes when analysis is complete. |
264 */ | 273 */ |
265 Completer _onAnalysisCompleteCompleter; | 274 Completer _onAnalysisCompleteCompleter; |
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2368 /** | 2377 /** |
2369 * The [PerformanceTag] for time spent in server request handlers. | 2378 * The [PerformanceTag] for time spent in server request handlers. |
2370 */ | 2379 */ |
2371 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2380 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
2372 | 2381 |
2373 /** | 2382 /** |
2374 * The [PerformanceTag] for time spent in split store microtasks. | 2383 * The [PerformanceTag] for time spent in split store microtasks. |
2375 */ | 2384 */ |
2376 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2385 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
2377 } | 2386 } |
OLD | NEW |