Is it possible to profile CPU / memory inside an Adobe AIR application?

◇◆丶佛笑我妖孽 提交于 2019-12-07 13:04:33

问题


Couldn`t find any ActionScript native APIs even in the beta documentation, am I right supposing that this means the only way to measure CPU / memory consumption is by cooking up a custom native solution, hooking it up with AIR and making it work on each targeted platform?

Basically the aim is to be able to have this information available inside AIR and not having to use an external application for profiling, not even Flex / Flash builder.


Thanks for the helpful answers, System.totalMemory sneakily eluded me!

Seems for the CPU load the only solution will be some command line scraping using NativeProcess.


回答1:


you can measure the memory consumption like this:

System.totalMemory

if you google for "as3 fps" you will find a lot of sites discussing how to measure the actual framerate.

but i don't think you can find out the cpu consumption of your flash app without outside help.




回答2:


You might want to give this AIR based debugger a try, it's really pretty good:

http://www.monsterdebugger.com/




回答3:


Actually you can access the same API used by the Flex Builder profiler, if you don't want to pay for Flex Builder. It's not documented very well, so it would probably take a lot of work, but it's here for those that are interested:

flash.sampler package detail




回答4:


Alcon is another debugger which offers real-time memory profiling.




回答5:


I found an undocumented API flash.system.System.processCPUUsage():Number but when I use it it returns 0. I'm wondering if it's a release build only API?

It takes me a while to create a release build because I have debug versions installed in all the browsers. Yep, I don't know how to quickly test release builds in a release player. I'll try to report back when I have a release to test it in.

How to get CPU usage in flash?



来源:https://stackoverflow.com/questions/2539504/is-it-possible-to-profile-cpu-memory-inside-an-adobe-air-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!