监测程序运行时间的类
2012-11-21 16:13
225 查看
class Program
{
public static void Main(string[] args)
{
Stopwatch sw = new Stopwatch();
object s="";
sw.Start();
for (int i = 0; i < 100000; i++)
{
if (s == null)
{
Console.WriteLine("不为空");
}
++i;
}
sw.Stop();
Console.WriteLine(sw.Elapsed);
sw.Reset();
sw.Start();
for (int i = 0; i < 100000; i++)
{
if (s == DBNull.Value)
{
Console.WriteLine("不为空");
}
++i;
}
sw.Stop();
Console.WriteLine(sw.Elapsed);
Console.ReadKey();
//if (!DBNull.Value.Equals(s))
//{
// Console.WriteLine("不为空");
//}
}
}
{
public static void Main(string[] args)
{
Stopwatch sw = new Stopwatch();
object s="";
sw.Start();
for (int i = 0; i < 100000; i++)
{
if (s == null)
{
Console.WriteLine("不为空");
}
++i;
}
sw.Stop();
Console.WriteLine(sw.Elapsed);
sw.Reset();
sw.Start();
for (int i = 0; i < 100000; i++)
{
if (s == DBNull.Value)
{
Console.WriteLine("不为空");
}
++i;
}
sw.Stop();
Console.WriteLine(sw.Elapsed);
Console.ReadKey();
//if (!DBNull.Value.Equals(s))
//{
// Console.WriteLine("不为空");
//}
}
}
相关文章推荐
- 监测程序运行的时间,stopWatch
- VC中监测程序运行时间(二)-毫秒级
- magento优化-性能-程序运行时间监测
- 【fun】自制程序运行时间监测头文件
- 1026. 程序运行时间(15)
- C#实现测量程序运行时间及cpu使用时间
- 测试python程序运行时间
- java中计算程序运行时间
- C++程序运行时间计算
- c/c++计算程序运行时间的几种方法
- 监测程序时候运行,没有启动
- VC获取系统时间、程序运行时间
- (迟到的博客,始终是一个过程)Linux/Unix环境下计算C程序运行时间
- 用Stopwatch类获得程序运行时间
- vbs脚本指定时间禁止运行指定程序
- PAT B1026 程序运行时间
- PAT-B 1026. 程序运行时间(15)
- 返回程序运行时间(秒)
- 显示程序运行时间_IDL
- python记录程序运行时间的几种方法