我试图监视孩子process.time -v的峰值内存使用量是一个选项,但它不是在solaris.So工作有没有什么办法让那些在rusage结构从shell脚本的详细信息?在shell脚本中是否有任何替代wait3来获取rusage结构?
回答
您可以使用/usr/bin/timex
执行给定的命令;以秒为单位报告所用时间,用户时间和系统执行时间。任选地,该命令处理 会计数据和它的所有子可列出或 总结,并执行间隔 期间总系统活动可以被报告。
...
的命令列表-p进程记账记录及其所有子。 只有在安装了进程记账软件后,此选项才有效。子选项f,h,k,m,r和t修改报告的数据项目 。选项如下:
...
开始与该男子页acctadm
得到启用进程记帐。
注意,在Solaris上,getrusage()
和wait3()
不返回内存使用统计信息。看到http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/syscall/rusagesys.c的(有些过时)getrusage()
源代码,并在http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/sys/common/wait.c#158的wait3()
源代码(这实际上是OpenSolaris源代码,甲骨文下跌的支持,它可能不能代表当前的Solaris实现,但在Solaris 11.2一些测试表明, RSS数据实际上仍为零)
此外,从Solaris getrusage()
man page:
的
ru_maxrss
,所述rusage
结构的ru_ixrss
,ru_idrss
,和ru_isrss
成员在该实施方式中设定为0。
几乎可以肯定有其他方法来获取数据,如dtrace
。
编辑:
dtrace
不看太大的帮助,很遗憾。试图用dtrace -s memuse.d -c bash
#!/usr/sbin/dtrace -s
#pragma D option quiet
profile:::profile-1001hz
/pid == $target/
{
@pct[ pid ] = max(curpsinfo->pr_pctmem);
}
dtrace:::END
{
printa("pct: %@u %a\n", @pct);
}
导致以下错误信息运行此脚本dtrace
:
dtrace: failed to compile script memuse.d: line 8: translator does not define conversion for member: pr_pctmem
在Solaris dtrace
似乎并没有提供对进程的内存使用。实际上,Solaris 11。2 /usr/lib/dtrace/procfs.d
翻译为procfs
数据中有此评论:
/*
* Translate from the kernel's proc_t structure to a proc(4) psinfo_t struct.
* We do not provide support for pr_size, pr_rssize, pr_pctcpu, and pr_pctmem.
* We also do not fill in pr_lwp (the lwpsinfo_t for the representative LWP)
* because we do not have the ability to select and stop any representative.
* Also, for the moment, pr_wstat, pr_time, and pr_ctime are not supported,
* but these could be supported by DTrace in the future using subroutines.
* Note that any member added to this translator should also be added to the
* kthread_t-to-psinfo_t translator, below.
*/
浏览Illumos.org源代码,搜索ps_rssize
,表示在需要时procfs
数据仅计算,而不是不断更新的过程中运行。 (见http://src.illumos.org/source/search?q=pr_rssize&defs=&refs=&path=&hist=&project=illumos-gate)
- 1. 是否有任何模块可以读取shell脚本?
- 2. 在PHP中是否有任何替代*
- 3. 在Solaris/AIX中是否有任何实用程序来打包shell脚本?
- 4. shell脚本,以获取有关任何用户在Linux机器
- 5. PyPy中是否有任何替代sys.getsizeof()?
- 6. Shell脚本:grep和替代
- 7. shell脚本SED替代
- 8. Shell脚本grep替代
- 9. 如何加快Ruby脚本?还是shell脚本替代?
- 10. getcwd是否有任何替代API来获取进程的工作方向
- 11. shell脚本变结构
- 12. 如何从shell脚本获取telnet执行结果代码?
- 13. 在shell脚本中使用curl来代替变量
- 14. shell脚本文件夹结构中循环和EXCUTE shell脚本
- 15. 从shell脚本获取结果objective-c
- 16. [Shell脚本]在shell脚本中获取httpreqest POST
- 17. 代替变在shell脚本用perl
- 18. 是否有任何替代yUML
- 19. 是否有任何svn_load_dirs.pl的替代品?
- 20. 是否有任何替代System.IO.DirectoryInfo.Exists
- 21. 是否有任何替代cprintf?
- 22. 是否有任何替代的Javascript
- 23. 是否有任何替代日食LogCat?
- 24. 是否有任何IDA Pro替代品?
- 25. 是否有任何替代document.form.submit()?
- 26. 是否有任何替代JTS WKTReader?
- 27. 是否有任何替代`eval`和`Kernel.const_get`?
- 28. 是否有任何替代android.net.rtp包
- 29. 是否有任何替代GetElementById?
- 30. 是否有任何替代mySQL的“last_update_ID()”?