简体   繁体   English

分析ActionScript-3代码

[英]Profiling ActionScript-3 Code

Is there any way or tool available that can profile AS3 code without using Flex? 有没有可用的方法或工具可以在不使用Flex的情况下分析AS3代码?

How can I profile existing project written in Flash CS3 and AS3? 如何描述用Flash CS3和AS3编写的现有项目?

Adobe have recently released a new profiling tool for Flash called Adobe Scout: Adobe最近发布了一种名为Flash的新的Flash分析工具,名为Adobe Scout:

http://gaming.adobe.com/technologies/scout/ http://gaming.adobe.com/technologies/scout/

It's a standalone tool (you don't need Flex/Flash Builder), and it works with existing content. 这是一个独立的工具(您不需要Flex / Flash Builder),并且可以与现有内容一起使用。 You can profile your ActionScript 3 execution, and it also shows you a lot of detail about what Flash Player is doing behind the scenes. 您可以分析ActionScript 3的执行情况,并且还向您显示有关Flash Player在幕后所做的很多详细信息。 Note that for existing content, you need to "opt-in" your SWF to get data about your ActionScript functions - just run this Python script on your SWF before profiling. 请注意,对于现有内容,您需要“选择加入” SWF以获取有关ActionScript函数的数据-只需在分析前在SWF上运行此Python脚本即可

Scout is free for a trial period - you just need to register for a free Creative Cloud account. 侦察员在试用期内是免费的-您只需要注册一个免费的Creative Cloud帐户即可。 After that, there will continue to be a free basic version, with the full version available as part of a paid Creative Cloud account. 之后,将继续有一个免费的基本版本,而完整版本将作为付费Creative Cloud帐户的一部分提供。

Flex is actually a framework. Flex实际上是一个框架。 I think what you mean is Flex Builder, which is an IDE containing a built-in profiler. 我认为您的意思是Flex Builder,它是一个包含内置分析器的IDE。

It also depends on what information you want want to profile. 这也取决于您要分析哪些信息。 Memory Usage, CPU performance, the number of times a particular function is called ... these are all different metrics. 内存使用率,CPU性能,调用特定功能的次数...这些都是不同的指标。

For memory you can use System.totalMemory . 对于内存,您可以使用System.totalMemory CPU usage is not really as important for Flash as framerate (which is an indirect CPU usage metric). 对于Flash,CPU使用率实际上并不像帧率(帧率是间接的CPU使用率指标)那么重要。 There are many ways to measure framerate but I usually search Google for a library and then use it. 有许多方法可以测量帧率,但是我通常会在Google上搜索一个库,然后再使用它。 Something like Hi-ReS! 高分辨率! Stats or AS3 SWF Profiler . StatsAS3 SWF Profiler There are thousands of them around. 他们周围有成千上万。

As for other metrics ... well you have to be specific. 至于其他指标...那么您必须具体。 If you want to find out things like "Which function is taking the longest amount of time to execute?" 如果您想查找诸如“哪个功能需要花费最长时间执行?”之类的内容。 then you might just have to get your hands dirty and put Timers in your code ... IOW instrument your code by hand. 那么您可能只需要动手,然后将Timers放入代码中即可。IOW手动检测代码。

I would recommend flash guru Grant Skinner's performance profiler 我会推荐Flash专家Grant Skinner的性能分析器

"Point it at an instance of a class, and it will test all the public methods on it. Or, use properties or parameters to formalize the tests with names, descriptions, and specific method lists. “将其指向一个类的实例,它将测试该类上的所有公共方法。或者,使用属性或参数通过名称,描述和特定的方法列表来对测试进行形式化。

You can even use PerformanceTest to test the render time for complex vectors or filters. 您甚至可以使用PerformanceTest来测试复杂矢量或滤镜的渲染时间。

You can also easily customize how it logs the results of tests to output them differently, save them to a file, or graph the results. 您还可以轻松地自定义其记录测试结果的方式,以不同方式输出测试结果,将测试结果保存到文件中或以图形方式显示结果。

http://www.gskinner.com/blog/archives/2009/04/as3_performance.html http://www.gskinner.com/blog/archives/2009/04/as3_performance.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM