|
From: Mandy M. <te...@ho...> - 2016-02-15 10:11:30
|
Hi ,
/*
gcc -o marti marti.c
valgrind --tool=cachegrind ./marti
valgrind --dsymutil=yes --tool=callgrind ./marti
*/
int main()
{
int x[5000][100];
int i = 0;
int j = 0;
for(i = 0; i <5000; ++i)
{
for (j = 0; j < 100; ++j)
{
x[i][j] = 2*x[i][j];
}
}
return 0;
}
/*
Ubuntu 12 in VMware player 12
for (j = 0; j < 100; ++j)
{
for(i = 0; i <5000; ++i)
{
x[i][j] = 2*x[i][j];
}
}
==4526== Cachegrind, a cache and branch-prediction profiler
==4526== Copyright (C) 2002-2011, and GNU GPL'd, by Nicholas Nethercote et al.
==4526== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==4526== Command: ./marti
==4526==
--4526-- warning: L3 cache found, using its data for the LL simulation.
==4526==
==4526== I refs: 6,113,976
==4526== I1 misses: 687
==4526== LLi misses: 682
==4526== I1 miss rate: 0.01%
==4526== LLi miss rate: 0.01%
==4526==
==4526== D refs: 4,053,131 (3,537,745 rd + 515,386 wr)
==4526== D1 misses: 501,148 ( 500,988 rd + 160 wr)
==4526== LLd misses: 32,197 ( 32,062 rd + 135 wr)
==4526== D1 miss rate: 12.3% ( 14.1% + 0.0% )
==4526== LLd miss rate: 0.7% ( 0.9% + 0.0% )
==4526==
==4526== LL refs: 501,835 ( 501,675 rd + 160 wr)
==4526== LL misses: 32,879 ( 32,744 rd + 135 wr)
==4526== LL miss rate: 0.3% ( 0.3% + 0.0% )
for(i = 0; i <5000; ++i)
{
for (j = 0; j < 100; ++j)
{
x[i][j] = 2*x[i][j];
}
}
==4539== Cachegrind, a cache and branch-prediction profiler
==4539== Copyright (C) 2002-2011, and GNU GPL'd, by Nicholas Nethercote et al.
==4539== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==4539== Command: ./marti
==4539==
--4539-- warning: L3 cache found, using its data for the LL simulation.
==4539==
==4539== I refs: 6,148,278
==4539== I1 misses: 687
==4539== LLi misses: 682
==4539== I1 miss rate: 0.01%
==4539== LLi miss rate: 0.01%
==4539==
==4539== D refs: 4,072,731 (3,552,445 rd + 520,286 wr)
==4539== D1 misses: 32,387 ( 32,238 rd + 149 wr)
==4539== LLd misses: 32,197 ( 32,062 rd + 135 wr)
==4539== D1 miss rate: 0.7% ( 0.9% + 0.0% )
==4539== LLd miss rate: 0.7% ( 0.9% + 0.0% )
==4539==
==4539== LL refs: 33,074 ( 32,925 rd + 149 wr)
==4539== LL misses: 32,879 ( 32,744 rd + 135 wr)
==4539== LL miss rate: 0.3% ( 0.3% + 0.0% )
*/
Regards,
Martin
|