func mapTrace(file string) { tr := trace.Get(file) for _, t := range tr { path, ok := inodb[t.Ino] if ok { _, ok = found[path] if !ok { fmt.Println(path) found[path] = true } } } }
func histogram(name string) { tr := trace.Get(name) for _, t := range tr { if Max < t.Count { Max = t.Count } if t.Count < maxcount { Hist[t.Count]++ } else { fmt.Println(t) } } }
// handler - func handler(w http.ResponseWriter, r *http.Request) { tr := trace.Get(r.URL.Path[1:]) dy := divup(trace.MaxBlock(tr), dx) m := Image{image.Rect(0, 0, dx, dy), make([][dx]bool, dy)} for _, t := range tr { for j := 0; j < int(t.Count); j++ { block := int(t.Block) + j y := block / dx x := block % dx m.Used[y][x] = true } } io.Copy(w, ShowImage(m)) }
func simulateCache(name string) { tr := trace.Get(name) noglass(tr) fmt.Println("size K #segs MiB secs opt avg eff") for shift := uint(0); shift < MaxShift; shift++ { segment := make([]uint64, Segment(uint64(trace.MaxBlock(tr)), shift)+1) for _, t := range tr { for j := uint32(0); j < t.Count; j++ { segment[Segment(uint64(t.Block+j), shift)]++ } } numsegs := nonzero(segment) avg := avgHits(segment) segsize := 1 << shift fmt.Printf(" %5d %5.3d %5.3d %6.2f %6.2f %6.2f %6.2f%%\n", 4*segsize, numsegs, (numsegs<<shift)*PageSize/Meg, cost(shift, numsegs), ideal(shift, numsegs), avg, avg/float64(segsize)*100.) } }
func dumpTrace(file string) { tr := trace.Get(file) for _, t := range tr { fmt.Println(t) } }
func dumpCache(name string) { tr := trace.Get(name) for _, t := range tr { fmt.Println(t) } }