1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-24 13:48:56 +08:00

[mem][solaris] simplify regular expressions

This commit is contained in:
Ville Skyttä 2021-10-22 18:28:52 +03:00
parent 093e68cb91
commit 09c3ba3896
2 changed files with 4 additions and 4 deletions

View File

@ -67,7 +67,7 @@ func zoneName() (string, error) {
return strings.TrimSpace(string(out)), nil
}
var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: ([\d]+) Megabytes`)
var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: (\d+) Megabytes`)
func globalZoneMemoryCapacity() (uint64, error) {
prtconf, err := exec.LookPath("prtconf")
@ -94,7 +94,7 @@ func globalZoneMemoryCapacity() (uint64, error) {
return totalMB * 1024 * 1024, nil
}
var kstatMatch = regexp.MustCompile(`([^\s]+)[\s]+([^\s]*)`)
var kstatMatch = regexp.MustCompile(`(\S+)\s+(\S*)`)
func nonGlobalZoneMemoryCapacity() (uint64, error) {
kstat, err := exec.LookPath("kstat")

View File

@ -67,7 +67,7 @@ func zoneName() (string, error) {
return strings.TrimSpace(string(out)), nil
}
var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: ([\d]+) Megabytes`)
var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: (\d+) Megabytes`)
func globalZoneMemoryCapacity() (uint64, error) {
prtconf, err := exec.LookPath("prtconf")
@ -94,7 +94,7 @@ func globalZoneMemoryCapacity() (uint64, error) {
return totalMB * 1024 * 1024, nil
}
var kstatMatch = regexp.MustCompile(`([^\s]+)[\s]+([^\s]*)`)
var kstatMatch = regexp.MustCompile(`(\S+)\s+(\S*)`)
func nonGlobalZoneMemoryCapacity() (uint64, error) {
kstat, err := exec.LookPath("kstat")