@@ -7,6 +7,11 @@ import (
77 "github.com/checkpoint-restore/go-criu/v6/crit/images"
88)
99
10+ const (
11+ StatsDump = "stats-dump"
12+ StatsRestore = "stats-restore"
13+ )
14+
1015// Helper function to load stats file into Go struct
1116func getStats (path string ) (* images.StatsEntry , error ) {
1217 c := New (path , "" , "" , false , false )
@@ -26,7 +31,7 @@ func getStats(path string) (*images.StatsEntry, error) {
2631// GetDumpStats returns the dump statistics of a checkpoint.
2732// dir is the path to the directory with the checkpoint images.
2833func GetDumpStats (dir string ) (* images.DumpStatsEntry , error ) {
29- stats , err := getStats (filepath .Join (dir , "stats-dump" ))
34+ stats , err := getStats (filepath .Join (dir , StatsDump ))
3035 if err != nil {
3136 return nil , err
3237 }
@@ -37,7 +42,7 @@ func GetDumpStats(dir string) (*images.DumpStatsEntry, error) {
3742// GetRestoreStats returns the restore statistics of a checkpoint.
3843// dir is the path to the directory with the checkpoint images.
3944func GetRestoreStats (dir string ) (* images.RestoreStatsEntry , error ) {
40- stats , err := getStats (filepath .Join (dir , "stats-restore" ))
45+ stats , err := getStats (filepath .Join (dir , StatsRestore ))
4146 if err != nil {
4247 return nil , err
4348 }
0 commit comments