bazel 运行 目标的默认输出目录 - 查找 valgrind callgrind.out 文件
Default output directory of bazel run targets - finding valgrind callgrind.out file
当使用 'bazel run' 命令构建和执行目标时,参数“--run_under=”可用于在执行前添加 valgrind。 Valgrind 通常在目标目录中输出其结果文件,但是当运行 bazel 运行 时,输出文件无处可寻。
示例:
bazel run //path/to/package:target_name --copt="-g" --run_under='valgrind --tool=callgrind'
将 运行 在我的目标上调用 grind:
INFO: Build completed successfully, 1 total action
INFO: Running command line: /bin/bash -c 'valgrind --tool=callgrind /home/user/.cache/bazel/_bazel_user/8d1c200e573b8da3ee18c97f4656aca6/execroot/workspace/bazel-out/k8-opt/bin/path/to/package/s
INFO: Build completed successfully, 1 total action
==15166== Callgrind, a call-graph generating cache profiler
==15166== Copyright (C) 2002-2017, and GNU GPL'd, by Josef Weidendorfer et al.
==15166== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==15166== Command: /home/user/.cache/bazel/_bazel_user/8d1c200e573b8da3ee18c97f4656aca6/execroot/workspace/bazel-out/k8-opt/bin/path/to/package/target_name
... (further output omitted) ...
通常文件'callgrind.out'会写入当前目录,但我找不到它。
您上面给出的输出似乎不完整。 Callgrind 输出因捕获的事件而终止。
在任何情况下,您都可以使用以下选项控制 callgrind 在何处创建结果文件:
--callgrind-out-file=<f> Output file name [callgrind.out.%p]
给定的文件名可以以目录名开头。如果将启动多个进程,请不要忘记使用 %p(并且在这种情况下使用 --trace-children=yes)。
当使用 'bazel run' 命令构建和执行目标时,参数“--run_under=”可用于在执行前添加 valgrind。 Valgrind 通常在目标目录中输出其结果文件,但是当运行 bazel 运行 时,输出文件无处可寻。
示例:
bazel run //path/to/package:target_name --copt="-g" --run_under='valgrind --tool=callgrind'
将 运行 在我的目标上调用 grind:
INFO: Build completed successfully, 1 total action
INFO: Running command line: /bin/bash -c 'valgrind --tool=callgrind /home/user/.cache/bazel/_bazel_user/8d1c200e573b8da3ee18c97f4656aca6/execroot/workspace/bazel-out/k8-opt/bin/path/to/package/s
INFO: Build completed successfully, 1 total action
==15166== Callgrind, a call-graph generating cache profiler
==15166== Copyright (C) 2002-2017, and GNU GPL'd, by Josef Weidendorfer et al.
==15166== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==15166== Command: /home/user/.cache/bazel/_bazel_user/8d1c200e573b8da3ee18c97f4656aca6/execroot/workspace/bazel-out/k8-opt/bin/path/to/package/target_name
... (further output omitted) ...
通常文件'callgrind.out'会写入当前目录,但我找不到它。
您上面给出的输出似乎不完整。 Callgrind 输出因捕获的事件而终止。
在任何情况下,您都可以使用以下选项控制 callgrind 在何处创建结果文件:
--callgrind-out-file=<f> Output file name [callgrind.out.%p]
给定的文件名可以以目录名开头。如果将启动多个进程,请不要忘记使用 %p(并且在这种情况下使用 --trace-children=yes)。