Skip to contentSkip to conversation

Issues on prefetch function

DISCUSSION Jim Jia 1 participant 1 message Sep 29, 2013

lore
Share & tools
lore

Jim Jia

author
#0 lore raw

Hello, everyone
I'm doing an experiment to test the performance of rte_prefetch0. I find the speed of that function is quit slow. When executing the following code, tit will take about 8,000,000 cycles (about 45 cycles each loop ). What's wrong with it?

Thanks in advance.

struct A
{
char a[64];
};

struct A foo[180000];

int
main ()
{
int i, j;

long long a = rte_rdtsc ();
for (j = 0; j < 180000; j++)

    {
      rte_prefetcht0 (&foo[j]);
    }

long long b = rte_rdtsc ();
printf ("%lld\n", b - a);
return 0;
}