2017-02-09 69 views
2

當使用Linux'time'命令和dd時,'文件系統輸出'計數是什麼?「文件系統輸出」對於時間-v是什麼意思?

它不等於dd'count'(大概是fwrite的調用次數?),也不等於4096字節頁面的輸出大小(在本例中應該是1024000)。

一個例子:

> /usr/bin/time -v dd if=/dev/zero of=/tmp/dd.test bs=4M count=1000 
1000+0 records in 
1000+0 records out 
4194304000 bytes (4.2 GB) copied, 4.94305 s, 849 MB/s 
Command being timed: "dd if=/dev/zero of=/tmp/dd.test bs=4M count=1000" 
User time (seconds): 0.00 
System time (seconds): 4.72 
Percent of CPU this job got: 95% 
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.94 
Average shared text size (kbytes): 0 
Average unshared data size (kbytes): 0 
Average stack size (kbytes): 0 
Average total size (kbytes): 0 
Maximum resident set size (kbytes): 5040 
Average resident set size (kbytes): 0 
Major (requiring I/O) page faults: 0 
Minor (reclaiming a frame) page faults: 1322 
Voluntary context switches: 32 
Involuntary context switches: 15 
Swaps: 0 
File system inputs: 240 
File system outputs: 8192000 
Socket messages sent: 0 
Socket messages received: 0 
Signals delivered: 0 
Page size (bytes): 4096 
Exit status: 0 

回答

3

timerusage結構打印出的值的命令(見getrusage(2))。

而且根據the source

/* 
* We approximate number of blocks, because we account bytes only. 
* A 'block' is 512 bytes 
*/ 
static inline unsigned long task_io_get_oublock(const struct task_struct *p) 
{ 
    return p->ioac.write_bytes >> 9; 
} 

因此(至少在Linux) 「文件系統輸出」 在time輸出爲寫入/ 512字節的總數。

+0

很好的回答。我不能說我明白爲什麼'塊'是512字節,而不是頁面大小,或者爲什麼它不只是'rusage'中的字節數。 Linux的神祕... – freddofrog

相關問題