第四十八章 使用 ^SystemPerformance 監視性能 - 生成配置文件
生成配置文件
可以使用以下 API
命令快速生成新的配置文件(具有有意義的名稱和描述):
set rc=$$genprofile^SystemPerformance("duration"[,interval])
-
duration
- 配置文件應運行多長時間。有效格式爲“hh:mm
”、“hh:
”或mm
-
interval (optional)
- 運行每個樣本的頻率,以秒爲單位(在1
秒到 300 秒的範圍內)。僅當配置文件持續時間爲一小時或更短時,才允許1
秒的間隔。
如果成功,該函數返回 1
。如果不成功,它返回一個 0
後跟一個 carat
和任何錯誤的原因。
注意:最長持續時間爲 24
小時(86400
秒);如果指定更長的持續時間,^SystemPerformance
會將其減少到 24
小時。僅當持續時間包含冒號 (:
) 時,才必須用雙引號引起來;冒號表示小時。
最小間隔(如果指定)爲 2
秒,除非持續時間(即間隔 * 計數)小於一小時,在這種情況下最小間隔爲 1
秒。如果指定無效間隔,^SystemPerformance
會將其增加到所需的最小值。如果未指定間隔,則默認爲 10
秒。
例如,要生成一個名爲 12hours
(具有生成的配置文件名稱和描述)的配置文件,該配置文件在 12
小時內每 5
分鐘(300
秒)運行一次樣本,請輸入以下內容:
set rc=$$genprofile^SystemPerformance("12:",300)
此外,要生成一個名爲 90mins
的配置文件,該配置文件每 10
秒運行一次樣本,持續 90
分鐘,請輸入以下內容:
set rc=$$genprofile^SystemPerformance(90)
下次運行 ^SystemPerformance
實用程序時,配置文件列表包括以下配置文件名稱和說明:
12hours A 12 hour run sampling every 300 seconds
90mins A 90 minute run sampling every 10 seconds
編輯配置文件
可以使用以下 API
命令編輯現有配置文件(預定義的“測試”配置文件除外):
set rc=$$editprofile^SystemPerformance("profilename","description",[interval],[count])
-
profilename
- 要編輯的現有配置文件的名稱。 -
description
-^SystemPerformance
菜單中顯示的配置文件的說明。 -
interval (optional)
- 運行每個樣本的頻率,以秒爲單位(在 1 秒到300
秒的範圍內)。僅當配置文件持續時間爲一小時或更短時,才允許 1 秒的間隔。 -
count (optional)
- 運行配置文件的次數。
如果成功,該函數返回 1
,如果不成功,則返回 0
。緊隨其後的是克拉,然後是任何錯誤的原因。
注意:參數是位置的;例如,如果要編輯計數參數(並保留間隔參數中指定的值),則必須包括逗號分隔符,如下所示: set rc=$$editprofile^SystemPerformance("2minrun","A 5-minute run sampling every 30 seconds",,50)
。
如果持續時間超過 24
小時(86400
秒),它會自動減少到 24
小時。
例如,要修改 2minrun
配置文件以每 30
秒運行一次採樣,直到運行 10
次採樣(總共 300
秒或五分鐘),請輸入以下內容:
set rc=$$editprofile^SystemPerformance("2minrun","A 5-minute run sampling every 30 seconds",30,10)
下次運行 ^SystemPerformance
實用程序時,配置文件列表包括以下配置文件名稱和說明:
2minrun A 5-minute run sampling every 30 seconds