MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / list_memheap

Function list_memheap

components/finsh/cmd.c:638–692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636
637#ifdef RT_USING_MEMHEAP
638long list_memheap(void)
639{
640 rt_base_t level;
641 list_get_next_t find_arg;
642 struct rt_object_information *info;
643 rt_list_t *obj_list[LIST_FIND_OBJ_NR];
644 rt_list_t *next = (rt_list_t *)RT_NULL;
645
646 int maxlen;
647 const char *item_title = "memheap";
648
649 list_find_init(&find_arg, RT_Object_Class_MemHeap, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
650 info = rt_list_entry(find_arg.list, struct rt_object_information, object_list);
651
652 maxlen = RT_NAME_MAX;
653
654 rt_kprintf("%-*.*s pool size max used size available size\n", maxlen, maxlen, item_title);
655 object_split(maxlen);
656 rt_kprintf(" ---------- ------------- --------------\n");
657 do
658 {
659 next = list_get_next(next, &find_arg);
660 {
661 int i;
662 for (i = 0; i < find_arg.nr_out; i++)
663 {
664 struct rt_object *obj;
665 struct rt_memheap *mh;
666
667 obj = rt_list_entry(obj_list[i], struct rt_object, list);
668 level = rt_spin_lock_irqsave(&info->spinlock);
669 if ((obj->type & ~RT_Object_Class_Static) != find_arg.type)
670 {
671 rt_spin_unlock_irqrestore(&info->spinlock, level);
672 continue;
673 }
674
675 rt_spin_unlock_irqrestore(&info->spinlock, level);
676
677 mh = (struct rt_memheap *)obj;
678
679 rt_kprintf("%-*.*s %-010d %-013d %-05d\n",
680 maxlen, RT_NAME_MAX,
681 mh->parent.name,
682 mh->pool_size,
683 mh->max_used_size,
684 mh->available_size);
685
686 }
687 }
688 }
689 while (next != (rt_list_t *)RT_NULL);
690
691 return 0;
692}
693#endif /* RT_USING_MEMHEAP */
694
695#ifdef RT_USING_MEMPOOL

Callers 3

cmd_freeFunction · 0.85
ifFunction · 0.85
cmd_listFunction · 0.85

Calls 6

rt_kprintfFunction · 0.85
list_find_initFunction · 0.70
object_splitFunction · 0.70
list_get_nextFunction · 0.70
rt_spin_lock_irqsaveFunction · 0.50

Tested by

no test coverage detected