Ejemplo n.º 1
0
        /// <summary>
        /// Starts the collecting a time for the specified performance.
        /// !!!! To use in a using block !!!!
        /// </summary>
        /// <returns>An object to dispose for stop the collection.</returns>
        /// <param name="Performance">Performance to collect.</param>
        public InvokeOnDisposal StartCollect(string performance)
        {
            // - Create a new collector
            var collector = CreateCollection(performance);

            // - Invoke the "new collection" event
            OnStartCollect?.Invoke(this, collector);

            // - Start collecting data
            collector.Start();

            // - Stop collecting data once the scope delete this object
            return(new InvokeOnDisposal(() => collector.Stop()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts the collecting a time for the specified performance.
        /// !!!! To use in a using block !!!!
        /// </summary>
        /// <returns>An object to dispose for stop the collection.</returns>
        /// <param name="Performance">Performance to collect.</param>
        /// <param name="collectOnRelease">If set to <c>true</c> collect on release build else not.</param>
        public InvokeOnDisposal StartCollect(string performance, bool collectOnRelease = false)
        {
                        #if !DEBUG
            if (!collectOnRelease)
            {
                return(null);
            }
                        #endif

            PerformanceCollection currentPerformance;

            currentPerformance = CreateCollection(performance);

            OnStartCollect?.Invoke(currentPerformance);

            currentPerformance.Start();

            // - Send a request for stop the collection
            return(new InvokeOnDisposal(() => currentPerformance.Stop()));
        }