Linux C++:如何分析因缓存未命中而浪费的时间? [英] Linux C++: how to profile time wasted due to cache misses?

查看:18
本文介绍了Linux C++:如何分析因缓存未命中而浪费的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用 gprof 来对我的代码进行基准测试.

I know that I can use gprof to benchmark my code.

但是,我遇到了这个问题——我有一个智能指针,它具有额外的间接级别(将其视为代理对象).

However, I have this problem -- I have a smart pointer that has an extra level of indirection (think of it as a proxy object).

因此,我有这个额外的层,它影响几乎所有的功能,并带有缓存.

As a result, I have this extra layer that effects pretty much all functions, and screws with caching.

有没有办法测量我的 CPU 由于缓存未命中而浪费的时间?

Is there a way to measure the time my CPU wastes due to cache misses?

推荐答案

你可以试试 cachegrind 是前端 kcachegrind.

You could try cachegrind and it's front-end kcachegrind.

这篇关于Linux C++:如何分析因缓存未命中而浪费的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆