1

我需要编写一个 C 程序(用于确定缓存大小的学校作业)。我已将其用作clock()获取时间信息的一种方式。但被告知这可能会导致结果不准确。

所以我正在考虑使用最近实验室中引入的其他库 perf 或 papi 来记录性能。但我们使用它们的方式是通过命令行:

perf stat ./test 

我认为可以在应用程序中使用 perf 吗?我是 C 新手,更习惯于 Python/JS/Java 等高级语言。所以我想我需要创建一个 make 文件,包含库等。还有什么功能?

我看到http://www.rzg.mpg.de/computing/hardware/BGP/perf.html

libperf.a
    perf library for MPI programs.
libperfhpm.a
    Use perf instrumentation to call hpmtoolkit.
libperfdummy.a
    Provides dummies for the perf instrumentation. You can link against this library to avoid the perf overhead in production runs.

我用哪一个?它不是 MPI 程序。那我该如何实际使用呢?我正在使用 C 和 gcc。这看起来像编译但是......什么mpixlf90

mpixlf90_r -o tperf tperf.f -L/usr/local/lib -lperf
4

1 回答 1

1

有很多 C 和 C++ 程序的性能分析工具(提供有关运行时间、内存消耗的信息),其中一些是,

  1. 瓦尔格林德

  2. 谷歌性能工具

希望这就是你要找的!

于 2012-09-27T06:52:47.673 回答