3
我有這樣的腳本:降低輸出到一條線
$counterWS = "\Process(powershell)\Working Set"
$counterWSPe = "\Process(powershell)\Working Set Peak"
$counterWSPr = "\Process(powershell)\Working Set - Private"
$dataWS = Get-Counter -Counter $counterWS
$dataWSPe = Get-Counter -Counter $counterWSPe
$dataWSPr = Get-Counter -Counter $counterWSPr
$dataWS.countersamples | Format-Table Timestamp,@{Name='WorkingSet';Expression={($_.CookedValue/1KB)}},WorkingSetPeak,WorkingSetPrivate -Auto | findstr Timestamp
$dataWS.countersamples | Format-Table Timestamp,@{Name='WorkingSet';Expression={($_.CookedValue/1KB)}},WorkingSetPeak,WorkingSetPrivate -Auto | findstr [-]
while ($true) {
$dataWS.countersamples | Format-Table Timestamp,@{Name='WorkingSet';Expression={($_.CookedValue/1KB)}},WorkingSetPeak,WorkingSetPrivate -Auto | findstr [:]
$dataWSPe.countersamples | Format-Table Timestamp,WorkingSet,@{Name='WorkingSetPeak';Expression={($_.CookedValue/1KB)}},WorkingSetPrivate -Auto | findstr [:]
$dataWSPr.countersamples | Format-Table Timestamp,WorkingSet,WorkingSetPeak,@{Name='WorkingSetPrivate';Expression={($_.CookedValue/1KB)}} -Auto | findstr [:]
Start-Sleep -s $args[0]
}
,結果是這樣的:
Timestamp WorkingSet WorkingSetPeak WorkingSetPrivate --------- ---------- -------------- ----------------- 29/07/2016 18:41:12 10644 29/07/2016 18:41:13 10676 29/07/2016 18:41:14 3056
有沒有一種方法來減少,使輸出像這樣:
Timestamp WorkingSet WorkingSetPeak WorkingSetPrivate --------- ---------- -------------- ----------------- 29/07/2016 18:41:12 10644 10676 3056