Enable Debug flags in memory alloc and init functions.

This commit is contained in:
Xianyi Zhang 2011-02-26 11:51:39 +08:00
parent 1b97ec1a7c
commit f7a5e049e2
2 changed files with 20 additions and 7 deletions

View File

@ -92,7 +92,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define SHARE_NAME "/sys/devices/system/cpu/cpu%d/cache/index%d/shared_cpu_map" #define SHARE_NAME "/sys/devices/system/cpu/cpu%d/cache/index%d/shared_cpu_map"
#define NODE_DIR "/sys/devices/system/node" #define NODE_DIR "/sys/devices/system/node"
#undef DEBUG //#undef DEBUG
/* Private variables */ /* Private variables */
typedef struct { typedef struct {

View File

@ -68,9 +68,10 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* or implied, of The University of Texas at Austin. */ /* or implied, of The University of Texas at Austin. */
/*********************************************************************/ /*********************************************************************/
#undef DEBUG //#undef DEBUG
#include "common.h" #include "common.h"
#include <errno.h>
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
#define ALLOC_WINDOWS #define ALLOC_WINDOWS
@ -388,8 +389,20 @@ static void *alloc_mmap(void *address){
if (map_address != (void *)-1) { if (map_address != (void *)-1) {
#ifdef OS_LINUX #ifdef OS_LINUX
#ifdef DEBUG
int ret;
ret=my_mbind(map_address, BUFFER_SIZE * SCALING, MPOL_PREFERRED, NULL, 0, 0);
if(ret==-1){
int errsv=errno;
perror("alloc_mmap:");
printf("error code=%d,\tmap_address=%lx\n",errsv,map_address);
}
#else
my_mbind(map_address, BUFFER_SIZE * SCALING, MPOL_PREFERRED, NULL, 0, 0); my_mbind(map_address, BUFFER_SIZE * SCALING, MPOL_PREFERRED, NULL, 0, 0);
#endif #endif
#endif
allocsize = DGEMM_P * DGEMM_Q * sizeof(double); allocsize = DGEMM_P * DGEMM_Q * sizeof(double);
@ -986,7 +999,7 @@ void *blas_memory_alloc(int procpos){
memory[position].addr = map_address; memory[position].addr = map_address;
#ifdef DEBUG #ifdef DEBUG
printf(" Mapping Succeeded. %p(%d)\n", (void *)alloc_area[position], position); printf(" Mapping Succeeded. %p(%d)\n", (void *)memory[position].addr, position);
#endif #endif
} }
@ -1017,7 +1030,7 @@ void *blas_memory_alloc(int procpos){
#ifdef DEBUG #ifdef DEBUG
printf("Mapped : %p %3d\n\n", printf("Mapped : %p %3d\n\n",
(void *)alloc_area[position], position); (void *)memory[position].addr, position);
#endif #endif
return (void *)memory[position].addr; return (void *)memory[position].addr;
@ -1060,7 +1073,7 @@ void blas_memory_free(void *free_area){
#ifdef DEBUG #ifdef DEBUG
for (position = 0; position < NUM_BUFFERS; position++) for (position = 0; position < NUM_BUFFERS; position++)
printf("%4ld %p : %d\n", position, alloc_area[position], alloc_used[position]); printf("%4ld %p : %d\n", position, memory[position].addr, memory[position].used);
#endif #endif
return; return;