Show More
@@ -729,10 +729,6 b' def write_to_flame(data, fp, scriptpath=' | |||||
729 | fp.write(b'get it here: https://github.com/brendangregg/FlameGraph\n') |
|
729 | fp.write(b'get it here: https://github.com/brendangregg/FlameGraph\n') | |
730 | return |
|
730 | return | |
731 |
|
731 | |||
732 | fd, path = pycompat.mkstemp() |
|
|||
733 |
|
||||
734 | file = open(path, "w+") |
|
|||
735 |
|
||||
736 | lines = {} |
|
732 | lines = {} | |
737 | for sample in data.samples: |
|
733 | for sample in data.samples: | |
738 | sites = [s.function for s in sample.stack] |
|
734 | sites = [s.function for s in sample.stack] | |
@@ -743,11 +739,12 b' def write_to_flame(data, fp, scriptpath=' | |||||
743 | else: |
|
739 | else: | |
744 | lines[line] = 1 |
|
740 | lines[line] = 1 | |
745 |
|
741 | |||
|
742 | fd, path = pycompat.mkstemp() | |||
|
743 | ||||
|
744 | with open(path, "w+") as file: | |||
746 | for line, count in lines.iteritems(): |
|
745 | for line, count in lines.iteritems(): | |
747 | file.write("%s %d\n" % (line, count)) |
|
746 | file.write("%s %d\n" % (line, count)) | |
748 |
|
747 | |||
749 | file.close() |
|
|||
750 |
|
||||
751 | if outputfile is None: |
|
748 | if outputfile is None: | |
752 | outputfile = '~/flamegraph.svg' |
|
749 | outputfile = '~/flamegraph.svg' | |
753 |
|
750 |
General Comments 0
You need to be logged in to leave comments.
Login now