通过引用dll提高CPU利用率

编程入门 行业动态 更新时间:2024-10-26 00:24:15
本文介绍了通过引用dll提高CPU利用率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Hi,

我正在开发一个旧版Winforms应用程序,该应用程序在其上包含许多用户控件 嵌入在WinCE 6.0 OS中的.NET 2.0 Compact Framework.作为代码的一部分 重构中,我添加了一个名为Utilities的dll,并根据需要引用了该dll, 主应用程序和用户控件.在Utilities.dll中,我添加了一个静态类 包含一个可容纳2个整数(一个长整数和一个布尔值)的结构. 结构用于保存实时数据包信息.实时 数据被广泛用于在图形上的处绘制各种图形 每隔50毫秒的时间间隔.

I am working on a legacy Winforms application that includes many user controls on .NET 2.0 Compact Framework embedded in WinCE 6.0 OS. As part of code refactoring, I added a dll named Utilities and reference the dll as needed by the main app and user controls. Within the Utilities.dll I added a static class containing a structure that holds 2 integers, one long and one boolean. The structure is used to hold the realtime data packet information. The realtime data is used extensively for drawing various graphs on the Graphics at an interval of every 50ms.

通过添加实用程序dll,我发现CPU的使用量有所增加 利用率约8%.谁能告诉我为什么CPU数量增加了吗? 仅在.dll中添加结构并引用它的用法.在内 构建项目属性我已经检查了优化代码"选项.有没有 其他需要完成的相关项目设置?

With the addition of the Utilities dll I am seeing an increase in the CPU Utilization ~8%. Can anyone please let know why there is an increase in CPU Usage with just adding a structure in a .dll and referencing it. Within the Build project properties I have checked the Optimize code option. Are there any other relevant project settings that need to be done?

谢谢,

Chethana

推荐答案

CPU利用率的提高与仅引用DLL无关,而与如何引用DLL有关.正在使用其中的静态类!

The increase in CPU utilitisation is not going to be anything to do with just referencing the DLL, but with how the static class within it is being used!

即用数据包信息更新此结构的代码和/或每50毫秒更新图形的代码(听起来像是 非常很短的时间间隔(用于更新GUI)将是造成这种情况的原因.

i.e. the code that updates this structure with packet information and/or the code that updates the graphs every 50ms (which sounds like a very short time interval for updating a GUI) is going to be the cause of this.

您可能需要更多地跟踪/分析该代码,并且如果可以缩小范围,则可能会发布一些代码示例.

You may need to trace/profile that code through a bit more and possibly post some code samples if you can narrow it down.

更多推荐

通过引用dll提高CPU利用率

本文发布于:2023-11-03 20:03:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555960.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:利用率   dll   CPU

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!