我試圖監視孩子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()」?