|
@@ -303,12 +303,12 @@ func printAssembly(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
|
303
|
303
|
flatSum, cumSum := sns.Sum()
|
304
|
304
|
|
305
|
305
|
// Get the function assembly.
|
306
|
|
- insns, err := obj.Disasm(s.sym.File, s.sym.Start, s.sym.End)
|
|
306
|
+ insts, err := obj.Disasm(s.sym.File, s.sym.Start, s.sym.End)
|
307
|
307
|
if err != nil {
|
308
|
308
|
return err
|
309
|
309
|
}
|
310
|
310
|
|
311
|
|
- ns := annotateAssembly(insns, sns, s.base)
|
|
311
|
+ ns := annotateAssembly(insts, sns, s.base)
|
312
|
312
|
|
313
|
313
|
fmt.Fprintf(w, "ROUTINE ======================== %s\n", s.sym.Name[0])
|
314
|
314
|
for _, name := range s.sym.Name[1:] {
|
|
@@ -473,9 +473,9 @@ func (a *assemblyInstruction) cumValue() int64 {
|
473
|
473
|
// annotateAssembly annotates a set of assembly instructions with a
|
474
|
474
|
// set of samples. It returns a set of nodes to display. base is an
|
475
|
475
|
// offset to adjust the sample addresses.
|
476
|
|
-func annotateAssembly(insns []plugin.Inst, samples graph.Nodes, base uint64) []assemblyInstruction {
|
|
476
|
+func annotateAssembly(insts []plugin.Inst, samples graph.Nodes, base uint64) []assemblyInstruction {
|
477
|
477
|
// Add end marker to simplify printing loop.
|
478
|
|
- insns = append(insns, plugin.Inst{
|
|
478
|
+ insts = append(insts, plugin.Inst{
|
479
|
479
|
Addr: ^uint64(0),
|
480
|
480
|
})
|
481
|
481
|
|
|
@@ -483,8 +483,8 @@ func annotateAssembly(insns []plugin.Inst, samples graph.Nodes, base uint64) []a
|
483
|
483
|
samples.Sort(graph.AddressOrder)
|
484
|
484
|
|
485
|
485
|
s := 0
|
486
|
|
- asm := make([]assemblyInstruction, 0, len(insns))
|
487
|
|
- for ix, in := range insns[:len(insns)-1] {
|
|
486
|
+ asm := make([]assemblyInstruction, 0, len(insts))
|
|
487
|
+ for ix, in := range insts[:len(insts)-1] {
|
488
|
488
|
n := assemblyInstruction{
|
489
|
489
|
address: in.Addr,
|
490
|
490
|
instruction: in.Text,
|
|
@@ -497,7 +497,7 @@ func annotateAssembly(insns []plugin.Inst, samples graph.Nodes, base uint64) []a
|
497
|
497
|
|
498
|
498
|
// Sum all the samples until the next instruction (to account
|
499
|
499
|
// for samples attributed to the middle of an instruction).
|
500
|
|
- for next := insns[ix+1].Addr; s < len(samples) && samples[s].Info.Address-base < next; s++ {
|
|
500
|
+ for next := insts[ix+1].Addr; s < len(samples) && samples[s].Info.Address-base < next; s++ {
|
501
|
501
|
sample := samples[s]
|
502
|
502
|
n.flatDiv += sample.FlatDiv
|
503
|
503
|
n.flat += sample.Flat
|