27 lines
438 B
Go
27 lines
438 B
Go
package agent
|
|
|
|
import (
|
|
"regexp"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
func parseProgress(line string) (float64, bool) {
|
|
if !strings.Contains(line, "out_time_us=") {
|
|
return 0, false
|
|
}
|
|
|
|
re := regexp.MustCompile(`out_time_us=(\d+)`)
|
|
matches := re.FindStringSubmatch(line)
|
|
if len(matches) <= 1 {
|
|
return 0, false
|
|
}
|
|
|
|
us, err := strconv.ParseInt(matches[1], 10, 64)
|
|
if err != nil {
|
|
return 0, false
|
|
}
|
|
|
|
return float64(us) / 1000000.0, true
|
|
}
|