3632|4

74

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

能给出tonardo下memshow()的代码吗? [复制链接]

在网上找过但是没找到,many thanks!

最新回复

有点难度哦  详情 回复 发表于 2008-5-1 11:35
点赞 关注

回复
举报

75

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
安装源码就看到。但是,不要问我源码盘到哪里弄。
 
 

回复

85

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
直接给你源码吧
STATUS memPartShow
    (
    PART_ID partId,        /* partition ID                          */
    int                 type                /* 0 = statistics, 1 = statistics & list */
    )
    {
    int                numBlocks;
    unsigned        totalBytes = 0;
    unsigned        biggestWords = 0;

    if (partId == NULL)
        {
        printf ("No partId specified.\n");
        return (ERROR);
        }

    if (ID_IS_SHARED (partId))  /* partition is shared? */
        {
        if (smMemPartShowRtn == NULL)
            {
            errno = S_smObjLib_NOT_INITIALIZED;
            return (ERROR);
            }

        return ((STATUS) (*smMemPartShowRtn)(SM_OBJ_ID_TO_ADRS (partId), type));
        }

    /* partition is local */

    if (OBJ_VERIFY (partId, memPartClassId) != OK)
        return (ERROR);

    /* print out list header if we are going to print list */

    if (type == 1)
        {
        printf ("\nFREE LIST:\n");
        printf ("   num    addr       size\n");
        printf ("  ---- ---------- ----------\n");
        }

    semTake (&partId->sem, WAIT_FOREVER);

    if ((totalBytes = memPartAvailable (partId, &biggestWords, type)) == ERROR)
        {
        semGive (&partId->sem);
        return (ERROR);
        }
    else
        biggestWords /= 2;        /* memPartAvailable returns bytes, not words */
   
    if (type == 1)
        printf ("\n\n");

    numBlocks = dllCount (&partId->freeList);

    if (type == 1)
        printf ("SUMMARY:\n");
    printf (" status    bytes     blocks   avg block  max block\n");
    printf (" ------ ---------- --------- ---------- ----------\n");
    printf ("current\n");

    if (numBlocks != 0)
        printf ("   free %10u %9u %10u %10u\n", totalBytes, numBlocks,
                totalBytes / numBlocks, 2 * biggestWords);
    else
        printf ("   no free blocks\n");

    if (partId->curBlocksAllocated != 0)
        printf ("  alloc %10u %9u %10u          -\n",
                2 * partId->curWordsAllocated, partId->curBlocksAllocated,
                (2 * partId->curWordsAllocated) / partId->curBlocksAllocated);
    else
        printf ("   no allocated blocks\n");

    printf ("cumulative\n");

    if (partId->cumBlocksAllocated != 0)
        printf ("  alloc %10u %9u %10u          -\n",
                2 * partId->cumWordsAllocated, partId->cumBlocksAllocated,
                (2 * partId->cumWordsAllocated) / partId->cumBlocksAllocated);
    else
        printf ("   no allocated blocks\n");

    semGive (&partId->sem);

    return (OK);
    }
 
 
 

回复

80

帖子

0

TA的资源

一粒金砂(初级)

4
 
Thanks a lot!
 
 
 

回复

86

帖子

0

TA的资源

一粒金砂(初级)

5
 
有点难度哦
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/6 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表