Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge profiling feature and document it #23

Open
cdetrio opened this issue Aug 14, 2019 · 0 comments
Open

merge profiling feature and document it #23

cdetrio opened this issue Aug 14, 2019 · 0 comments

Comments

@cdetrio
Copy link

cdetrio commented Aug 14, 2019

The profiling feature is in a branch: https://github.com/ewasm/scout/tree/profiling
And more features in a different branch: https://github.com/s1na/wasmi/tree/profile-invocations

Here's a script to format the profile output:

import sys
import re

profile_func_names = {}

for line in sys.stdin:
    func_names = re.match('^(\d+): (\S+)\n', line)
    func_times = re.match('^Function (\d+) took', line)
    if func_names:
        func_index = func_names.group(1)
        profile_func_names[func_index] = func_names.group(2)
    elif func_times:
        func_index = func_times.group(1)
        func_time_with_func_name = "{} {}".format(line.rstrip('\n'), profile_func_names[func_index])
        print(func_time_with_func_name)
    else:
        print(line.rstrip('\n'))

The output looks like this:

$ ./target/release/phase2-scout smptbvas.yaml | python scout_profile_parser.py
Process yaml!
blockdatasize 1612
blockdatacopy to 11520 from 0 for 1612 bytes
savepoststateroot from 13059
Total time taken 65612us
Function 35 took 40143us (61%) ethash_keccakf1600
Function 3 took 5246us (7%) ~lib/rt/stub/__alloc
Function 8 took 3024us (4%) ~lib/memory/memory.copy
Function 19 took 2629us (4%) ~lib/typedarray/Uint8Array#subarray
Function 25 took 2604us (3%) rlp/_decode
Function 14 took 1644us (2%) ~lib/array/ensureSize
Function 4 took 1313us (2%) ~lib/memory/memory.fill
Function 36 took 1180us (1%) keccak/ethash_keccak256
Function 12 took 936us (1%) ~lib/typedarray/Uint8Array#__get
Function 24 took 923us (1%) ~lib/array/Array<rlp/RLPData>#push
Function 17 took 915us (1%) rlp/Decoded#constructor
Function 13 took 872us (1%) ~lib/rt/stub/__realloc
Function 18 took 848us (1%) rlp/RLPData#constructor
Function 15 took 568us (0%) ~lib/array/Array<u8>#__set
Function 16 took 464us (0%) main/uintArrToNibbleArr
Function 20 took 410us (0%) ~lib/arraybuffer/ArrayBufferView#constructor
Function 37 took 394us (0%) f2_ethash_keccak
Function 32 took 370us (0%) main/verifyProof
Function 31 took 221us (0%) main/matchingNibbleLength
Function 28 took 217us (0%) ~lib/typedarray/Uint64Array#__get
Function 27 took 192us (0%) ~lib/array/Array<rlp/RLPData>#__get
Function 9 took 157us (0%) ~lib/rt/__allocArray
Function 7 took 83us (0%) ~lib/typedarray/Uint64Array.wrap
Function 30 took 60us (0%) ~lib/array/Array<u8>#slice
Function 26 took 39us (0%) rlp/decode
Function 29 took 35us (0%) main/getNodeType
Function 6 took 29us (0%) ~lib/arraybuffer/ArrayBuffer#get:byteLength
Function 21 took 24us (0%) ~lib/dataview/DataView#constructor
Function 22 took 22us (0%) ~lib/arraybuffer/ArrayBufferView#get:byteOffset
Function 33 took 18us (0%) main/main
Function 10 took 14us (0%) ~lib/array/Array.create<u8>
Function 11 took 1us (0%) ~lib/typedarray/Uint8Array.wrap
Function 5 took 1us (0%) ~lib/arraybuffer/ArrayBuffer#constructor
Function 23 took 1us (0%) ~lib/dataview/DataView#getUint16
Result: Some(I32(13059))
Execution finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant