Changeset 566ba81 in mainline
- Timestamp:
- 2006-01-08T14:43:52Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6d7ffa65
- Parents:
- 2fe2046c
- Location:
- generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/mm/buddy.h
r2fe2046c r566ba81 56 56 extern bool buddy_system_can_alloc(buddy_system_t *b, __u8 order); 57 57 extern void buddy_system_free(buddy_system_t *b, link_t *block); 58 extern void buddy_system_structure_print(buddy_system_t *b); 59 58 60 59 61 #endif -
generic/include/mm/frame.h
r2fe2046c r566ba81 114 114 */ 115 115 extern void zone_print_list(void); 116 extern void zone_print_one( index_t index);116 extern void zone_print_one(__address base); 117 117 118 118 #endif -
generic/src/mm/buddy.c
r2fe2046c r566ba81 231 231 232 232 } 233 234 235 236 /** Prints out structure of buddy system 237 * 238 * @param b Pointer to buddy system 239 * @param es Element size 240 */ 241 void buddy_system_structure_print(buddy_system_t *b) { 242 index_t i; 243 count_t cnt, elem_count = 0, block_count = 0; 244 link_t * cur; 245 246 247 printf("Order\tStatistics\n"); 248 printf("-----\t--------------------------------------\n"); 249 250 for (i=0;i < b->max_order; i++) { 251 cnt = 0; 252 if (!list_empty(&b->order[i])) { 253 for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) cnt++; 254 } 255 256 printf("#%d:\t%d blocks available (%d elements per block)\n", i, cnt, 1 << i); 257 258 block_count += cnt; 259 elem_count += (1 << i) * cnt; 260 } 261 printf("-----\t--------------------------------------\n"); 262 printf("Buddy system contains %d elements (%d blocks)\n" , elem_count, block_count); 263 264 } -
generic/src/mm/frame.c
r2fe2046c r566ba81 491 491 link_t *cur; 492 492 index_t i = 0; 493 spinlock_lock(&zone_head_lock); 493 494 printf("No.\tBase address\tFree Frames\tBusy Frames\n"); 494 495 printf("---\t------------\t-----------\t-----------\n"); 495 496 for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { 496 497 zone = list_get_instance(cur, zone_t, link); 498 spinlock_lock(&zone->lock); 497 499 printf("%d\t%L\t%d\t\t%d\n",i++,zone->base, zone->free_count, zone->busy_count); 498 500 } 501 spinlock_unlock(&zone_head_lock); 499 502 500 503 } … … 502 505 /** Prints zone details 503 506 * 504 * @param zone_index Zone order in zones list (0 is the first zone)505 */ 506 void zone_print_one( index_t zone_index) {507 zone_t *zone = NULL ;507 * @param base Zone base address 508 */ 509 void zone_print_one(__address base) { 510 zone_t *zone = NULL, *z ; 508 511 link_t *cur; 509 index_t i = 0; 512 513 514 spinlock_lock(&zone_head_lock); 515 510 516 511 517 for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { 512 if (i == zone_index) { 513 zone = list_get_instance(cur, zone_t, link); 518 z = list_get_instance(cur, zone_t, link); 519 if (base == z->base) { 520 zone = z; 514 521 break; 515 522 } 516 i++;517 }523 } 524 518 525 519 526 if (!zone) { 520 printf("No zone with index %d\n", zone_index);527 printf("No zone with address %X\n", base); 521 528 return; 522 529 } 523 530 524 printf("Memory zone %d information\n\n", zone_index); 531 spinlock_lock(&zone->lock); 532 printf("Memory zone information\n\n"); 525 533 printf("Zone base address: %P\n", zone->base); 526 534 printf("Zone size: %d frames (%d kbytes)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10); 527 535 printf("Allocated space: %d frames (%d kbytes)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10); 528 536 printf("Available space: %d (%d kbytes)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10); 529 printf("Buddy allocator structures: not implemented\n"); 530 } 531 537 538 printf("\nBuddy allocator structures:\n\n"); 539 buddy_system_structure_print(zone->buddy_system); 540 541 542 spinlock_unlock(&zone->lock); 543 spinlock_unlock(&zone_head_lock); 544 545 } 546
Note:
See TracChangeset
for help on using the changeset viewer.