-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
177 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module FlameGraphsFileIOExt | ||
|
||
isdefined(Base, :get_extension) ? (using FileIO) : (using ..FileIO) | ||
using Profile | ||
|
||
using FlameGraphs | ||
using FlameGraphs: Node, NodeData | ||
|
||
import FlameGraphs: save, load | ||
|
||
function save(f::File{format"JLPROF"}, data::AbstractVector{<:Unsigned}, lidict::Profile.LineInfoDict) | ||
open(f, "w") do s | ||
save(stream(s), data, lidict) | ||
end | ||
end | ||
|
||
function save(f::File{format"JLPROF"}, g::Node{NodeData}) | ||
open(f, "w") do s | ||
save(stream(s), g) | ||
end | ||
end | ||
|
||
# Note: this may not work from FileIO because it returns an anonymous function for saving data | ||
save(f::File{format"JLPROF"}) = save(filename(f)) | ||
|
||
|
||
function load(f::File{format"JLPROF"}) | ||
open(f) do s | ||
skipmagic(s) | ||
load(s) | ||
end | ||
end | ||
|
||
function load(s::Stream{format"JLPROF"}) | ||
load(stream(s)) | ||
end | ||
|
||
end # module FlameGraphsFileIOExt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters