能给出tonardo下memshow()的代码吗?

sailor73cn 2007-04-04 08:54:05
在网上找过但是没找到,many thanks!
...全文
509 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sailor73cn 2007-04-10
  • 打赏
  • 举报
回复
Thanks a lot!
ningxin 2007-04-04
  • 打赏
  • 举报
回复
安装源码就看到。但是,不要问我源码盘到哪里弄。
adamgame 2007-04-04
  • 打赏
  • 举报
回复
直接给你源码吧
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);
}

2,179

社区成员

发帖
与我相关
我的任务
社区描述
xworks是美国 Wind River System 公司( 以下简称风河公司 ,即 WRS 公司)推出的一个实时操作系统。
社区管理员
  • VxWorks开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧