src/Uno.Diagnostics.Eventing/Performance/Performance.cs
/// <summary>
/// Measures the time spent in the specified func, and returns its value.
/// </summary>
/// <param name="name">A logical name of the func</param>
/// <param name="action">The func to measure</param>
Measures the time spent in the specified func, and returns its value.
Measures the time spent in the specified func and returns its value .
public static T Measure<T>(string name, Func<T> action)
		{
			if (Service != null && Service.IsEnabled)
			{
				T result = default(T);
				Service.Measure(name, () => result = action());
				return result;
			}
			else
            {
                if (_trace.IsEnabled)
                {
                    using (_trace.WriteEventActivity(
                        TraceProvider.Performance_MeasureStart,
                        TraceProvider.Performance_MeasureStop,
                        new[] { name }
                    ))
                    {
                        return action();
                    }
                }
                else
                {
                    return action();
                }
			}
		}
public static T Measure < T > ( string name , Func < T > action ) { if ( Service != null && Service . IsEnabled ) { T result = default ( T ) ; Service . Measure ( name , ( ) => result = action ( ) ) ; return result ; } else { if ( _trace . IsEnabled ) { using ( _trace . WriteEventActivity ( TraceProvider . Performance_MeasureStart , TraceProvider . Performance_MeasureStop , new [ ] { name } ) ) { return action ( ) ; } } else { return action ( ) ; } } }
Measures the time spent in the specified func, and returns its value.
Measures the time spent in the specified func and returns its value .
name
string
A logical name of the func
A logical name of the func
action
Func<T>
The func to measure
The func to measure