From 12c8b0da6e6e3851dff6d16493017df1bbb9f306 Mon Sep 17 00:00:00 2001 From: Mike Roberts Date: Sun, 1 May 2022 18:02:19 +0100 Subject: [PATCH] Add test for austin (python profiler) input to flamegraph --- tests/data/flamegraph/austin/flame.svg | 114 ++++++++++++++++++++++++ tests/data/flamegraph/austin/flames.txt | 8 ++ tests/flamegraph.rs | 8 ++ 3 files changed, 130 insertions(+) create mode 100644 tests/data/flamegraph/austin/flame.svg create mode 100644 tests/data/flamegraph/austin/flames.txt diff --git a/tests/data/flamegraph/austin/flame.svg b/tests/data/flamegraph/austin/flame.svg new file mode 100644 index 00000000..d19591cc --- /dev/null +++ b/tests/data/flamegraph/austin/flame.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + Flame Graph + + Reset Zoom + Search + + + + <frozen importlib._bootstrap_external>:<module>:35 (105 samples, 36.08%) + + <frozen importlib._bootstrap_external>:<module>:35 + + + <frozen importlib._bootstrap>:_find_and_load:1007 (105 samples, 36.08%) + + <frozen importlib._bootstrap>:_find_and_load:1007 + + + <frozen importlib._bootstrap>:_find_and_load_unlocked:986 (105 samples, 36.08%) + + <frozen importlib._bootstrap>:_find_and_load_unlocked:986 + + + <frozen importlib._bootstrap>:_load_unlocked:680 (105 samples, 36.08%) + + <frozen importlib._bootstrap>:_load_unlocked:680 + + + <frozen importlib._bootstrap>:exec_module:768 (105 samples, 36.08%) + + <frozen importlib._bootstrap>:exec_module:768 + + + <frozen importlib._bootstrap>:_call_with_frames_removed:228 (105 samples, 36.08%) + + <frozen importlib._bootstrap>:_call_with_frames_removed:228 + + + all (291 samples, 100%) + + + + + P6360 (291 samples, 100.00%) + + P6360 + + + T6360 (291 samples, 100.00%) + + T6360 + + + <frozen importlib._bootstrap>:_install_external_importers:1187 (291 samples, 100.00%) + + <frozen importlib._bootstrap>:_install_external_importers:1187 + + + <frozen importlib._bootstrap>:_find_and_load:1007 (291 samples, 100.00%) + + <frozen importlib._bootstrap>:_find_and_load:1007 + + + <frozen importlib._bootstrap>:_find_and_load_unlocked:986 (291 samples, 100.00%) + + <frozen importlib._bootstrap>:_find_and_load_unlocked:986 + + + <frozen importlib._bootstrap>:_load_unlocked:680 (291 samples, 100.00%) + + <frozen importlib._bootstrap>:_load_unlocked:680 + + + <frozen importlib._bootstrap>:exec_module:838 (291 samples, 100.00%) + + <frozen importlib._bootstrap>:exec_module:838 + + + <frozen importlib._bootstrap_external>:<module>:828 (186 samples, 63.92%) + + <frozen importlib._bootstrap_external>:<module>:828 + + + diff --git a/tests/data/flamegraph/austin/flames.txt b/tests/data/flamegraph/austin/flames.txt new file mode 100644 index 00000000..ff14155f --- /dev/null +++ b/tests/data/flamegraph/austin/flames.txt @@ -0,0 +1,8 @@ +# austin: 3.3.0 +# interval: 100 +# mode: wall + +P6360;T6360;:_install_external_importers:1187;:_find_and_load:1007;:_find_and_load_unlocked:986;:_load_unlocked:680;:exec_module:838;::35;:_find_and_load:1007;:_find_and_load_unlocked:986;:_load_unlocked:680;:exec_module:768;:_call_with_frames_removed:228 105 +P6360;T6360;:_install_external_importers:1187;:_find_and_load:1007;:_find_and_load_unlocked:986;:_load_unlocked:680;:exec_module:838;::828 186 + +# duration: 23873 diff --git a/tests/flamegraph.rs b/tests/flamegraph.rs index 9ce8ae77..5ce9a9af 100644 --- a/tests/flamegraph.rs +++ b/tests/flamegraph.rs @@ -883,3 +883,11 @@ fn flamegraph_flamechart() { test_flamegraph(input_file, expected_result_file, opts).unwrap(); } + +#[test] +fn flamegraph_austin() { + let input_file = "./tests/data/flamegraph/austin/flames.txt"; + let expected_result_file = "./tests/data/flamegraph/austin/flame.svg"; + let opts = flamegraph::Options::default(); + test_flamegraph(input_file, expected_result_file, opts).unwrap(); +}