Changeset 566ba81 in mainline for generic/src/mm/buddy.c


Ignore:
Timestamp:
2006-01-08T14:43:52Z (20 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6d7ffa65
Parents:
2fe2046c
Message:

Console command 'zone' now takes zone address as parameter.
Added buddy system statistics into the 'zone' command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/mm/buddy.c

    r2fe2046c r566ba81  
    231231
    232232}
     233
     234
     235
     236/** Prints out structure of buddy system
     237 *
     238 * @param b Pointer to buddy system
     239 * @param es Element size
     240 */
     241void 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}
Note: See TracChangeset for help on using the changeset viewer.