什么可能导致应用程序和系统速度变慢?

发布于 2024-07-16 05:48:34 字数 506 浏览 6 评论 0原文

我正在调试一个应用程序,该应用程序会严重降低系统的速度。 该应用程序从本地硬盘加载大量数据(大约 1000 个文件,每个文件半 MB)。这些文件作为内存映射文件加载,并且仅在需要时进行映射。 这意味着在任何给定时间点虚拟内存使用量都不会超过 300 MB。

我还使用 sysinternals 中的 handle.exe 检查了句柄计数,发现最多打开了 8000 个左右的句柄。 当数据被卸载时,它会下降到 400 左右。每次加载和卸载操作后都没有句柄泄漏。

经过 2-3 个加载卸载周期后,在一次加载期间,系统变得非常慢。 我检查了应用程序的虚拟内存使用情况以及此时的句柄计数,它完全在限制范围内(VM 约为 460MB,也没有太多碎片,句柄计数为 3200)。

我想知道应用程序如何使系统响应速度非常慢? 我还可以使用哪些其他工具来调试此场景?

让我更具体地说,当我指的是系统时,整个窗口都在变慢。 任务管理器本身需要 2 分钟才能启动,并且通常需要硬重启

I am debugging an application which slows down the system very badly. The application loads a large amount of data (some 1000 files each of half an MB) from the local hard disk.The files are loaded as memory mapped files and are mapped only when needed. This means that at any given point in time the virtual memory usage does not exceed 300 MB.

I also checked the Handle count using handle.exe from sysinternals and found that there are at the most some 8000 odd handles opened. When the data is unloaded it drops to around 400. There are no handle leaks after each load and unload operation.

After 2-3 Load unload cycles, during one load, the system becomes very slow. I checked the virtual memory usage of the application as well as the handle counts at this point and it was well within the limits (VM about 460MB not much fragmentation also, handle counts 3200).

I want how an application could make the system very slow to respond? What other tools can I use to debug this scenario?

Let me be more specific, when i mean system it is entire windows that is slowing down. Task manager itself takes 2 mins to come up and most often requires a hard reboot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

望她远 2024-07-23 05:48:34

整个系统速度变慢的事实非常烦人,这意味着您无法轻松附加分析器,这也意味着甚至很难停止分析会话以查看结果(因为您说它需要硬重启)。

在这种情况下最适合这项工作的工具是 ETW(Windows 事件跟踪),这些工具非常棒,将为您提供所需的确切答案,

请在此处查看它们

http://msdn.microsoft.com/en-us/library/cc305210.aspx

http://msdn.microsoft.com/en-us/library/cc305221。 ASPX

http://msdn.microsoft.com/en-us/performance/default。 aspx

希望这有效。
谢谢

The fact that the whole system slows downs is very annoying, it means you can not attach a profiler easily, it also means it would be even difficult to stop the profiling session in order to view the results ( since you said it require a hard reboot ).

The best tool suited for the job in this situation is ETW ( Event Tracing for Windows ), these tools are great, will give you the exact answer you are looking for

Check them out here

http://msdn.microsoft.com/en-us/library/cc305210.aspx
and
http://msdn.microsoft.com/en-us/library/cc305221.aspx
and
http://msdn.microsoft.com/en-us/performance/default.aspx

Hope this works.
Thanks

二手情话 2024-07-23 05:48:34

此时可以使用的工具:

  • Perfmon
  • 事件查看器

根据我的经验,当系统发生阻止任务管理器弹出的问题时,通常是硬件问题 - 检查事件查看器的系统事件日志有时只是充满了某些硬件设备超时的警告或错误。

如果事件查看器没有表明任何类型的可记录硬件错误导致速度变慢,则尝试 Perfmon - 为系统对象添加计数器以跟踪每秒的文件读取、异常、上下文切换等,并查看是否有明显的情况。

坦率地说,所展示的这种行为在设计上是不可能由用户模式代码引起的。 WinNT 付出了很大的努力来隔离应用程序彼此并防止恶意应用程序导致系统无法使用。 所以我怀疑是某种硬件故障造成的。 您是否有可能在不同的 PC 上简单地运行相同的测试?

Tools you can use at this point:

  • Perfmon
  • Event Viewer

In my experience, when things happen to a system that prevent Task Manager from popping up, they're usually of the hardware variety -- checking the system event log of Event Viewer is sometimes just full of warnings or errors that some hardware device is timing out.

If Event Viewer doesn't indicate that any kind of loggable hardware error is causing the slowdown, then try Perfmon -- add counters for system objects to track file read, exceptions, context switches etc. per second and see if there's something obvious there.

Frankly the sort of behavior demonstrated is meant to be impossible - by design - for user-mode code to cause. WinNT goes to a lot of effort to insulate applications from each other and prevent rogue applications from making the system unusable. So my suspicion is some kind of hardware fault is to blame. Is there any chance you can simply run the same test on a different PC?

森林很绿却致人迷途 2024-07-23 05:48:34

如果您没有分析器,您可能必须手动执行相同的工作...

您是否尝试过注释掉所有读/写操作,只是为了检查速度减慢是否消失?
“分而治之”的策略将帮助你找到问题所在。

If you don't have profilers, you may have to do the same work by hand...

Have you tried commenting out all read/write operations, just to check whether the slow down disappears ?
"Divide and conquer" strategies will help you find where the problem lies.

网名女生简单气质 2024-07-23 05:48:34

如果您在 IDE 下运行它,请运行它直到速度变得非常慢,然后点击“暂停”按钮。 当你做任何需要花费这么多时间的事情时,你就会发现它。

If you run it under an IDE, run it until it gets real slow, then hit the "pause" button. You will catch it in the act of doing whatever takes so much time.

(り薆情海 2024-07-23 05:48:34

您可以使用“IBM Rational Quantify”或“Intel VTune”等工具来检测性能问题。
[编辑]
就像 Benoît 所做的那样,一个好的方法是测量任务时间来确定哪个任务正在消耗 cpu。
但请记住,当您正在处理许多文件时,很可能会丢失导致内存到磁盘交换的情况。

You use tools like "IBM Rational Quantify" or "Intel VTune" to detect performance issue.
[EDIT]
Like Benoît did, one good mean is measuring tasks time to identify which is eating cpu.
But remember, as you are working with many files, is likely to be missing that causes the memory to disk swap.

天荒地未老 2024-07-23 05:48:34

当任务管理器需要 2 分钟才能启动时,您是否有大量磁盘活动? 或者是CPU限制的?

我会尝试 sysinternals 中的进程资源管理器。 当您的系统处于减慢状态时,您尝试运行记事本等程序,请注意页面错误增量。

when task manager is taking 2 minutes to come up, are you getting a lot of disk activity? or is it cpu-bound?

I would try process explorer from sysinternals. When your system is in the slowed-down state, and you try running, say, notepad, pay attention to page fault deltas.

岁吢 2024-07-23 05:48:34

Windows 对缓存文件数据非常贪婪。 我会尝试按照某人的建议删除文件 I/O,并确保在处理完文件后立即关闭文件映射。
I/O 可能会导致速度变慢,尤其是当您的文件与操作系统位于同一磁盘上时。 另一种测试方法是将文件移动到另一个磁盘,看看是否可以缓解问题。

Windows is very greedy about caching file data. I would try removing file I/O as someone suggested, and also making sure you close the file mapping as soon as you are done with a file.
I/O is probably causing your slowdown,especially if your files are on the same disk as the OS. Another way to test that would be to move your files to another disk and see if that alleviates the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文