Unverified Commit 07e06171 authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Report overall and transfer timings as part of hot reload statistics, analytics. (#26537)

parent d22cc77d
...@@ -675,7 +675,7 @@ class HotRunner extends ResidentRunner { ...@@ -675,7 +675,7 @@ class HotRunner extends ResidentRunner {
analyticsParameters[kEventReloadSyncedProceduresCount] = "${details['receivedProceduresCount']}"; analyticsParameters[kEventReloadSyncedProceduresCount] = "${details['receivedProceduresCount']}";
analyticsParameters[kEventReloadSyncedBytes] = '${updatedDevFS.syncedBytes}'; analyticsParameters[kEventReloadSyncedBytes] = '${updatedDevFS.syncedBytes}';
analyticsParameters[kEventReloadInvalidatedSourcesCount] = '${updatedDevFS.invalidatedSourcesCount}'; analyticsParameters[kEventReloadInvalidatedSourcesCount] = '${updatedDevFS.invalidatedSourcesCount}';
flutterUsage.sendEvent('hot', 'reload', parameters: analyticsParameters); analyticsParameters[kEventReloadTransferTimeInMs] = '${devFSTimer.elapsed.inMilliseconds}';
final int loadedLibraryCount = reloadReport['details']['loadedLibraryCount']; final int loadedLibraryCount = reloadReport['details']['loadedLibraryCount'];
final int finalLibraryCount = reloadReport['details']['finalLibraryCount']; final int finalLibraryCount = reloadReport['details']['finalLibraryCount'];
printTrace('reloaded $loadedLibraryCount of $finalLibraryCount libraries'); printTrace('reloaded $loadedLibraryCount of $finalLibraryCount libraries');
...@@ -770,17 +770,22 @@ class HotRunner extends ResidentRunner { ...@@ -770,17 +770,22 @@ class HotRunner extends ResidentRunner {
reassembleTimer.elapsed.inMilliseconds); reassembleTimer.elapsed.inMilliseconds);
reloadTimer.stop(); reloadTimer.stop();
printTrace('Hot reload performed in ${getElapsedAsMilliseconds(reloadTimer.elapsed)}.'); final Duration reloadDuration = reloadTimer.elapsed;
final int reloadInMs = reloadDuration.inMilliseconds;
analyticsParameters[kEventReloadOverallTimeInMs] = '$reloadInMs';
flutterUsage.sendEvent('hot', 'reload', parameters: analyticsParameters);
printTrace('Hot reload performed in $reloadInMs.');
// Record complete time it took for the reload. // Record complete time it took for the reload.
_addBenchmarkData('hotReloadMillisecondsToFrame', _addBenchmarkData('hotReloadMillisecondsToFrame', reloadInMs);
reloadTimer.elapsed.inMilliseconds);
// Only report timings if we reloaded a single view without any // Only report timings if we reloaded a single view without any
// errors or timeouts. // errors or timeouts.
if ((reassembleViews.length == 1) && if ((reassembleViews.length == 1) &&
!reassembleAndScheduleErrors && !reassembleAndScheduleErrors &&
!reassembleTimedOut && !reassembleTimedOut &&
shouldReportReloadTime) shouldReportReloadTime)
flutterUsage.sendTiming('hot', 'reload', reloadTimer.elapsed); flutterUsage.sendTiming('hot', 'reload', reloadDuration);
return OperationResult( return OperationResult(
reassembleAndScheduleErrors ? 1 : OperationResult.ok.code, reassembleAndScheduleErrors ? 1 : OperationResult.ok.code,
......
...@@ -23,6 +23,8 @@ const String kEventReloadSyncedClassesCount = 'cd8'; ...@@ -23,6 +23,8 @@ const String kEventReloadSyncedClassesCount = 'cd8';
const String kEventReloadSyncedProceduresCount = 'cd9'; const String kEventReloadSyncedProceduresCount = 'cd9';
const String kEventReloadSyncedBytes = 'cd10'; const String kEventReloadSyncedBytes = 'cd10';
const String kEventReloadInvalidatedSourcesCount = 'cd11'; const String kEventReloadInvalidatedSourcesCount = 'cd11';
const String kEventReloadTransferTimeInMs = 'cd12';
const String kEventReloadOverallTimeInMs = 'cd13';
Usage get flutterUsage => Usage.instance; Usage get flutterUsage => Usage.instance;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment