如何在flex / actionscript 3中找到对象的创建位置?

时间:2021-11-15 23:57:13

In my project I have noticed 20-40% CPU time when my app is idle.
In debugger when I pause I always land on a flex.utils.Timer/tick.
This timer has 30ms delay between "ticks"

在我的项目中,当我的应用程序空闲时,我注意到了20-40%的CPU时间。在调试器中,当我暂停时,我总是落在flex.utils.Timer / tick上。此计时器在“滴答”之间有30ms的延迟

I didn't create that Timer... so this is problably a component I have added

我没有创建那个Timer ...所以这可能是我添加的一个组件

Unfortunately it will be difficult to remove all compenents until if find the "one" ..
Yes I should have notice the CPU usage sooner !
and yes I will do that if I don't find another solution

不幸的是,除非找到“一个”,否则很难删除所有的竞争对手。是的我应该早点注意CPU的使用情况!是的,如果我找不到另一个解决方案,我会这样做

I am of course using some components without having their sources...

我当然使用一些组件而没有他们的来源......

My questions :
* How can I find the guilty component ?
* I tried to find it using Kap Inspector without success ...any tips for Kap inspector ?
* Is there another great tool to track object creation ?

我的问题:*我怎样才能找到有罪的成分? *我试图使用Kap Inspector找到它但没有成功... Kap检查员的任何提示? *是否还有另一个跟踪对象创建的好工具?

Thanks for your help

谢谢你的帮助

2 个解决方案

#1


When you set your breakpoint, in the Flex Debugger perspective, find the Variables tab/view. From there, with your breakpoint set, you should be able to see all of the variables currently in local scope (local to the timer-tick event handler, that is). The event variable will contain information about the timer itself -- e.g., in event.target -- and the this variable will tell you where the timer handler is defined.

设置断点时,在Flex Debugger透视图中,找到“变量”选项卡/视图。从那里,通过设置断点,您应该能够看到当前在本地范围内的所有变量(timer-tick事件处理程序的本地变量,即)。事件变量将包含有关计时器本身的信息 - 例如,在event.target中 - 此变量将告诉您定义计时器处理程序的位置。

From there, you might be able to walk back up the stack trace, using the Debug tab/view (with your breakpoint still set), to get a sense of where the Timer object might've been instantiated. If that doesn't work, you can download a trial of Flex Builder Professional here:

从那里,您可以使用“调试”选项卡/视图(仍设置断点)向后移动堆栈跟踪,以了解Timer对象可能已实例化的位置。如果这不起作用,您可以在此处下载Flex Builder Professional的试用版:

http://www.adobe.com/cfusion/entitlement/index.cfm?e=flexbuilder3

... and give the built-in profiler a try. Hope that helps point you in a helpful direction!

...并尝试使用内置的分析器。希望这有助于为您指明一个有用的方向!

#2


No idea about Flex, but for your CPU problems, check this out:

不知道Flex,但是对于你的CPU问题,请查看:

http://www.gskinner.com/blog/archives/2009/05/idle_cpu_usage.html

#1


When you set your breakpoint, in the Flex Debugger perspective, find the Variables tab/view. From there, with your breakpoint set, you should be able to see all of the variables currently in local scope (local to the timer-tick event handler, that is). The event variable will contain information about the timer itself -- e.g., in event.target -- and the this variable will tell you where the timer handler is defined.

设置断点时,在Flex Debugger透视图中,找到“变量”选项卡/视图。从那里,通过设置断点,您应该能够看到当前在本地范围内的所有变量(timer-tick事件处理程序的本地变量,即)。事件变量将包含有关计时器本身的信息 - 例如,在event.target中 - 此变量将告诉您定义计时器处理程序的位置。

From there, you might be able to walk back up the stack trace, using the Debug tab/view (with your breakpoint still set), to get a sense of where the Timer object might've been instantiated. If that doesn't work, you can download a trial of Flex Builder Professional here:

从那里,您可以使用“调试”选项卡/视图(仍设置断点)向后移动堆栈跟踪,以了解Timer对象可能已实例化的位置。如果这不起作用,您可以在此处下载Flex Builder Professional的试用版:

http://www.adobe.com/cfusion/entitlement/index.cfm?e=flexbuilder3

... and give the built-in profiler a try. Hope that helps point you in a helpful direction!

...并尝试使用内置的分析器。希望这有助于为您指明一个有用的方向!

#2


No idea about Flex, but for your CPU problems, check this out:

不知道Flex,但是对于你的CPU问题,请查看:

http://www.gskinner.com/blog/archives/2009/05/idle_cpu_usage.html