16711|12

84

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

求实现vxworks+tonado下监控Cpu情况,内存情况的的代码和思路,万分感谢了!!!! [复制链接]

 如题,有人说用spy实现,有人能提供伪代码吗??谢谢了

最新回复

求思路?  详情 回复 发表于 2013-5-23 21:52
点赞 关注
 

回复
举报

75

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
每人能指点下吗?谢谢了
 
 
 

回复

88

帖子

0

TA的资源

一粒金砂(高级)

板凳
 
不会呀..
 
 
 

回复

64

帖子

0

TA的资源

一粒金砂(初级)

4
 
自己顶下。有人知道相关的API吗?
 
 
 

回复

68

帖子

0

TA的资源

一粒金砂(初级)

5
 
spy和memshow。如果需要更详细或者功能更强的显示,建议开一个最低优先级的任务,在任务里实现。
 
 
 

回复

71

帖子

0

TA的资源

一粒金砂(初级)

6
 
谢谢版主的回复,我测试了下spy

在Tronado下我包含了spyLib头文件,在一个任务中调用spy(0,0)

为什么编译可以通过,下载时候提示_spy()下载有错的信息呢?

另外memShow调用以后应该是直接显示在终端的吧,如何导入到日志中呢?

我现在的想法是调用GetTaskInfo,取得任务的堆栈使用情况,但是我不能确认是不是

我监控任务的堆栈 实际上也等同于监控任务的内存情况了吧?

只是CPU占用率监控还没有思路,斑竹再帮帮我了

chengjin109@163.com,有类似源码发下吗?谢谢了。
 
 
 

回复

73

帖子

0

TA的资源

一粒金砂(初级)

7
 
你需要包含一个组件才可以,组件的名字我记不起来了,你在configall.h里面查查,包含了以后你才可以使用这几个函数。
 
 
 

回复

74

帖子

0

TA的资源

一粒金砂(初级)

8
 
在OS中包含INCLUDE_SPY组件,
可以把输出通过I/O重定向到日志中。可用ioGlobalStdSet()
 
 
 

回复

86

帖子

0

TA的资源

一粒金砂(初级)

9
 
当然用ioTaskStdSet()可能会好一点!
 
 
 

回复

83

帖子

0

TA的资源

一粒金砂(初级)

10
 
我也和楼主一样,想要实现这样一个监控,但是问题是
那些show函数,只是把信息显示在屏幕上,
我用了ioGlobalStdSet() 后,的确显示在我设定的文件中了,
可是要到文件中一个个读取信息再分析也很麻烦,
有没有更好的办法呢?
比如说memShow有没有类似的函数,得到一个结构,其信息就是memShow给出的呢?
这样可以直接得到信息
 
 
 

回复

65

帖子

0

TA的资源

一粒金砂(初级)

11
 
/*******************************************************************************
*
* memPartShow - show partition blocks and statistics
*
* This routine displays statistics about the available and allocated memory
* in a specified memory partition.  It shows the number of bytes, the number
* of blocks, and the average block size in both free and allocated memory,
* and also the maximum block size of free memory.  It also shows the number
* of blocks currently allocated and the average allocated block size.
*
* In addition, if is 1, the routine displays a list of all the blocks
* in the free list of the specified partition.
*
* RETURNS: OK or ERROR.
*
* ERRNO: S_smObjLib_NOT_INITIALIZED
*
* SEE ALSO: memShow(),
* .pG "Target Shell,"
* windsh,
* .tG "Shell"
*/

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);
    }
 
 
 

回复

3

帖子

0

TA的资源

一粒金砂(初级)

12
 
这是库函数?还是?
 
 
 

回复

3

帖子

0

TA的资源

一粒金砂(初级)

13
 
求思路?
 
 
 

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

随便看看
查找数据手册?

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
快速回复 返回顶部 返回列表