func listUpOverAverage(historyStoragePath string) { storage := historystorage.LoadStorage(historyStoragePath) storage.Init() nrStored := storage.NrStoredHistories() totalTime := time.Duration(0) for i := 0; i < nrStored; i++ { time, err := storage.GetRequiredTime(i) if err != nil { fmt.Printf("failed to open history %08x, %s\n", i, err) continue // just skip? } totalTime += time } averageTime := time.Duration(int64(totalTime) / int64(nrStored)) for i := 0; i < nrStored; i++ { time, err := storage.GetRequiredTime(i) if err != nil { fmt.Printf("failed to open history %08x, %s\n", i, err) continue // just skip? } if averageTime < time { fmt.Printf("%08x\n", i) } } }
func gnuplot(historyStoragePath string, poReduction bool) error { storage := historystorage.LoadStorage(historyStoragePath) storage.Init() nrStored := storage.NrStoredHistories() nrUniques := 0 uniqueTraces := make([]*uniqueTraceUnit, 0) for i := 0; i < nrStored; i++ { trace, err := storage.GetStoredHistory(i) if err != nil { return fmt.Errorf("failed to open history %08x, %s\n", i, err) } newUnit := &uniqueTraceUnit{ trace: trace, } seen := false if poReduction { seen = seenBeforePOR(uniqueTraces, newUnit) } else { seen = seenBefore(uniqueTraces, newUnit) } if !seen { nrUniques++ uniqueTraces = append(uniqueTraces, newUnit) } fmt.Printf("%d %d\n", i+1, nrUniques) } return nil }
func doSummary(historyStoragePath string) { storage := historystorage.LoadStorage(historyStoragePath) storage.Init() nrStored := storage.NrStoredHistories() for i := 0; i < nrStored; i++ { succeed, err := storage.IsSuccessful(i) if err != nil { fmt.Printf("failed to open history %08x, %s\n", i, err) continue } if !succeed { fmt.Printf("%08x caused failure\n", i) } } }