Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp (C++)

Code before:
        }
    }
    else
    {
        // lastWriteTime is only valid if mustWriteToDisk is false.
        // Additionally WriteSettingsToDisk() updates the _hash for us already.
        settings->_hash = _calculateHash(settingsString, lastWriteTime);
    }

    // GH#13936: We're interested in how many users opt out of useAtlasEngine,
    // indicating major issues that would require us to disable it by default again.
    {
        const auto& globals = settings->_globals;
        TraceLoggingWrite(
            g_hSettingsModelProvider,
            "AtlasEngine_Enabled",
            TraceLoggingDescription("Event emitted upon settings load, containing whether one is opted-in/out of useAtlasEngine"),
            TraceLoggingBool(globals->HasUseAtlasEngine(), "UseAtlasEngineOverridden", "true if useAtlasEngine is set"),
            TraceLoggingBool(globals->UseAtlasEngine(), "UseAtlasEngine", "true if AtlasEngine is enabled"),
            TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
            TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
    }

    return *settings;
}
catch (const SettingsException& ex)
{
    const auto settings{ winrt::make_self<CascadiaSettings>() };
    settings->_loadError = ex.Error();
    return *settings;
}
catch (const SettingsTypedDeserializationException& e)
{
    const auto settings{ winrt::make_self<CascadiaSettings>() };
    settings->_deserializationErrorMessage = til::u8u16(e.what());
    return *settings;
}

// Function Description:
// - Loads a batch of settings curated for the Universal variant of the terminal app
// Arguments:
// - <none>
// Return Value:
// - a unique_ptr to a CascadiaSettings with the connection types and settings for Universal terminal
Model::CascadiaSettings CascadiaSettings::LoadUniversal()
{
    return *winrt::make_self<CascadiaSettings>(std::string_view{}, DefaultUniversalJson);
}

// Function Description:
// - Creates a new CascadiaSettings object initialized with settings from the

Review comment (performance):
In team sync you mentioned a bunch of performance data we wanted to get insights into as well. Atlas resizing, etc.
Did you want to include those in this PR as well?

Code after:
        }
    }
    else
    {
        // lastWriteTime is only valid if mustWriteToDisk is false.
        // Additionally WriteSettingsToDisk() updates the _hash for us already.
        settings->_hash = _calculateHash(settingsString, lastWriteTime);
    }

    // GH#13936: We're interested in how many users opt out of useAtlasEngine,
    // indicating major issues that would require us to disable it by default again.
    {
        size_t enabled[2]{};
        for (const auto& profile : settings->_activeProfiles)
        {
            enabled[profile.UseAtlasEngine()]++;
        }

        TraceLoggingWrite(
            g_hSettingsModelProvider,
            "AtlasEngine_Usage",
            TraceLoggingDescription("Event emitted upon settings load, containing the number of profiles opted-in/out of useAtlasEngine"),
            TraceLoggingUIntPtr(enabled[0], "UseAtlasEngineDisabled", "Number of profiles for which AtlasEngine is disabled"),
            TraceLoggingUIntPtr(enabled[1], "UseAtlasEngineEnabled", "Number of profiles for which AtlasEngine is enabled"),
            TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
            TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
    }

    return *settings;
}
catch (const SettingsException& ex)
{
    const auto settings{ winrt::make_self<CascadiaSettings>() };
    settings->_loadError = ex.Error();
    return *settings;
}
catch (const SettingsTypedDeserializationException& e)
{
    const auto settings{ winrt::make_self<CascadiaSettings>() };
    settings->_deserializationErrorMessage = til::u8u16(e.what());
    return *settings;
}

// Function Description:
// - Loads a batch of settings curated for the Universal variant of the terminal app
// Arguments:
// - <none>
// Return Value:
// - a unique_ptr to a CascadiaSettings with the connection types and settings for Universal terminal
Model::CascadiaSettings CascadiaSettings::LoadUniversal()
{