<commit_before>// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using Microsoft.VisualStudio.Shell;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Collections.Concurrent;
using System.Text;
using YetiCommon;
using Microsoft.VisualStudio.Threading;
using YetiVSI.Util;
using McMaster.Extensions.CommandLineUtils;
using System.IO;
using System.Diagnostics;
using YetiVSI.DebugEngine;
using Microsoft.VisualStudio.Shell.Interop;
using System.Collections;

namespace YetiVSI.DebuggerOptions
{
    /// <summary>
    /// Identifies the debugger options available via the "Stadia.Debugger enable|disable" commands.
    /// </summary>
    /// <remarks>
    /// The names of these enum values are recorded in DevTools metrics. Avoid changing names unless
    /// you are changing the semantic meaning of the option.
    /// </remarks>
    public enum DebuggerOption
    {
        // Generates a call sequence diagram from YetiVSI DebugEngine calls and writes it to
        // YetiVSI.CallSequenceDiagram log file.
        CALL_SEQUENCE_LOGGING,
        // Capture a subset of LLDB client logging categories (mainly just default). The logs will
        // be written out to the YetiVSI log file.
        // Note: Enabling this will impact performance of the debugger.
        CLIENT_LOGGING,
        // Capture traces while running the YetiVSI DebugEngine and write them to YetiVSI.Trace log
        // file. This is an experimental feature that may result in degraded performance and/or
        // bugs.
        DEBUGGER_TRACING,
        // Enables unhandled exception logging while running the YetiVSI DebugEngine and writes
        // them to YetiVSI log file.
        // Enabled by default.
        EXCEPTION_LOGGING,
        // Enables automatic recording of metrics about unhandled exceptions in the debugger.
        // Enabled by default.
        EXCEPTION_METRICS,
        // Capture Grpc logs to the YetiVSI log file.
        GRPC_LOGGING,
        // Enables experimental Natvis features.  Performance and stability may be degraded when
        // enabled.
        NATVIS_EXPERIMENTAL,
        // Captures parameter value logging while running the YetiVSI DebugEngine and write them to
        // YetiVSI log file.  This is an experimental feature that may result in degraded
        // performance.
        PARAMETER_LOGGING,
        // Capture a subset of LLDB server logging categories (mainly just default). The logs will
        // be written out to the YetiVSI log file.
        // Note: Enabling this will impact performance of the debugger.
        SERVER_LOGGING,
        // Skip waiting until the debugger is attached before starting the game.
        SKIP_WAIT_LAUNCH,
        // Enables metrics about step time to be collected.
        // Enabled by default.
        STEP_TIME_METRICS,
    }

    /// <summary>
    /// Possible values for debugger options.
    /// </summary>
    /// <remarks>
    /// These values are recorded in DevTools metrics as integers. Avoid changing values unless you
    /// are changing the semantic meaning of the value.
    /// </remarks>
    public enum DebuggerOptionState
    {
        DISABLED = 0,
        ENABLED = 1,
    }

    public class DebuggerOptions : IEnumerable<KeyValuePair<DebuggerOption, DebuggerOptionState>>
    {
        public static readonly IReadOnlyDictionary<DebuggerOption, DebuggerOptionState> Defaults =
            new Dictionary<DebuggerOption, DebuggerOptionState>()
            {
                {DebuggerOption.CALL_SEQUENCE_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.CLIENT_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.DEBUGGER_TRACING, DebuggerOptionState.DISABLED},
                {DebuggerOption.EXCEPTION_LOGGING, DebuggerOptionState.ENABLED},
                {DebuggerOption.EXCEPTION_METRICS, DebuggerOptionState.ENABLED},
                {DebuggerOption.GRPC_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.NATVIS_EXPERIMENTAL, DebuggerOptionState.DISABLED},
                {DebuggerOption.PARAMETER_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.SERVER_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.SKIP_WAIT_LAUNCH, DebuggerOptionState.DISABLED},
                {DebuggerOption.STEP_TIME_METRICS, DebuggerOptionState.ENABLED},
            };

        public EventHandler<ValueChangedEventArgs> ValueChanged;

        public class ValueChangedEventArgs
        {
            public ValueChangedEventArgs(DebuggerOption option, DebuggerOptionState state)
            {
                Option = option;
                State = state;
            }

            public DebuggerOption Option { get; }

            public DebuggerOptionState State { get; }<commit_msg>[natvis] Enable Priority attribute by default<commit_after>// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using Microsoft.VisualStudio.Shell;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Collections.Concurrent;
using System.Text;
using YetiCommon;
using Microsoft.VisualStudio.Threading;
using YetiVSI.Util;
using McMaster.Extensions.CommandLineUtils;
using System.IO;
using System.Diagnostics;
using YetiVSI.DebugEngine;
using Microsoft.VisualStudio.Shell.Interop;
using System.Collections;

namespace YetiVSI.DebuggerOptions
{
    /// <summary>
    /// Identifies the debugger options available via the "Stadia.Debugger enable|disable" commands.
    /// </summary>
    /// <remarks>
    /// The names of these enum values are recorded in DevTools metrics. Avoid changing names unless
    /// you are changing the semantic meaning of the option.
    /// </remarks>
    public enum DebuggerOption
    {
        // Generates a call sequence diagram from YetiVSI DebugEngine calls and writes it to
        // YetiVSI.CallSequenceDiagram log file.
        CALL_SEQUENCE_LOGGING,
        // Capture a subset of LLDB client logging categories (mainly just default). The logs will
        // be written out to the YetiVSI log file.
        // Note: Enabling this will impact performance of the debugger.
        CLIENT_LOGGING,
        // Capture traces while running the YetiVSI DebugEngine and write them to YetiVSI.Trace log
        // file. This is an experimental feature that may result in degraded performance and/or
        // bugs.
        DEBUGGER_TRACING,
        // Enables unhandled exception logging while running the YetiVSI DebugEngine and writes
        // them to YetiVSI log file.
        // Enabled by default.
        EXCEPTION_LOGGING,
        // Enables automatic recording of metrics about unhandled exceptions in the debugger.
        // Enabled by default.
        EXCEPTION_METRICS,
        // Capture Grpc logs to the YetiVSI log file.
        GRPC_LOGGING,
        // Enables experimental Natvis features.  Performance and stability may be degraded when
        // enabled.
        NATVIS_EXPERIMENTAL,
        // Captures parameter value logging while running the YetiVSI DebugEngine and write them to
        // YetiVSI log file.  This is an experimental feature that may result in degraded
        // performance.
        PARAMETER_LOGGING,
        // Capture a subset of LLDB server logging categories (mainly just default). The logs will
        // be written out to the YetiVSI log file.
        // Note: Enabling this will impact performance of the debugger.
        SERVER_LOGGING,
        // Skip waiting until the debugger is attached before starting the game.
        SKIP_WAIT_LAUNCH,
        // Enables metrics about step time to be collected.
        // Enabled by default.
        STEP_TIME_METRICS,
    }

    /// <summary>
    /// Possible values for debugger options.
    /// </summary>
    /// <remarks>
    /// These values are recorded in DevTools metrics as integers. Avoid changing values unless you
    /// are changing the semantic meaning of the value.
    /// </remarks>
    public enum DebuggerOptionState
    {
        DISABLED = 0,
        ENABLED = 1,
    }

    public class DebuggerOptions : IEnumerable<KeyValuePair<DebuggerOption, DebuggerOptionState>>
    {
        public static readonly IReadOnlyDictionary<DebuggerOption, DebuggerOptionState> Defaults =
            new Dictionary<DebuggerOption, DebuggerOptionState>()
            {
                {DebuggerOption.CALL_SEQUENCE_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.CLIENT_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.DEBUGGER_TRACING, DebuggerOptionState.DISABLED},
                {DebuggerOption.EXCEPTION_LOGGING, DebuggerOptionState.ENABLED},
                {DebuggerOption.EXCEPTION_METRICS, DebuggerOptionState.ENABLED},
                {DebuggerOption.GRPC_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.NATVIS_EXPERIMENTAL, DebuggerOptionState.ENABLED},
                {DebuggerOption.PARAMETER_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.SERVER_LOGGING, DebuggerOptionState.DISABLED},
                {DebuggerOption.SKIP_WAIT_LAUNCH, DebuggerOptionState.DISABLED},
                {DebuggerOption.STEP_TIME_METRICS, DebuggerOptionState.ENABLED},
            };

        public EventHandler<ValueChangedEventArgs> ValueChanged;

        public class ValueChangedEventArgs
        {
            public ValueChangedEventArgs(DebuggerOption option, DebuggerOptionState state)
            {
                Option = option;
                State = state;
            }

            public DebuggerOption Option { get; }

            public DebuggerOptionState State { get; }
{'fraction_non_alphanumeric': 0.06823855755894591, 'fraction_numerical': 0.0018492834026814608, 'mean_word_length': 2.6053333333333333, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3748381', 'n_tokens_mistral': 2777, 'n_tokens_neox': 2783, 'n_words': 951}