Rev 686 | Rev 735 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 686 | Rev 701 | ||
|---|---|---|---|
| Line 229... | Line 229... | ||
| 229 | */ |
229 | */ |
| 230 | list_append(block, &b->order[i]); |
230 | list_append(block, &b->order[i]); |
| 231 | 231 | ||
| 232 | } |
232 | } |
| 233 | 233 | ||
| 234 | - | ||
| 235 | - | ||
| 236 | /** Prints out structure of buddy system |
234 | /** Prints out structure of buddy system |
| 237 | * |
235 | * |
| 238 | * @param b Pointer to buddy system |
236 | * @param b Pointer to buddy system |
| 239 | * @param es Element size |
237 | * @param es Element size |
| 240 | */ |
238 | */ |
| Line 248... | Line 246... | ||
| 248 | printf("-----\t------\t--------\t----------\t---------------\n"); |
246 | printf("-----\t------\t--------\t----------\t---------------\n"); |
| 249 | 247 | ||
| 250 | for (i=0;i < b->max_order; i++) { |
248 | for (i=0;i < b->max_order; i++) { |
| 251 | cnt = 0; |
249 | cnt = 0; |
| 252 | if (!list_empty(&b->order[i])) { |
250 | if (!list_empty(&b->order[i])) { |
| 253 | for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) cnt++; |
251 | for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) |
| - | 252 | cnt++; |
|
| 254 | } |
253 | } |
| 255 | 254 | ||
| 256 | printf("#%d\t%d\t%d kb\t\t%d kb\t\t%d\n", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i); |
255 | printf("#%d\t%d\t%dK\t\t%dK\t\t%d\n", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i); |
| 257 | 256 | ||
| 258 | block_count += cnt; |
257 | block_count += cnt; |
| 259 | elem_count += (1 << i) * cnt; |
258 | elem_count += (1 << i) * cnt; |
| 260 | } |
259 | } |
| 261 | printf("-----\t------\t--------\t----------\t---------------\n"); |
260 | printf("-----\t------\t--------\t----------\t---------------\n"); |
| 262 | printf("Buddy system contains %d elements (%d blocks)\n" , elem_count, block_count); |
261 | printf("Buddy system contains %d free elements (%d blocks)\n" , elem_count, block_count); |
| 263 | 262 | ||
| 264 | } |
263 | } |