与Make Command的汇编的指标

发布于 2025-02-12 23:05:08 字数 254 浏览 0 评论 0原文

我使用cmake生成一些将使用Linux上G ++编译多个目标的makefiles。 我想创建一些有关汇编的指标,例如:

  • 构建每个目标
  • G ++警告和错误

所需的时间,我迄今为止提出的唯一解决方案是重定向整个文件的制造和解析,但这似乎真的很重。我无法使用G ++标志-fdiagnostics-format = JSON功能,因为我无法升级到GCC-9。

有什么建议吗?非常感谢

I use CMake to generate some makefiles that will compile multiple targets using G++ on Linux.
I would like to create some metrics about the compilation such as :

  • Time needed to build each target
  • G++ warnings and errors

The only solution I came up with so far is to redirect the output of make and parse the whole file but this seems really heavy. I cannot use the G++ flag -fdiagnostics-format=json feature since I cannot upgrade to GCC-9.

Any suggestions? Thank you very much

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花落人断肠 2025-02-19 23:05:08

就时间而言,请考虑使用 ninja 而不是制造。当您构建时,它会产生一个名为$ {CMAKE_BINARY_DIR}/。NINJA_LOG的文件,该文件可以转换为与Chrome的兼容的格式,以:跟踪 flame图形格式。

这里有一个脚本可以在这里这样做: https://github.com/nico/nico/nico/ninjatracing

As far as timing is concerned, consider using Ninja instead of Make. When you build it produces a file called ${CMAKE_BINARY_DIR}/.ninja_log that can be converted to a format compatible with Chrome's about:tracing flame graph format.

There's a script for doing that here: https://github.com/nico/ninjatracing

池予 2025-02-19 23:05:08

您可以做的事情是将编译器设置为包装G ++功能并添加一些(类似于某些CCACHE集成的工作方式)的程序或外壳脚本:

# Makefile
CC := g++-with-metrics.sh
# g++-with-metric.sh

# 1. Start timer

# 2. Run command, save output (to variable or tmpfile)

# 3. Stop timer, log result

# 4. Parse output for warnings and errors, log result

Something you could do is set the compiler to be a program or shell script that wraps the G++ functionality and add some (similar to how some ccache integrations work):

# Makefile
CC := g++-with-metrics.sh
# g++-with-metric.sh

# 1. Start timer

# 2. Run command, save output (to variable or tmpfile)

# 3. Stop timer, log result

# 4. Parse output for warnings and errors, log result
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文