在VB6中计时功能/测量性能的最佳方法是什么? [英] What's the best way of timing functions / measuring performance in VB6?

查看:18
本文介绍了在VB6中计时功能/测量性能的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我只想快速测量某个特定功能需要多长时间,我可以调用什么来获得准确的时间?鉴于 VB6 的计时函数精度不高,有没有你调用的 Windows API 函数?

If I just want to do a quick measurement of how long a particular function is taking, what can I call to get an accurate timing? Given that the VB6 timing functions aren't high precision, are there Windows API functions you call instead?

您还通过哪些其他方式衡量应用程序性能?有没有推荐的第三方工具?

In what other ways do you measure application performance? Are there any third-party tools that you recommend?

推荐答案

我通常使用 Windows 高分辨率性能计数器.查看 QueryPerformanceCounterQueryPerfomanceFrequency

I typically use the Windows hihg resolution performance counters. Check out QueryPerformanceCounter and QueryPerfomanceFrequency

通常我有一个简单的类,它的构造函数和析构函数调用 QueryPerformanceCounter,然后将差值添加到运行总计中.

Typically I have a simple class whose constructor and destructor place a call to QueryPerformanceCounter and then add the difference to a running total.

有关工具,请查看 devpartner.虽然它运行良好,但检测大量代码会使我的应用程序运行缓慢.我通常发现我希望只对一两个函数进行精确计时,因此我经常最终使用性能计数器函数而不是使用 devpartner.

For tools check out devpartner. While it works well, instrumenting significant portions of code makes my application run unbearably slow. I typically find I wish to get precise timing on just one or two functions so I frequently end up using the performance counter functions and not using devpartner.

这篇关于在VB6中计时功能/测量性能的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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