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 func that provides 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>(Func<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 > ( Func < 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
Func<string>
A func that provides logical name of the func
A func that provides logical name of the func
action
Func<T>
The func to measure
The func to measure