2010/5/3 Juan Ángel Lorenzo <jalmailingli...@gmail.com>: > Hi all, > > I'm using one of the perfmon's example codes, mont_dear.c, to test the > accessed memory positions on a Itanium2 Montvale. Basically, what I do is to > modify the do_test() function to store in a file the accessed memory > positions. Later, I compare them with the sampled addresses given by the > Event Address Registers (EARs). Surprisingly, all the sampled addresses are > always lower than the ones accessed in the do_test() function. Am I doing > something wrong? This is the modified function I use: > You have modified the program heavily. It is likely now your cache misses are coming from libc and fprintf() in particular. You don't need to save the addresses in a file to compare them. All you need to do is print the boundaries of the array. I would even move the allocation elsewhere so it would not interfere. Also be careful with compiler optimizations, the code is very simple and may be optimized away. I would do something slightly more complicated in the test loop, at least make sure the data is used after the loop is finished.
> long do_test(unsigned long size) > { > int i, sum = 0; > int *array; > int *addr; > > FILE *fd; > fd = fopen("addresses.dat","w"); > > printf("array size %.1fKB\n", (size*sizeof(int))/1024.0); > array = (int *)malloc(size * sizeof(int)); > > if (array == NULL ) { > printf("line = %d No memory available!\n", __LINE__); > exit(1); > } > > for(i=0; i<size; i++) { > array[i]=1; > addr = array+i; > fprintf(fd,"%p array[%d]: %d\n",addr,i,array[i]); > > } > > fclose(fd); > return sum; > } > > > Thanks in advance for all the comments you can provide, > Juan > > > ------------------------------------------------------------------------------ > > _______________________________________________ > perfmon2-devel mailing list > perfmon2-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/perfmon2-devel > > ------------------------------------------------------------------------------ _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel