本文整理汇总了C#中Stopwatch.TimeMilliseconds方法的典型用法代码示例。如果您正苦于以下问题:C# Stopwatch.TimeMilliseconds方法的具体用法?C# Stopwatch.TimeMilliseconds怎么用?C# Stopwatch.TimeMilliseconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stopwatch
的用法示例。
在下文中一共展示了Stopwatch.TimeMilliseconds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEntity
/// <summary>
/// Gets an <see cref="EntityResult"/> that represents the actual resource mapped from the specified <paramref name="uri"/>.
/// </summary>
/// <param name="parent">The <see cref="UrlResolver"/> that owns this resolved and calls this method.</param>
/// <param name="context">The current <see cref="SageContext"/> under which this code is executing.</param>
/// <param name="uri">The uri to resolve.</param>
/// <returns>
/// An object that represents the resource mapped from the specified <paramref name="uri"/>.
/// </returns>
public EntityResult GetEntity(UrlResolver parent, SageContext context, string uri)
{
string sourcePath = uri.Replace(Scheme + "://", string.Empty);
EntityResult result = null;
Stopwatch sw = new Stopwatch();
long time = sw.TimeMilliseconds(() => result = this.GetClientResourceReader(context, sourcePath));
log.DebugFormat("Time taken to get resource reader for '{0}': {1}ms", uri, time);
return result;
}