MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / test_parse_perf_script

Function test_parse_perf_script

src/commands/hot_blocks.rs:992–1012  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

990
991 #[test]
992 fn test_parse_perf_script() {
993 let input = "\
994 7f0001001000 wasm[0]::function[3]+0x0 (/tmp/perf-1234.map)
995 7f0001001005 wasm[0]::function[3]+0x5 (/tmp/perf-1234.map)
996 7f0001001000 wasm[0]::function[3]+0x0 (/tmp/perf-1234.map)
997 7f0001002000 some_native_func+0x10 (/usr/bin/wasmtime)
998 7f0001001010 wasm[0]::function[5]+0x10 (/tmp/perf-1234.map)
999";
1000 let (samples, total) = parse_perf_script(input);
1001 // The native func line is filtered out (not a .map DSO).
1002 assert_eq!(samples.len(), 4);
1003 assert_eq!(total, 5);
1004 assert_eq!(samples[0].symbol, "wasm[0]::function[3]");
1005 assert_eq!(samples[0].offset, 0);
1006 assert_eq!(samples[1].symbol, "wasm[0]::function[3]");
1007 assert_eq!(samples[1].offset, 5);
1008 assert_eq!(samples[2].symbol, "wasm[0]::function[3]");
1009 assert_eq!(samples[2].offset, 0);
1010 assert_eq!(samples[3].symbol, "wasm[0]::function[5]");
1011 assert_eq!(samples[3].offset, 0x10);
1012 }
1013
1014 #[test]
1015 fn test_read_clif_file() {

Callers

nothing calls this directly

Calls 1

parse_perf_scriptFunction · 0.85

Tested by

no test coverage detected