用PAPI测试高速缓存命中率和TLB缺失率
来源:互联网 发布:安卓换字体软件 编辑:程序博客网 时间:2024/05/17 20:29
我的两个猜测,不知是否准确,欢迎交流:
1、values中元素好像必须是64位的,FORTRAN中integer(kind=8)或integer(8).
2、一次只能添加两个event_code,多了无效.
program papitest implicit none#include "f90papi.h" integer, parameter::N = 5000 integer x(N,N),y(N,N),z(N,N) integer check,event_set,event_code integer i, j integer(kind=8) values(4) do j = 1, N do i = 1, N x(i,j) = i + j y(i,j) = i + 1 z(i,j) = 0 enddo enddo do i = 1, 4 values(i) = -1 enddo! print *, values ! initialize the PAPI library check = PAPI_VER_CURRENT call PAPIF_library_init(check) ! create the eventset event_set = PAPI_NULL call PAPIF_create_eventset(event_set, check) event_code = PAPI_L1_DCH ! Total L1 Data Cache hits call PAPIF_add_event(event_set, event_code, check) event_code = PAPI_L1_DCM ! Total L1 Data Cache misses call PAPIF_add_event(event_set, event_code, check)! event_code = PAPI_TLB_DM ! TLB misses! call PAPIF_add_event(event_set, event_code, check) ! start counting call PAPIF_start(event_set, check) do j = 1,N do i = 1,N z(i,j) = x(i,j)+y(i,j) end do end do ! stop counting call PAPIF_stop(event_set, values, check) print *,'L1 cache hits:',values(1) print *,'L1 cache misses:',values(2) print *,'L1 cache hit rates:', & values(1) *100 / (values(1) + values(2)) ! reset the PAPI counters call PAPIF_reset(event_set, check) call PAPIF_shutdown end
[root@c0106 simple]# gfortran hello.F -o hello -lpapi[root@c0106 simple]# ./hello L1 cache hits: 331640400 L1 cache misses: 4697189 L1 cache hit rates: 98[root@c0106 simple]#
- 用PAPI测试高速缓存命中率和TLB缺失率
- 处理器高速缓存和TLB控制
- 硬件高速缓存&TLB
- Linux内核-内存-硬件高速缓存和TLB原理
- TLB和CACHE
- TLB和cache
- TLB和Cache
- Linux kernel和TLB
- TLB和cache关系
- TLB和cache
- TLB和cache
- TLb和硬件Cache
- MMU和TLB
- MMU和TLB
- 加入COM的 .tlb 和 用ado方式连数据库
- 页高速缓存和页回写
- 页高速缓存和页回写
- 页高速缓存和页回写
- my sql常用命令
- DFT的相量理解
- PHP编程之CSS(常见属性及值)
- linux知识宝库
- 收获的七月
- 用PAPI测试高速缓存命中率和TLB缺失率
- VC++2008如何用tab控件实现属性页
- SSH 简单实例图
- js 导出数据到excel
- 最近项目开发中的JS问题
- OSWorkflow灵活的工作流引擎 .
- 高效JavaScript学习(1)--- Script 的加载和执行
- C#中Split用法
- 高效JavaScript学习(2)--- DOM编程