如何在Android上使用startMethodTracing的API? [英] How to use startMethodTracing APIs on Android?

查看:1739
本文介绍了如何在Android上使用startMethodTracing的API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始工作的一个应用程序,它具有Java和 本地组件。我想生成两个跟踪信息 使用组件 Debug.startMethodTracing(MyApp的) Debug.startNativeTracing()交替进行。但是,这两个意外行为。

I have recently started working on an app which has both Java and native components. I am trying to generate trace information for both components using Debug.startMethodTracing("myapp") and Debug.startNativeTracing() alternately. However, both are behaving unexpectedly.

当我使用 Debug.startMethodTracing(MyApp的),我可以看到一个文件 /sdcard/myapp.trace 被创建,但它始终是空的,不管多久,我跑我的应用程序。当我使用 Debug.startNativeTracing()并用 -trace&LT启动模拟器; tracename> 开关,我看到一个消息,说的跟踪开始的,但是当我尝试运行我的应用程序中, 仿真器崩溃。

When I use Debug.startMethodTracing("myapp"), I can see a file /sdcard/myapp.trace being created but it is always empty no matter how long I run my app. When I use Debug.startNativeTracing() and start the emulator with the -trace <tracename> switch, I see a message saying "Trace started", but when I try to run my app, the emulator crashes.

我在这里丢失了一些东西明显?如何调试这个问题?

Am I missing something obvious here? How do I debug this problem?

推荐答案

当我有这种情况发生对我来说,那是因为我有不匹配的启动/停止对。例如,如果你开始的方法跟踪,但从来没有停止,我认为Android根本不会写入缓冲的跟踪信息到一个文件。同样的,如果你有一个额外停在中间,或从未启动,等等,你不会得到预期的结果。

When I've had that happen to me, it's because I've had mismatched start/stop pairs. For example, if you start method tracing but never stop, I think Android simply never writes the buffered trace information out to a file. Similarly if you have an extra stop in the middle, or never start, etc, you're not going to get the desired results.

除了这些方法跟踪一直对我很好。

Other than that method tracing has worked fine for me.

本机跟踪,在另一方面,似乎不支持(仍然),因为我得到的Qemu一丝不支持的文件呢。一个错误,当我尝试加载本地跟踪结果到traceview。 (在从谷歌有何评论?)

Native tracing, on the other hand, appears to not be supported (still), since I get an error "Qemu trace files not supported yet" when I try to load the native trace results into traceview. (Any comment on that from Google?)

  • 克里斯

这篇关于如何在Android上使用startMethodTracing的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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