是achartengine准备实时图表? [英] Is achartengine ready for realtime graphing?

查看:153
本文介绍了是achartengine准备实时图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想绘制一些实时数据,实时在这里是指< 10毫秒的数据,最好尽可能低。我已经能够让机器人来获取和处理数据,这个​​速度快,但ACE只是看起来像它没有被设计时考虑了实时应用。最先出现的症状是垃圾收集踢像有没有明天,完全杀死的应用程序。我对可视化滑动窗口的方式数据,所以它不是像我期待高手实时几百点的千分之一的情节。 我已经看到了它,并在OnDraw中的XYChart肯定分配非常沉重的情况下,它看起来像它的方便,很可能使code更可读,但没有真正需要的。 这甚至可能比它曾经是那么它可能还没有被发现还没有恶化。我看到了漏洞修复的问题#225解决并发问题的变化:

I'm trying to graph some realtime data, "realtime" here means < 10msec data, ideally as low as possible. I've been able to get android to fetch and process data this fast but ACE just looks like it's not been designed with realtime use in mind. First symptoms are that garbage collector kicks in like there's no tomorrow and totally kills the app. I'm visualizing data on a "sliding window" fashion so it's not like I'm expecting ACE to plot in realtime hundreds of thousandths of points. I've taken a look at it and the onDraw for XYChart certainly allocates very heavily in cases where it looks like its convenient and probably makes the code much more readable but not really required. This might even be worse than it used to be so it might have not been noticed yet. I saw bugfix for issue #225 solved a concurrency problem changing:

返回mXY.subMap(启动,停止);

有:

返回新的TreeMap&LT;双人间,双人间及GT;(mXY.subMap(启动,停止));

这创造了巨大的分配(由原始子图虽然仍支持)时,它可能会更好排队,而OnDraw中是怎么回事更新和后来原子更新或东西处理他们这一行,以避免并发问题。

This creates huge allocations (still backed by the original subMap though) when it would probably be better to queue updates while onDraw is going on and process them later on atomic updates or something on that line to avoid concurrency issues.

实在可惜在这里是 ACE肯定是速度不够快,我需要的东西。它可以做什么,我需要对我的硬件完美,但因为它分配如此严重的重绘机器人去疯狂与GC。它很快开始,而GC运行,因此必须等待和我的应用程序开始看起来像一个超炫动画短片分配。

The real pity here is that ACE is certainly fast enough for what I need. It can do what I need on my HW perfectly but since it allocates so heavily on repaint Android goes crazy with GC. It soon starts allocating while GC is running so it has to wait and my app starts looking like a stop-motion movie.

真正的问题,虽然是:是否有合理的期望能够重新绘制4或6 linecharts(平板电脑应用程序)上实时(分200毫秒刷新速率)与ACE或者是根本就没有ppared的那种$ P $滥用? 如果答案是否定的。任何其他的选择还有你会推荐?

The real question though is: Is it reasonable to expect to be able to repaint 4 or 6 linecharts (tablet app) on realtime (sub 200ms refresh rate) with ACE or is it simply not prepared for that kind of abuse? If the answer is no. Any other options there you'd recommend?

修改20130109: 对于小型数据集版本471改进的东西还真不少。 2.000分/ 4图表/ 100毫秒刷新速率是可行的,光滑。日志仍然可以看到GC_CONCURRENT释放像疯了似的(约10 /秒),但没有WAIT_FOR_CONCURRENT_GC封杀这是展示塞子,使您的应用程序停止运动等。 在3.000分/ 1图/ 100毫秒,这显然不可以顺利。我们再次获得WAIT_FOR_CONCURRENT_GC封杀上的logcat和口吃的应用程序的雪崩。此外看起来我们没有一个速度问题,只有一个内存管理的问题。

EDIT 20130109: Revision 471 improves things quite a bit for small data sets. 2.000 points / 4 charts / 100 msec refresh rate is doable and smooth. Logs still see "GC_CONCURRENT freed" like crazy (around 10/sec) but no "WAIT_FOR_CONCURRENT_GC blocked" which are the show stoppers that make your app stop-motion like. At 3.000 points / 1 chart / 100 msec it's clearly not smooth. We get again the avalanche of "WAIT_FOR_CONCURRENT_GC blocked" on logcat and the stuttering app. Again it looks like we do not have a speed problem, only a memory management problem.

它可能看起来像我可能会问ACE做魔术,但我重构我所有的code到1KHz的检索和存储遥测数据后,打这堵墙。有一次,我终于看到了我的应用程序检索和存储所有的实时的,而不在所有触发GC我要图形的时候拉着我的头发与ACE:)

推荐答案

在优化一切在我的应用程序大的努力,我还是不能让它在我所理解的实时的情节。 图书馆是很大的,而且速度非常快,但在每一个OnDraw中不可避免地分配内存的方式触发垃圾收集的雪崩而碰撞与自己的分配,因此Android的冻结您的应用程序瞬间造成口吃这与实时图形完全不兼容。而口吃这里的范围可以从50-250ms(是毫秒),但是这足以杀死一个实时的应用程序。

After a big effort on optimizing everything else on my app I still can't make it plot in what I understand for "realtime". The library is great, and very fast but the way in which every onDraw allocates memory inevitably triggers an avalanche of garbage collection which collides with its own allocation and thus android freezes your app momentarily causing stutter which is totally incompatible with "realtime" graphing. The "stutter" here can range from 50-250ms (yes milliseconds) but that's enough to kill a realtime app.

AChartengine将允许你刚才只要创建动态的图形,你不需要他们是实时(10帧/秒,(小于100毫秒刷新率),或者你叫什么平稳 )。

AChartengine will allow you to create "dynamic" graphs just as long as you don't require them to be "realtime" (10 frames/sec, (<100ms refresh rate) or what you'd call "smooth").

如果有人需要对核心问题的详细信息在这里,或为什么我说,图书馆是速度不够快,但内存分配模式最终导致性能问题就来看看的谷歌I / O 2009 - 编写实时游戏为Android

If someone needs more information on the core problem here, or why I'm saying that the library is fast enough but memory allocation patterns end up causing performance problems take a look at Google I/O 2009 - Writing Real-Time Games for Android

这篇关于是achartengine准备实时图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆