How to profile fusepy operations

I am writing a FUSE file system using the fusepy ctypes library ( https://github.com/terencehonles/fusepy ) for Python. Is there a way to profile fuse operations? When I try to start a FUSE instance using cProfile, I get unsuitable output:

924 function calls (911 primitive calls) in 5.575 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 5.575 5.575 <string>:1(<module>) 7 0.000 0.000 0.000 0.000 __init__.py:1209(debug) 2 0.000 0.000 0.000 0.000 __init__.py:1221(info) 9 0.000 0.000 0.000 0.000 __init__.py:1452(getEffectiveLevel) 9 0.000 0.000 0.000 0.000 __init__.py:1466(isEnabledFor) 1 0.000 0.000 0.000 0.000 __init__.py:239(load) 1 0.000 0.000 0.000 0.000 __init__.py:267(loads) 1 0.000 0.000 0.000 0.000 __init__.py:363(__getattr__) 1 0.000 0.000 0.000 0.000 __init__.py:370(__getitem__) 1 0.000 0.000 0.000 0.000 __init__.py:372(maketree) 1 0.000 0.000 5.573 5.573 __init__.py:384(mount) 1 0.000 0.000 0.000 0.000 __init__.py:388(_maketree) 2 0.000 0.000 0.000 0.000 __init__.py:42(normalize_encoding) 8 0.000 0.000 0.000 0.000 abc.py:377(get) 1 0.000 0.000 0.000 0.000 argparse.py:1184(__init__) 3 0.000 0.000 0.000 0.000 argparse.py:1200(__init__) 34 0.000 0.000 0.000 0.000 argparse.py:1252(register) 3 0.000 0.000 0.000 0.000 argparse.py:1256(_registry_get) 1 0.000 0.000 0.000 0.000 argparse.py:1281(add_argument) 2 0.000 0.000 0.000 0.000 argparse.py:1328(add_argument_group) 1 0.000 0.000 0.000 0.000 argparse.py:1338(_add_action) 1 0.000 0.000 0.000 0.000 argparse.py:1402(_get_positional_kwargs) 1 0.000 0.000 0.000 0.000 argparse.py:1454(_pop_action_class) 3 0.000 0.000 0.000 0.000 argparse.py:1458(_get_handler) 1 0.000 0.000 0.000 0.000 argparse.py:1467(_check_conflict) 2 0.000 0.000 0.000 0.000 argparse.py:1507(__init__) 1 0.000 0.000 0.000 0.000 argparse.py:151(__init__) 1 0.000 0.000 0.000 0.000 argparse.py:1529(_add_action) 1 0.000 0.000 0.001 0.001 argparse.py:1577(__init__) 1 0.000 0.000 0.000 0.000 argparse.py:1613(identity) 1 0.000 0.000 0.000 0.000 argparse.py:1684(_add_action) 1 0.000 0.000 0.000 0.000 argparse.py:1696(_get_positional_actions) 1 0.000 0.000 0.000 0.000 argparse.py:1697(<listcomp>) 1 0.000 0.000 0.000 0.000 argparse.py:1704(parse_args) 1 0.000 0.000 0.000 0.000 argparse.py:1711(parse_known_args) 1 0.000 0.000 0.000 0.000 argparse.py:1749(_parse_known_args) 1 0.000 0.000 0.000 0.000 argparse.py:1796(take_action) 1 0.000 0.000 0.000 0.000 argparse.py:1894(consume_positionals) 1 0.000 0.000 0.000 0.000 argparse.py:194(__init__) 1 0.000 0.000 0.000 0.000 argparse.py:1955(<listcomp>) 1 0.000 0.000 0.000 0.000 argparse.py:2032(_match_arguments_partial) 1 0.000 0.000 0.000 0.000 argparse.py:2038(<listcomp>) 1 0.000 0.000 0.000 0.000 argparse.py:2042(<listcomp>) 1 0.000 0.000 0.000 0.000 argparse.py:2048(_parse_optional) 1 0.000 0.000 0.000 0.000 argparse.py:2150(_get_nargs_pattern) 1 0.000 0.000 0.000 0.000 argparse.py:2194(_get_values) 1 0.000 0.000 0.000 0.000 argparse.py:2246(_get_value) 1 0.000 0.000 0.000 0.000 argparse.py:2272(_check_value) 1 0.000 0.000 0.000 0.000 argparse.py:2312(_get_formatter) 1 0.000 0.000 0.000 0.000 argparse.py:554(_metavar_formatter) 1 0.000 0.000 0.000 0.000 argparse.py:563(format) 1 0.000 0.000 0.000 0.000 argparse.py:570(_format_args) 1 0.000 0.000 0.000 0.000 argparse.py:784(__init__) 1 0.000 0.000 0.000 0.000 argparse.py:826(__init__) 1 0.000 0.000 0.000 0.000 argparse.py:855(__call__) 1 0.000 0.000 0.000 0.000 codecs.py:238(__init__) 1 0.000 0.000 0.000 0.000 codecs.py:287(__init__) 1 0.000 0.000 0.000 0.000 codecs.py:297(decode) 1 0.000 0.000 5.574 5.574 commands.py:159(mount) 1 0.000 0.000 0.000 0.000 decoder.py:347(decode) 1 0.000 0.000 0.000 0.000 decoder.py:358(raw_decode) 6 0.000 0.000 0.000 0.000 functools.py:148(__init__) 8 0.000 0.000 0.000 0.000 functools.py:152(__hash__) 12 0.000 0.000 0.000 0.000 functools.py:155(_make_key) 18 0.000 0.000 0.000 0.000 functools.py:167(<genexpr>) 12/10 0.000 0.000 0.000 0.000 functools.py:241(wrapper) 1 5.573 5.573 5.573 5.573 fuse.py:334(__init__) 1 0.000 0.000 0.000 0.000 fuse.py:357(<listcomp>) 3 0.000 0.000 0.000 0.000 fuse.py:377(_normalize_fuse_options) 1 0.000 0.000 0.000 0.000 fuse.py:385(_wrapper) 1 0.000 0.000 0.000 0.000 fuse.py:603(destroy) 1 0.000 0.000 0.000 0.000 fuse.py:699(destroy) 1 0.000 0.000 0.000 0.000 fuse.py:823(__call__) 9 0.000 0.000 0.000 0.000 genericpath.py:15(exists) 4 0.000 0.000 0.000 0.000 gettext.py:111(_expand_lang) 2 0.000 0.000 0.000 0.000 gettext.py:353(find) 2 0.000 0.000 0.000 0.000 gettext.py:393(translation) 2 0.000 0.000 0.000 0.000 gettext.py:459(dgettext) 2 0.000 0.000 0.000 0.000 gettext.py:497(gettext) 4 0.000 0.000 0.000 0.000 locale.py:339(normalize) 1 0.000 0.000 0.000 0.000 locale.py:574(getpreferredencoding) 1 0.000 0.000 0.000 0.000 mount.py:34(__init__) 1 0.000 0.000 5.573 5.573 mount.py:419(mount) 9 0.000 0.000 0.000 0.000 os.py:668(__getitem__) 9 0.000 0.000 0.000 0.000 os.py:734(encode) 2 0.000 0.000 0.000 0.000 os.py:738(decode) 1 0.000 0.000 0.000 0.000 path.py:16(rootdir) 1 0.000 0.000 0.000 0.000 path.py:22(fuserootdir) 1 0.000 0.000 0.000 0.000 path.py:40(treefile) 1 0.000 0.000 0.000 0.000 path.py:46(ctreefile) 12 0.000 0.000 0.000 0.000 posixpath.py:38(_get_sep) 12 0.000 0.000 0.000 0.000 posixpath.py:71(join) 1 0.000 0.000 0.000 0.000 re.py:153(match) 5 0.000 0.000 0.000 0.000 re.py:212(compile) 1 0.000 0.000 0.000 0.000 re.py:264(_compile) 4/1 0.000 0.000 0.000 0.000 sre_compile.py:32(_compile) 2 0.000 0.000 0.000 0.000 sre_compile.py:357(_simple) 1 0.000 0.000 0.000 0.000 sre_compile.py:364(_compile_info) 2 0.000 0.000 0.000 0.000 sre_compile.py:470(isstring) 1 0.000 0.000 0.000 0.000 sre_compile.py:473(_code) 1 0.000 0.000 0.000 0.000 sre_compile.py:488(compile) 8 0.000 0.000 0.000 0.000 sre_parse.py:127(__len__) 17 0.000 0.000 0.000 0.000 sre_parse.py:131(__getitem__) 2 0.000 0.000 0.000 0.000 sre_parse.py:135(__setitem__) 4 0.000 0.000 0.000 0.000 sre_parse.py:139(append) 6/3 0.000 0.000 0.000 0.000 sre_parse.py:141(getwidth) 1 0.000 0.000 0.000 0.000 sre_parse.py:179(__init__) 10 0.000 0.000 0.000 0.000 sre_parse.py:184(__next) 7 0.000 0.000 0.000 0.000 sre_parse.py:203(match) 8 0.000 0.000 0.000 0.000 sre_parse.py:209(get) 2/1 0.000 0.000 0.000 0.000 sre_parse.py:340(_parse_sub) 2/1 0.000 0.000 0.000 0.000 sre_parse.py:418(_parse) 1 0.000 0.000 0.000 0.000 sre_parse.py:68(__init__) 1 0.000 0.000 0.000 0.000 sre_parse.py:702(fix_flags) 1 0.000 0.000 0.000 0.000 sre_parse.py:714(parse) 1 0.000 0.000 0.000 0.000 sre_parse.py:73(opengroup) 1 0.000 0.000 0.000 0.000 sre_parse.py:84(closegroup) 4 0.000 0.000 0.000 0.000 sre_parse.py:91(__init__) 1 0.000 0.000 0.000 0.000 tree.py:125(__init__) 1 0.000 0.000 0.000 0.000 tree.py:131(__iter__) 1 0.000 0.000 0.000 0.000 tree.py:145(files) 2 0.000 0.000 0.000 0.000 tree.py:57(__init__) 1 0.000 0.000 0.000 0.000 tree.py:70(__iter__) 2 0.000 0.000 0.000 0.000 tree.py:76(__setitem__) 1 0.000 0.000 0.000 0.000 tree.py:95(__init__) 3 0.000 0.000 0.000 0.000 {built-in method callable} 1 0.000 0.000 0.000 0.000 {built-in method compile} 1 0.000 0.000 5.575 5.575 {built-in method exec} 69 0.000 0.000 0.000 0.000 {built-in method getattr} 2 0.000 0.000 0.000 0.000 {built-in method getgid} 2 0.000 0.000 0.000 0.000 {built-in method getuid} 3 0.000 0.000 0.000 0.000 {built-in method hasattr} 6 0.000 0.000 0.000 0.000 {built-in method hash} 51 0.000 0.000 0.000 0.000 {built-in method isinstance} 3 0.000 0.000 0.000 0.000 {built-in method iter} 50/47 0.000 0.000 0.000 0.000 {built-in method len} 1 0.000 0.000 0.000 0.000 {built-in method listdir} 8 0.000 0.000 0.000 0.000 {built-in method min} 1 0.000 0.000 0.000 0.000 {built-in method nl_langinfo} 1 0.000 0.000 0.000 0.000 {built-in method open} 3 0.000 0.000 0.000 0.000 {built-in method ord} 1 0.000 0.000 0.000 0.000 {built-in method pointer} 2 0.000 0.000 0.000 0.000 {built-in method repr} 31 0.000 0.000 0.000 0.000 {built-in method setattr} 2 0.000 0.000 0.000 0.000 {built-in method signal} 1 0.000 0.000 0.000 0.000 {built-in method sizeof} 9 0.000 0.000 0.000 0.000 {built-in method stat} 2 0.000 0.000 0.000 0.000 {built-in method time} 1 0.000 0.000 0.000 0.000 {built-in method utf_8_decode} 2 0.000 0.000 0.000 0.000 {method 'add' of 'set' objects} 74 0.000 0.000 0.000 0.000 {method 'append' of 'list' objects} 2 0.000 0.000 0.000 0.000 {method 'decode' of 'bytes' objects} 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} 14 0.000 0.000 0.000 0.000 {method 'encode' of 'str' objects} 2 0.000 0.000 0.000 0.000 {method 'end' of '_sre.SRE_Match' objects} 27 0.000 0.000 0.000 0.000 {method 'endswith' of 'str' objects} 3 0.000 0.000 0.000 0.000 {method 'extend' of 'list' objects} 12 0.000 0.000 0.000 0.000 {method 'find' of 'str' objects} 34 0.000 0.000 0.000 0.000 {method 'get' of 'dict' objects} 1 0.000 0.000 0.000 0.000 {method 'groups' of '_sre.SRE_Match' objects} 10 0.000 0.000 0.000 0.000 {method 'isalnum' of 'str' objects} 2 0.000 0.000 0.000 0.000 {method 'items' of 'dict' objects} 5 0.000 0.000 0.000 0.000 {method 'join' of 'str' objects} 4 0.000 0.000 0.000 0.000 {method 'lower' of 'str' objects} 1 0.000 0.000 0.000 0.000 {method 'lstrip' of 'str' objects} 3 0.000 0.000 0.000 0.000 {method 'match' of '_sre.SRE_Pattern' objects} 4 0.000 0.000 0.000 0.000 {method 'pop' of 'dict' objects} 1 0.000 0.000 0.000 0.000 {method 'read' of '_io.TextIOWrapper' objects} 2 0.000 0.000 0.000 0.000 {method 'remove' of 'list' objects} 8 0.000 0.000 0.000 0.000 {method 'replace' of 'str' objects} 4 0.000 0.000 0.000 0.000 {method 'reverse' of 'list' objects} 41 0.000 0.000 0.000 0.000 {method 'setdefault' of 'dict' objects} 7 0.000 0.000 0.000 0.000 {method 'split' of 'str' objects} 29 0.000 0.000 0.000 0.000 {method 'startswith' of 'str' objects} 

cProfile only fuse.py profiles in general, and not counting FUSE operations individually. Is there a way to profile FUSE operations?

+4
source share

All Articles