简体   繁体   English

将adb登录到windows cygwin中的文件

[英]log adb top to file in windows cygwin

Trying to log cpu usage (to file) of my app under windows. 试图在Windows下记录我的应用程序的CPU使用情况(到文件)。

First I tried this usning cmd 首先,我尝试了这个usning cmd

adb shell top | grep com.myapp > log.log

Which gives "grep is not recognized as an internal or external command, operable program or batch file.". 这使“grep不被识别为内部或外部命令,可操作程序或批处理文件”。 I guess windows doesn't any grep command? 我猜Windows没有任何grep命令?

Then I tried the same command usning cygwin terminal. 然后我尝试了使用cygwin终端的相同命令。 This resulted in an empty logfile . 这导致了一个空的日志文件 So I ran the same command but without redirecting the output 所以我运行相同的命令,但没有重定向输出

adb shell top | grep com.myapp

This returned the expected output . 返回了预期的输出 I've also tried redirecting stderr with "2>&1". 我也尝试用“2>&1”重定向stderr。 Didn't work. 没工作。

What am I doing wrong? 我究竟做错了什么?

I have got the same problem and --line-buffered solved it. 我有同样的问题,并且--line-buffered解决了它。

For example 例如

adb shell top | grep --line-buffered com.myapp > log.log

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

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