Prof 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
Prof 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
Prof 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 MIT
开发语言 C/C++
操作系统 Linux
软件类型 开源软件
开源组织
地区 不详
投 递 者 linuxhitlover
适用人群 未知
收录时间 2015-06-29

软件简介

Prof 是 Linux 的自容器 C/C++ 分析工具库。

Prof 提供一个快速的方法来度量 C/C++ 代码片段的性能事件 (CPU 时钟周期等等) 。

小示例:

#include "prof.h"int main()
{    PROF_START();    // slow code goes here...
   PROF_STDOUT();
}

自定义选项

#include <stdio.h>
#define PROF_USER_EVENTS_ONLY
#define PROF_EVENT_LIST \
    PROF_EVENT_CACHE(L1D, READ, MISS) \
    PROF_EVENT_CACHE(L1D, WRITE, MISS)
#include "prof.h"
int main()
{
    uint64_t faults[2] = { 0 };
    PROF_START();
    // slow code goes here...
    PROF_DO(faults[index] += counter);
    // fast or uninteresting code goes here...
    PROF_START();
    // slow code goes here...
    PROF_DO(faults[index] += counter);
    printf("Total L1 faults: R = %lu; W = %lu\n", faults[0], faults[1]);
}

安装

wget -q https://raw.githubusercontent.com/cyrus-and/prof/master/prof.h
展开阅读全文

代码

评论

点击引领话题📣 发布并加入讨论🔥
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
0 评论
4 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部