324
325
// Create the utility VM and store the runtime ID.
326
std::wstring json = GenerateConfigJson();
327
- m_system = wsl::windows::common::hcs::CreateComputeSystem(m_machineId.c_str(), json.c_str());
327
+ {
328
+ SlowOperationWatcher slowOperation{"HcsCreateSystem"};
329
+ m_system = wsl::windows::common::hcs::CreateComputeSystem(m_machineId.c_str(), json.c_str());
330
+ }
331
m_runtimeId = wsl::windows::common::hcs::GetRuntimeId(m_system.get());
332
WI_ASSERT(IsEqualGUID(VmId, m_runtimeId));
333
352
// Start the utility VM.
353
try
354
{
355
+ SlowOperationWatcher slowOperation{"HcsStartSystem"};
356
wsl::windows::common::hcs::StartComputeSystem(m_system.get(), json.c_str());
357
}
358
catch (...)
420
}
421
422
// Accept a connection from mini_init with a receive timeout so the service does not get stuck waiting for a response from the VM.
419
- m_miniInitChannel =
420
- wsl::shared::SocketChannel{AcceptConnection(m_vmConfig.KernelBootTimeout), "mini_init", {m_terminatingEvent.get()}};
423
+ {
424
+ SlowOperationWatcher slowOperation{"WaitForMiniInitConnect"};
425
+ m_miniInitChannel =
426
+ wsl::shared::SocketChannel{AcceptConnection(m_vmConfig.KernelBootTimeout), "mini_init", {m_terminatingEvent.get()}};
427
+ }
428
429
// Accept the connection from the Linux guest for notifications.
430
m_notifyChannel = AcceptConnection(m_vmConfig.KernelBootTimeout);
431
432
// Receive and parse the guest kernel version
426
- ReadGuestCapabilities();
433
+ {
434
+ SlowOperationWatcher slowOperation{"ReadGuestCapabilities"};
435
+ ReadGuestCapabilities();
436
+ }
437
438
// Cache the effective swiotlb configuration. The kernel picks a valid GPA, allocates the pool,
439
// and publishes the actual (base, size) via sysfs. Only warn when swiotlb was actually
577
wsl::windows::common::hcs::unique_hcn_network natNetwork;
578
if (m_vmConfig.NetworkingMode == NetworkingMode::Nat)
579
{
570
- natNetwork = wsl::core::NatNetworking::CreateNetwork(m_vmConfig);
580
+ {
581
+ SlowOperationWatcher slowOperation{"CreateNatNetwork"};
582
+ natNetwork = wsl::core::NatNetworking::CreateNetwork(m_vmConfig);
583
+ }
584
if (!natNetwork)
585
{
586
EMIT_USER_WARNING(wsl::shared::Localization::MessageNetworkInitializationFailedFallback2(
1176
{
1177
// Add the VHD to the machine.
1178
auto lock = m_lock.lock_exclusive();
1179
+ SlowOperationWatcher slowOperation{"AttachDistroVhd"};
1180
const auto lun = AttachDiskLockHeld(Configuration.VhdFilePath.c_str(), DiskType::VHD, MountFlags::None, {}, false, m_userToken.get());
1181
+ slowOperation.Reset();
1182
1183
// Launch the init daemon and create the instance.
1184
int flags = LxMiniInitMessageFlagNone;
1242
WI_ClearFlagIf(localConfig.Flags, LXSS_DISTRO_FLAGS_ENABLE_DRIVE_MOUNTING, !m_vmConfig.EnableHostFileSystemAccess);
1243
1244
// Establish a communication channel with the init daemon.
1245
+ SlowOperationWatcher slowOperation{"WaitForInitDaemonConnect"};
1246
auto initSocket = AcceptConnection(ReceiveTimeout);
1247
+ slowOperation.Reset();
1248
1249
// If the system distro is enabled, establish a communication channel with its init daemon.
1250
wil::unique_socket systemDistroSocket;