📄 diskutil.prl
字号:
#!/usr/local/bin/perl5 -w## Copyright (C) 1996-1998 by the Board of Trustees# of Leland Stanford Junior University.# # This file is part of the SimOS distribution. # See LICENSE file for terms of the license. #$inputFile = shift;if( !defined( $inputFile ) ) { $inputFile = "cpu.log";}open(LOG,$inputFile);$startTime = 0;$entries = 0;$minDiff = 10000000000;$maxDiff = 0;$totalDiff = 0;$proc = 0;$disklabel = 0;$disk = 0;for $i ( 0..10 ) { $usedTime[$i] = 0; $freeTime[$i] = 0; $lastUsed[$i] = 0; $prevUsed[$i] = 0; $diskInUse[$i] = 0;}while( <LOG>) { ($log,$time,$event,$cpu,$proc,$disklabel,$diskInfo,$op,$sizelabel,$size) = split; if( defined($log) ) { if( $log eq "CONFIG") { if( $time eq "CpuClock") { $clockRate = $event; $baseInt = $clockRate * 1000 * 40; $nextInt = $clockRate * 1000 * 40 ; $timeMS = 1; } } if ($log eq "PARAM") { if ($time eq "CPU.Clock") { $clockRate = $event; $baseInt = $clockRate * 1000 * 40; $nextInt = $clockRate * 1000 * 40 ; $timeMS = 1; } } if( $log eq "LOG" ) { while( $time > $nextInt ) { printf( "%8.5f ", $nextInt/ ($clockRate * 1000000)); for $i (1..8) { if( $diskInUse[$i] ) { $usedTime[$i] += $nextInt - $savedStart[$i]; $savedStart[$i] = $nextInt; } printf( "%6.2f ", 100 * ($usedTime[$i]-$prevUsed[$i])/$baseInt); $prevUsed[$i] = $usedTime[$i]; } printf("\n"); $nextInt += $baseInt; } if( $event eq "DISK-req" ) { if ($diskInfo eq "disk") { ($foo,$disk) = split(/\./,$op); } else { ($foo,$disk) = split(/\./,$diskInfo); } $freeTime[$disk] += $time - $lastUsed[$disk]; $savedOp[$disk] = $op; $savedStart[$disk] = $time; $savedSize[$disk] = $size; $diskInUse[$disk] = 1; } if( $event eq "DISK-ack" ) { ## ## deall with 'kernel idle' being a process name! if ($diskInfo eq "disk") { ($foo,$foo2,$disk) = split(/\./,$op); } else { ($foo,$foo2,$disk) = split(/\./,$diskInfo); } #print "XXX
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -