表现 - 0滴答??? [英] Performance - 0 ticks ???

查看:76
本文介绍了表现 - 0滴答???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照我的代码检查性能

double a = r.Next(9)* 1e307;

DateTime d = DateTime.Now;


double b = Math.Pow(a,1 /(double)100);


TimeSpan tm = DateTime.Now - d;


Console.WriteLine(" {0} --- {1}",b,tm.Ticks);


返回值是0蜱虫 - 它不可能!有什么问题?

-

Tamir Khason

你想要dot.NET吗?只需询问:

"请, www.dotnet.us

Follow the code I have to check the performance
double a = r.Next(9)*1e307;
DateTime d = DateTime.Now;

double b = Math.Pow(a,1/(double)100);

TimeSpan tm = DateTime.Now - d;

Console.WriteLine("{0}---{1}",b,tm.Ticks);

The return value is 0 Ticks - IT CAN NOT BE !!! What is the problem?
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "

推荐答案

Tamir Khason< ta ********** @ tcon-NOSPAM.co.il>写道:
Tamir Khason <ta**********@tcon-NOSPAM.co.il> wrote:
按照我的代码检查性能
double a = r.Next(9)* 1e307;

DateTime d = DateTime.Now;

双b = Math.Pow(a,1 /(double)100);

TimeSpan tm = DateTime.Now - d;

Console.WriteLine(" {0} --- {1}",b,tm.Ticks);

返回值为0 Ticks - IT不能!有什么问题?
Follow the code I have to check the performance
double a = r.Next(9)*1e307;
DateTime d = DateTime.Now;

double b = Math.Pow(a,1/(double)100);

TimeSpan tm = DateTime.Now - d;

Console.WriteLine("{0}---{1}",b,tm.Ticks);

The return value is 0 Ticks - IT CAN NOT BE !!! What is the problem?




问题是它花费的时间比

计时器的粒度要少。做一百万次操作,时间,然后除以
a $。


-

Jon Skeet - < ; sk *** @ pobox.com>
http://www.pobox .com / ~siget

如果回复小组,请不要给我发邮件



The problem is that it''s taking less time than the granularity of the
timer. Do the operation a million times, time that, and then divide by
a million.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


谢谢你这个有用了怎么可以在没有多路复用的情况下计算这么小的
操作?


-

Tamir Khason

您想要dot.NET吗?只需询问:

"请, www.dotnet.us


" Jon Skeet [C#MVP]" < SK *** @ pobox.com>在消息中写道

新闻:MP ************************ @ msnews.microsoft.c om ...
Thank you this works, however how it is possible to count such small
operations without multiplexing them?

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Tamir Khason< ta ********** @ tcon-NOSPAM.co.il>写道:
Tamir Khason <ta**********@tcon-NOSPAM.co.il> wrote:
按照我的代码检查性能
double a = r.Next(9)* 1e307;

DateTime d = DateTime.Now;

双b = Math.Pow(a,1 /(double)100);

TimeSpan tm = DateTime.Now - d;

Console.WriteLine(" {0} --- {1}",b,tm.Ticks);

返回值为0 Ticks - IT不能!有什么问题?
Follow the code I have to check the performance
double a = r.Next(9)*1e307;
DateTime d = DateTime.Now;

double b = Math.Pow(a,1/(double)100);

TimeSpan tm = DateTime.Now - d;

Console.WriteLine("{0}---{1}",b,tm.Ticks);

The return value is 0 Ticks - IT CAN NOT BE !!! What is the problem?



问题是它花费的时间少于
计时器的粒度。做手术一百万次,时间,然后除以一百万。

- Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet



The problem is that it''s taking less time than the granularity of the
timer. Do the operation a million times, time that, and then divide by
a million.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too



Tamir Khason< ta ********** @ tcon -NOSPAM.co.il>写道:
Tamir Khason <ta**********@tcon-NOSPAM.co.il> wrote:
谢谢你这个有用,但是怎么可以算这么小的操作而不需要多路复用呢?
Thank you this works, however how it is possible to count such small
operations without multiplexing them?




嗯,有高分辨率性能计数器,记录在

各个地方(我没有链接) - 但说实话,那就是

将受到其他因素的显着影响,例如当时计算机上还发生了什么?b $ b。定时一个非常快的

操作通常是一个坏主意。


-

Jon Skeet - < sk ** *@pobox.com>
http://www.pobox.com/~双向飞碟

如果回复小组,请不要给我发邮件



Well, there''s the high resolution performance counter, documented in
various places (I don''t have a link to hand) - but to be honest, that''s
going to be influenced significantly by other things, such as what else
is happening on the computer at the time. Timing a single very fast
operation is generally a bad idea.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


这篇关于表现 - 0滴答???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆