.NETFramework:Stopwatch
| ylbtech-System.Diagnostics.Stopwatch.cs |
| 1.返回顶部 |
#region 程序集 System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll
#endregion namespace System.Diagnostics
{
//
// 摘要:
// 提供一组方法和属性,可用于准确地测量运行时间。若要浏览此类型的.NET Framework 源代码,请参阅 Reference Source。
public class Stopwatch
{
//
// 摘要:
// 获取以每秒刻度数表示的计时器频率。 此字段为只读。
public static readonly long Frequency;
//
// 摘要:
// 指示计时器是否基于高分辨率性能计数器。 此字段为只读。
public static readonly bool IsHighResolution; //
// 摘要:
// 初始化 System.Diagnostics.Stopwatch 类的新实例。
public Stopwatch(); //
// 摘要:
// 获取一个值,该值表示 System.Diagnostics.Stopwatch 计时器是否正在运行。
//
// 返回结果:
// 如果 System.Diagnostics.Stopwatch 实例当前正在运行,并且正在测量时间间隔花费的时间,则为 true;否则为 false。
public bool IsRunning { get; }
//
// 摘要:
// 获取当前实例测量得出的总运行时间。
//
// 返回结果:
// 一个只读的 System.TimeSpan,表示当前实例测量得出的总运行时间。
public TimeSpan Elapsed { get; }
//
// 摘要:
// 获取当前实例测量得出的总运行时间(以毫秒为单位)。
//
// 返回结果:
// 一个只读长整型,表示当前实例测量得出的总毫秒数。
public long ElapsedMilliseconds { get; }
//
// 摘要:
// 获取当前实例测量得出的总运行时间(用计时器刻度表示)。
//
// 返回结果:
// 一个只读长整型,表示当前实例测量得出的计时器刻度总数。
public long ElapsedTicks { get; } //
// 摘要:
// 获取计时器机制中的当前刻度数。
//
// 返回结果:
// 一个长整型,表示基础计时器机制中的刻度计数器值。
public static long GetTimestamp();
//
// 摘要:
// 初始化新的 System.Diagnostics.Stopwatch 实例,将运行时间属性设置为零,然后开始测量运行时间。
//
// 返回结果:
// 刚刚开始测量运行时间的 System.Diagnostics.Stopwatch。
public static Stopwatch StartNew();
//
// 摘要:
// 停止时间间隔测量,并将运行时间重置为零。
public void Reset();
//
// 摘要:
// 停止时间间隔测量,将运行时间重置为零,然后开始测量运行时间。
public void Restart();
//
// 摘要:
// 开始或继续测量某个时间间隔的运行时间。
public void Start();
//
// 摘要:
// 停止测量某个时间间隔的运行时间。
public void Stop();
}
}
| 2.返回顶部 |
#region Stopwatch计时器
/// <summary>
/// 计时器开始
/// </summary>
/// <returns></returns>
public static Stopwatch TimerStart()
{
Stopwatch watch = new Stopwatch();
watch.Reset();
watch.Start();
return watch;
}
/// <summary>
/// 计时器结束
/// </summary>
/// <param name="watch"></param>
/// <returns></returns>
public static string TimerEnd(Stopwatch watch)
{
watch.Stop();
double costtime = watch.ElapsedMilliseconds;
return costtime.ToString();
}
#endregion
| 3.返回顶部 |
| 4.返回顶部 |
| 5.返回顶部 |
| 6.返回顶部 |
![]() |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |
.NETFramework:Stopwatch的更多相关文章
- stout代码分析之六:Stopwatch
在进行性能测试时,经常需要计算某个函数执行的时长.stout中的Stopwatch类可实现纳秒精度的计时. Stopwatch内部使用timespec记录开始和技术时间. timeval和time ...
- .NETFramework:DateTimeOffset
ylbtech-.NETFramework:DateTimeOffset 表示一个时间点,通常相对于协调世界时(UTC)的日期和时间来表示. 1.程序集 mscorlib, Version=4.0.0 ...
- .NETFramework:Random
ylbtech-.NETFramework:Random 1.程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c ...
- .NETFramework:ConfigurationManager
ylbtech-.NETFramework:ConfigurationManager 1.程序集 System.Configuration, Version=4.0.0.0, Culture=neut ...
- .NETFramework:StringBuilder
ylbtech-.NETFramework:StringBuilder 1.程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken ...
- .NETFramework:WebClient
ylbtech-.NETFramework:WebClient 1.程序集 System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5 ...
- .NETFramework:Timers
ylbtech-.NETFramework:Timers 1.返回顶部 1. #region 程序集 System, Version=4.0.0.0, Culture=neutral, PublicK ...
- .NETFramework:Stream
ylbtech-.NETFramework:Stream 1.返回顶部 1. #region 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, Publi ...
- .NETFramework:HttpContext
ylbtech-.NETFramework:HttpContext 1.返回顶部 1. #region 程序集 System.Web, Version=4.0.0.0, Culture=neutral ...
随机推荐
- Chrome 浏览器安装Vue插件方法 (十分详细)
博主最近在研究Vue,无奈新手想安装Chrome的Vue插件,整理下安装流程: 1.首先去github下载vue.zip文件插件(还有npm安装方法这里就不介绍了自行百度)下载地址:https://g ...
- sqlplus登陆scott用户,以及退出连接
进入sqlplus界面 即登陆成功,PLsql也一样 退出连接:
- Spring的IoC容器-Spring BeanFactory容器
虽然这个方法已经在3.1之后已经弃用了,但是可以了解一下. 在Spring中,有大量对BeanFactory接口的实现.其中,最常被使用的是XmlBeanFactory类.这个容器从一个XML文件中读 ...
- 【flyway】开源的数据库版本管理工具【migration】
开源的数据库版本管理工具[migration] 记录
- 彻底理解javascript 中的事件对象的pageY, clientY, screenY的区别和联系。
说到底, pageY, clientY, screenY的计算,就是要找到参考点, 它们的值就是: 鼠标点击的点----------- 和参考点指点----------的直角坐标系的距离 stacko ...
- ios NSAttributedString 具体解释
ios NSAttributedString 具体解释 NSAttributedString能够让我们使一个字符串显示的多样化,可是眼下到iOS 5为止,好像对它支持的不是非常好,由于显示起来不太方便 ...
- 手动编译一个c文件(Win7下如何使用GCC编译器)
主要参考这篇http://jingyan.baidu.com/article/c275f6bacc0126e33c756771.html 我没找到minGW的下载地址,而是直接用codeblocks自 ...
- FastDFS的配置、部署与API使用解读(1)Get Started with FastDFS(转)
转载请注明来自:诗商·柳惊鸿CSDN博客,原文链接:FastDFS的配置.部署与API使用解读(1)入门使用教程 1.背景 FastDFS是一款开源的.分布式文件系统(Distributed File ...
- ViewPagerTransforms
https://github.com/eltld/ViewPagerTransforms
- MySQL(6)--复制,docker容器中
MySQL5.7.11实现replication 启动两个安装好mysql的空的docker image ----------------- shell1 master $docker run -i ...
