[Assorted-commits] SF.net SVN: assorted: [404] numa-bench/trunk/src/malloc.cc
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-13 08:14:07
|
Revision: 404 http://assorted.svn.sourceforge.net/assorted/?rev=404&view=rev Author: yangzhang Date: 2008-02-13 00:14:10 -0800 (Wed, 13 Feb 2008) Log Message: ----------- added config logging; added result (sum) printing Modified Paths: -------------- numa-bench/trunk/src/malloc.cc Modified: numa-bench/trunk/src/malloc.cc =================================================================== --- numa-bench/trunk/src/malloc.cc 2008-02-13 07:59:10 UTC (rev 403) +++ numa-bench/trunk/src/malloc.cc 2008-02-13 08:14:10 UTC (rev 404) @@ -98,6 +98,7 @@ pin_thread(cpu); } + int sum = 0; if (config.write) { // Write to the region. if (config.shuffle) { @@ -107,20 +108,19 @@ // NOTE: Using r as the index assumes that rand generates large-enough // values. int r = rand(); - p[r % count] += r; + sum += p[r % count] += r; } } } else { // Sequential scan through the memory region. for (unsigned int c = 0; c < config.nreps; c++) { for (size_t i = 0; i < count; i++) { - p[i] += rand(); + sum += p[i] += rand(); } } } } else { // Only read from the region. - int sum = 0; if (config.shuffle) { // Random access into the memory region. for (unsigned int c = 0; c < config.nreps; c++) { @@ -138,12 +138,12 @@ } } } - cout << sum << endl; } - // Print the elapsed time. + // Print the elapsed time and "result". cout << label << cpu; t.print(); + cout << "result: " << sum; if (config.local) free(p); @@ -174,6 +174,16 @@ atoi(argv[8]) }; + cout << "config:" + << " ncores " << config.ncores + << " size " << config.size + << " nreps " << config.nreps + << " shuffle " << config.shuffle + << " par " << config.par + << " pin " << config.pin + << " local " << config.local + << " write " << config.write << endl; + checkmsg(RAND_MAX > config.size / sizeof(int), "PRNG range not large enough"); void *p = malloc(config.size); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |