int main(void) { volatile unsigned long long stack = 0; /* must be first line */ unsigned long long i, act_address, old_address, act_access, old_access; max_address = 1ULL << 32; page_size = getpagesize(); max_page = max_address / page_size; heap = malloc(sizeof(char)*MEMSIZE); act_access = 0; printf("int \t \t \t \t \t %lu\n", sizeof(int)); printf("void* \t \t \t \t \t %lu\n", sizeof(void*)); printf("max_address \t \t \t \t %llx\n", max_address); printf("max_page \t \t \t \t %llu\n", max_page); printf("page_size \t \t \t \t %llu\n", page_size); printf("-----------------------------------------------------------------"); printf("\n"); for (i=0; i<max_page; ++i) { old_access = act_access; act_address = i*page_size; act_access = memprobe((void*)act_address); /* access code changed from 0 to 1 or from 1 to 2 */ if (act_access != old_access && act_access != 0) { access_output(act_access,old_address,act_address,((void*)&stack)); old_address = act_address; } } printf("-----------------------------------------------------------------"); printf("\n"); /* char *string = 'Hello World'; */ access_output(memprobe((void*)&string1), \ (long long)&string1, \ (long long)(&string1+9), \ ((void*)&stack)); /* char string[] = 'Hello World'; */ access_output(memprobe((void*)&string2), \ (long long)&string2, \ (long long)(&string2+9), \ ((void*)&stack)); free(heap); return 0; }
int main(void) { unsigned int i, act_access, old_access, old_address, \ act_address, page_size, max_page; unsigned long long max_address; max_address = (1ULL << 32); /* 1 << 32 would cause integer overflow */ page_size = getpagesize(); max_page = max_address / page_size; printf("int \t \t \t \t %lu\n", sizeof(int)); printf("void* \t \t \t \t %lu\n", sizeof(void*)); printf("max_address \t \t \t %llu\n", max_address); printf("max_page \t \t \t %u\n", max_page); printf("page_size \t \t \t %d\n", page_size); printf("-------------------------------------------\n"); for (i=0; i<max_page; ++i) { old_access = act_access; act_address = i*page_size; act_access = memprobe((void*)act_address); if ( act_access != old_access ) { access_output(act_access,old_address,act_address); old_address = act_address; } } return 0; }
void Map::myUpdate(MarControlPtr cause) { MarSystem::myUpdate(cause); const bool do_not_update = false; MarControlAccessor access_input(m_input_ctl, do_not_update); MarControlAccessor access_output(m_output_ctl, do_not_update); realvec & input = access_input.to<realvec>(); realvec & output = access_output.to<realvec>(); if (input.getRows() != inObservations_ || input.getCols() != inSamples_) { input.create(inObservations_, inSamples_); } if (output.getRows() != onObservations_ || output.getCols() != onSamples_) { output.create(onObservations_, onSamples_); } }