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 {
analyticsParameters[kEventReloadSyncedProceduresCount] = "${details['receivedProceduresCount']}";
analyticsParameters[kEventReloadSyncedBytes] = '${updatedDevFS.syncedBytes}';
analyticsParameters[kEventReloadInvalidatedSourcesCount] = '${updatedDevFS.invalidatedSourcesCount}';
flutterUsage.sendEvent('hot', 'reload', parameters: analyticsParameters);
analyticsParameters[kEventReloadTransferTimeInMs] = '${devFSTimer.elapsed.inMilliseconds}';
final int loadedLibraryCount = reloadReport['details']['loadedLibraryCount'];
final int finalLibraryCount = reloadReport['details']['finalLibraryCount'];
printTrace('reloaded $loadedLibraryCount of $finalLibraryCount libraries');
......@@ -770,17 +770,22 @@ class HotRunner extends ResidentRunner {
reassembleTimer.elapsed.inMilliseconds);
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.
_addBenchmarkData('hotReloadMillisecondsToFrame',
reloadTimer.elapsed.inMilliseconds);
_addBenchmarkData('hotReloadMillisecondsToFrame', reloadInMs);
// Only report timings if we reloaded a single view without any
// errors or timeouts.
if ((reassembleViews.length == 1) &&
!reassembleAndScheduleErrors &&
!reassembleTimedOut &&
shouldReportReloadTime)
flutterUsage.sendTiming('hot', 'reload', reloadTimer.elapsed);
flutterUsage.sendTiming('hot', 'reload', reloadDuration);
return OperationResult(
reassembleAndScheduleErrors ? 1 : OperationResult.ok.code,
......
......@@ -23,6 +23,8 @@ const String kEventReloadSyncedClassesCount = 'cd8';
const String kEventReloadSyncedProceduresCount = 'cd9';
const String kEventReloadSyncedBytes = 'cd10';
const String kEventReloadInvalidatedSourcesCount = 'cd11';
const String kEventReloadTransferTimeInMs = 'cd12';
const String kEventReloadOverallTimeInMs = 'cd13';
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