如何在 Xcode 中启用构建计时?
我想知道我的项目的构建需要多长时间,例如通过在构建窗格中显示它。 Xcode 中是否有此选项?
谢谢。
I'd like to know how long my project's builds take, for example by displaying it in the build pane.
Is this option available somewhere in Xcode?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在终端中输入以下内容:
构建后,持续时间将显示在活动查看器中,旁边会显示“成功”消息。
如果您正在运行该应用程序,则在您可以看到持续时间之前,状态将替换为正在运行的状态。
这取代了旧版本 Xcode 中使用的条目:
在输入此命令之前,可能需要关闭 Xcode。 持续时间应显示在项目窗口的左下角。
来自 Xcode 开发人员的评论:“与所有未记录的用户默认值一样,这是不受支持的,假设(但不保证)准确,并且不保证在未来版本中有效。”
Type this in the terminal:
Duration appears in the activity viewer after a build, alongside the "Succeeded" message.
If you are running the app, the status will be replaced by the running status before you can see the duration.
This replaces the entry that was used in older versions of Xcode:
Xcode may need to be closed before you enter this command. Durations should appear at the bottom left of the project window.
Comment from an Xcode developer: "As with all undocumented user defaults, this is unsupported, assumed (but not guaranteed) accurate, and not assured to be effective in future versions."
在 Xcode 10 中,您现在可以使用其时序摘要功能查看构建时间的详细细分。
产品 -> 执行操作 -> 使用计时摘要构建
这将显示您的每个目标构建时间和总体项目构建时间。 您可以使用这些数据进行大量分析,构建时间将取决于您的硬件。 查看在 Xcode 中更快地构建如果您想了解更多信息,请参加 WWDC 2018。
但是,Xcode 默认情况下会跟踪您的所有构建,您可以通过转到报告导航器来检查它们的时间和日志。
在报表导航器中构建日志
In Xcode 10, you are now able to see a great breakdown of the build times using their Timing Summary feature.
Product->Perform Action->Build With Timing Summary
This will show each of your target build times and the overall project build time. You can do a lot of analysis using this data and build times will depend on your hardware. Check out Building Faster in Xcode from WWDC 2018 if you care to learn more.
However, Xcode keeps track of all your builds by default and you can examine their times and logs by going to their Report Navigator.
Build Logs within Report Navigator
不,但您可以使用命令行。 cd 到您的项目目录并输入
no, but you could use the command line. cd to your project directory and type
在 Xcode 10 之后
-showBuildTimingSummary
查看构建时间摘要。Product->Perform Action->Build With Timing Summary
。 并在 Xcode 构建日志中查看构建时间摘要。After Xcode 10
-showBuildTimingSummary
to see the build time summary.Product->Perform Action->Build With Timing Summary
. And see building time summary in the Xcode building log.我用
构建阶段
中的运行脚本
解决了这个问题,我在构建的起点添加了一个运行脚本:
echo $(date +%s) > > ../build_start_time
和最后一个:
现在我可以在构建日志中看到时间 -> 所有消息
I solved it with
Run Script
s inBuild Phases
I have added one Run Script at start point of the build:
echo $(date +%s) > ../build_start_time
and one at the end:
Now i can see the time in Build Log -> All Messages