/// <summary>
        /// Deregister all the telemetry counters defined in the specified type and in all its base types.
        /// </summary>
        /// <param name="typeContainingTelemetryDataDefinitions">
        /// The type of a class derived from <see cref="WpcTelemetrySession"/> which contains the definition of all the counters you registered
        /// with a previous call to <see cref="Install"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="typeContainingTelemetryDataDefinitions"/> is <see langword="null"/>.
        /// </exception>
        public static void Uninstall(Type typeContainingTelemetryDataDefinitions)
        {
            if (typeContainingTelemetryDataDefinitions == null)
            {
                throw new ArgumentNullException("typeContainingTelemetryDataDefinitions");
            }

            DeregisterPerformanceCounters(TelemetrySession.FindTelemetryData(typeContainingTelemetryDataDefinitions));
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of <see cref="NullTelemetrySession"/>.
        /// </summary>
        /// <param name="sessionToFake">
        /// An object derived from <see cref="TelemetrySession"/> that must be
        /// <em>faked</em> by this <em>null</em> telemetry session object. This class will accept all
        /// counters declared in the specified type but no operation will be actually performed.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="sessionToFake"/> is <see langword="null"/>
        /// </exception>
        public NullTelemetrySession(TelemetrySession sessionToFake)
        {
            if (sessionToFake == null)
            {
                throw new ArgumentNullException("sessionToFake");
            }

            _telemetryData = FindTelemetryData(sessionToFake.GetType());
        }