简体   繁体   English

Time Profiler-等待应用启动

[英]Time Profiler - Wait for app launch

When launching my app from a custom URL scheme, when app is not backgrounded, the launch sequence is taking longer then I would like. 从自定义URL方案启动我的应用程序时,如果应用程序未在后台运行,则启动顺序花费的时间比我想要的时间长。 I want to use time profiler to see what methods are taking so long. 我想使用时间分析器查看花费了这么长时间的方法。 I know on run there is an option for "Wait for App Launch" so I can launch it using the URL, but I don't see that under the profiling scheme. 我知道运行时有一个“等待应用启动”选项,因此我可以使用URL启动它,但是在配置方案下我看不到它。 Does anyone know a way that I can launch the app fresh, using the URL, and have time profiler running on launch? 有谁知道我可以使用URL重新启动应用程序并在启动时运行时间分析器的方法吗?

"see what methods are taking so long" “看看花了这么长时间的方法”

Do you suppose some method (or a few) are sopping up a lot of CPU time in themselves or by calling other methods that do? 您是否认为某个方法(或几个方法)本身在占用大量CPU时间,或者通过调用其他方法呢? If so, it will be easy to fix, but it's Not Likely. 如果是这样,将很容易修复,但不太可能。

More likely the time is spent in I/O of one sort or another, and you need to figure out why , not where . 时间更有可能花费在一种或另一种I / O上,您需要找出原因 ,而不是位置

If you're able to start it under a debugger (say by using @ChrisTruman's recommendation), then all you need to do is interrupt it with Ctrl-C, Ctrl-Break, Escape, or whatever key combination interrupts it. 如果您能够在调试器下启动它(例如,使用@ChrisTruman的建议),那么您所需要做的就是用Ctrl-C,Ctrl-Break,Escape或其他任何组合键中断它。 Do this during the time when, subjectively, it is slow. 在主观上比较慢的时间内执行此操作。

Let's suppose the startup is taking three times longer than you think it should. 假设启动时间比您想象的要长三倍。 If that's so, that means two thirds of the time is spent doing the unnecessary I/O or whatever it is. 如果是这样,则意味着花费了三分之二的时间来执行不必要的I / O或任何其他操作。 That means each time you interrupt it, the probability is 2/3 that you will catch it in the act of doing whatever causes the slowness. 这意味着每次您中断它时,您在做任何会导致速度变慢的动作时将其捕获的概率为2/3。 So interrupt it a few times, and each time just read the stack, look at variables, etc. You will see why it's being slow. 因此中断了几次,每次只读过栈,看看变量等你会看到为什么它是缓慢的。 Don't even look for where - that will appear by itself. 甚至不要寻找在哪里 -它会自己出现。

That's the basic idea behind this technique . 这是该技术背后的基本思想。

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

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