[英]How to find or calculate a Linux process's page table size and other kernel accounting?
[英]How does Linux Process Accounting (psacct) work?
我找到了很多關於psacct
文檔,但它們正在解決使用問題,而不是它的工作方式。
我真的想知道流程會計的工作原理:
系統的哪個部分記錄有關進程的信息?
它是如何工作的?
我在RHEL 6.5上安裝了psacct。
服務啟動腳本實際上(/etc/init.d/psacct)調用這個:
/ sbin / accton $ ACCTFILE
/ sbin / accton調用系統調用acct()
男人的
描述acct()系統調用啟用或禁用進程記帳。 如果使用現有文件的名稱作為其參數進行調用,則會啟用記帳,並在終止時將每個終止進程的記錄附加到filename。 NULL參數會導致會計被關閉。
您的問題的答案在linux源文件kernel/acct.c
。 特別是在fill_ac function
/*
* Write an accounting entry for an exiting process
*
* The acct_process() call is the workhorse of the process
* accounting system. The struct acct is built here and then written
* into the accounting file. This function should only be called from
* do_exit() or when switching to a different output file.
*/
static void fill_ac(acct_t *ac)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.