| 592 | } |
| 593 | |
| 594 | func (sp *sourcePrinter) initSamples(flat, cum map[uint64]int64) { |
| 595 | for addr, inst := range sp.insts { |
| 596 | // Move all samples that were assigned to the middle of an instruction to the |
| 597 | // beginning of that instruction. This takes care of samples that were recorded |
| 598 | // against pc+1. |
| 599 | instEnd := addr + uint64(inst.length) |
| 600 | for p := addr; p < instEnd; p++ { |
| 601 | inst.flat += flat[p] |
| 602 | inst.cum += cum[p] |
| 603 | } |
| 604 | sp.insts[addr] = inst |
| 605 | } |
| 606 | } |
| 607 | |
| 608 | func (sp *sourcePrinter) generate(maxFiles int, rpt *Report) WebListData { |
| 609 | // Finalize per-file counts. |