unity中计算使用的时间

基本上有几种方式

1、DateTime.UtcNow,性能好,速度快,但是精度低一此,10ms左右

2、第二种是用StopWatch,但是据称在多核多线程环境会有时有误差。

3、Process.GetCurrentProcess().TotalProcessorTime;时间准确度高,但相应的是性能较低下。可以使用宏定义,在测试版本中才开启,在正式发布版本中关闭这个功能。

噢,我们用时间,主要是用来埋点查看性能热点的地方。

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>