我一直在试验时间命令(/usr/bin/time)。我让时间命令运行如下
/usr/bin/time -v sleep 30
在另一个终端上,我做了一个ps -a
并找出了sleep
进程的 PID。现在我向睡眠发送一条消息,使用kill -1 PID
它终止了进程睡眠。由于睡眠是按时运行的,它列出了资源使用统计信息,如下所示
Command being timed: "sleep 30"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:21.81
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): 2160
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 180
Voluntary context switches: 2
Involuntary context switches: 2
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
然而令我惊讶的是,Signals Delivered 字段的值为 0!这怎么可能?
编辑:
而不是sleep 30
,我尝试了以下脚本。
trap "echo Hello" 1 2
sleep 30
现在我为上面的脚本计时并向它发送信号 1 和 2。在那种情况下, Signals Delivered 字段仍然为 0。这让我得出结论 Signals Delivered 字段为 0 ,而不是因为未处理信号。