Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

CPU performance optimalization #41

Closed
ad-m opened this issue Apr 18, 2017 · 7 comments
Closed

CPU performance optimalization #41

ad-m opened this issue Apr 18, 2017 · 7 comments

Comments

@ad-m
Copy link
Contributor

ad-m commented Apr 18, 2017

Hello,

When application started there is 100% CPU usage, so the indexing speed is CPU-limited mostly, so if we want more effective software we need start optimising of CPU usage.

I know the software author knows that limitation, but I would like starts public discussion about possible optimisation.

Here is some logs of cProfile:

Mon Apr 17 20:34:07 2017    logi.txt

         49626068 function calls (49625636 primitive calls) in 331.942 seconds

   Random listing order was used

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
       27    0.000    0.000    0.000    0.000 {method '__contains__' of 'frozenset' objects}
       74    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:423(_get_type_vars)
        3    0.000    0.000    0.001    0.000 /usr/lib/python3.5/argparse.py:1227(__init__)
        5    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:292(_check_tzinfo_arg)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1074(PlaceHolder)
        5    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:264(_check_date_fields)
       11    0.001    0.000    0.001    0.000 {built-in method _hashlib.openssl_sha1}
       94    0.002    0.000    0.002    0.000 /usr/lib/python3.5/typing.py:996(<genexpr>)
      306    0.001    0.000    0.055    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:143(__on_message)
        1    0.000    0.000    0.037    0.037 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:15(<module>)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1481(_pop_action_class)
        3    0.000    0.000    0.001    0.000 /usr/lib/python3.5/gettext.py:490(dgettext)
      226    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:78(<genexpr>)
     8779    0.099    0.000    1.251    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:153(__on_GET_PEERS_query)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:539(_BaseAddress)
       14    0.001    0.000    0.003    0.000 /usr/lib/python3.5/logging/__init__.py:243(__init__)
      498    0.001    0.000    0.001    0.000 /usr/lib/python3.5/typing.py:867(_gorg)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1239(__init__)
       14    0.000    0.000    0.002    0.000 /usr/lib/python3.5/logging/__init__.py:968(emit)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:205(_BaseSelectorImpl)
     39/1    0.001    0.000    0.132    0.132 <frozen importlib._bootstrap>:966(_find_and_load)
       79    0.001    0.000    0.002    0.000 /usr/lib/python3.5/typing.py:890(_next_in_mro)
       10    0.000    0.000    0.009    0.001 /usr/lib/python3.5/sre_compile.py:531(compile)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/weakref.py:261(update)
       44    0.000    0.000    0.000    0.000 /usr/lib/python3.5/posixpath.py:39(_get_sep)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:82(EnumMeta)
   436511    2.591    0.000    2.591    0.000 {method 'recvfrom_into' of '_socket.socket' objects}
       14    0.002    0.000    0.002    0.000 /usr/lib/python3.5/logging/__init__.py:1347(findCaller)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1463(Sequence)
       30    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap_external>:1210(_get_spec)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:40(_EnumDict)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:94(acquire)
        3    0.000    0.000    0.001    0.000 /usr/lib/python3.5/gettext.py:369(find)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:988(FileHandler)
       28    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:799(acquire)
       27    0.001    0.000    0.002    0.000 <frozen importlib._bootstrap_external>:816(get_data)
  2580369   53.745    0.000   53.745    0.000 {method 'sendto' of '_socket.socket' objects}
       19    0.000    0.000    0.001    0.000 /usr/lib/python3.5/ipaddress.py:1459(__init__)
        1    0.000    0.000    0.000    0.000 <string>:1(<module>)
        4    0.000    0.000    0.000    0.000 {method 'match' of '_sre.SRE_Pattern' objects}
        2    0.000    0.000    0.000    0.000 {built-in method math.log}
        1    0.000    0.000    0.003    0.003 /usr/lib/python3.5/selectors.py:5(<module>)
       39    0.000    0.000    0.000    0.000 {method 'register' of 'select.epoll' objects}
       30    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:789(find_spec)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:427(has_location)
        3    0.000    0.000    0.000    0.000 {method 'sub' of '_sre.SRE_Pattern' objects}
   386273    6.385    0.000   60.691    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:92(on_sendable)
       11    0.001    0.000    0.010    0.001 /usr/lib/python3.5/logging/__init__.py:1830(info)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1468(MutableSequence)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1515(isEnabledFor)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:99(<dictcomp>)
        9    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:436(spec_from_loader)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/string.py:174(Formatter)
        9    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:235(_requires_builtin_wrapper)
       23    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bencode.py:55(loads2)
        6    0.000    0.000    0.000    0.000 {method 'reverse' of 'list' objects}
        1    0.000    0.000    0.000    0.000 {built-in method _hashlib.openssl_sha256}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/re.py:160(match)
       14    0.000    0.000    0.001    0.000 /usr/lib/python3.5/logging/__init__.py:487(formatTime)
        1    0.000    0.000    0.000    0.000 {method 'hex' of 'bytes' objects}
        1    0.000    0.000    0.000    0.000 {built-in method math.exp}
        2    0.000    0.000    0.000    0.000 {method 'acquire' of '_thread.lock' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:762(CallableMeta)
        1    0.000    0.000    0.000    0.000 {method 'fetchall' of 'sqlite3.Cursor' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:718(BrokenBarrierError)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1055(_SubParsersAction)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/random.py:68(Random)
        2    0.000    0.000    0.000    0.000 {method 'cursor' of 'sqlite3.Connection' objects}
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_compile.py:386(_simple)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/tokenize.py:112(any)
        1    0.000    0.000    0.001    0.001 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:15(<module>)
       43    0.002    0.000    0.020    0.000 /usr/lib/python3.5/typing.py:989(__getitem__)
   883249    0.395    0.000    0.395    0.000 {method 'get' of 'dict' objects}
       24    0.000    0.000    0.000    0.000 {method 'extend' of 'list' objects}
        2    0.005    0.002    0.005    0.002 {method 'executemany' of 'sqlite3.Cursor' objects}
       11    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:416(<genexpr>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:661(TupleMeta)
        1    0.000    0.000    0.000    0.000 {method 'union' of 'set' objects}
   107/67    0.000    0.000    0.001    0.000 /usr/lib/python3.5/typing.py:276(_get_type_vars)
       20    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_compile.py:513(isstring)
      107    0.000    0.000    0.000    0.000 {built-in method _thread.get_ident}
        2    0.000    0.000    0.001    0.000 /usr/lib/python3.5/argparse.py:2353(_get_formatter)
       17    0.000    0.000    0.000    0.000 /usr/lib/python3.5/os.py:796(encode)
       14    0.000    0.000    0.002    0.000 /usr/lib/python3.5/logging/__init__.py:842(handle)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1445(MutableSet)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1714(_add_action)
       23    0.002    0.000    0.051    0.002 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:221(__on_ext_message)
   608991    0.554    0.000    1.449    0.000 /usr/lib/python3.5/selectors.py:68(__getitem__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:891(_set_tstate_lock)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1485(_get_handler)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:752(Handler)
        4    0.000    0.000    0.000    0.000 {built-in method builtins.callable}
        1    0.000    0.000    0.001    0.001 /usr/lib/python3.5/ipaddress.py:2264(_IPv6Constants)
       30    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap_external>:342(_get_cached)
        3    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:1047(_path_hooks)
        6    0.001    0.000    0.001    0.000 {method 'execute' of 'sqlite3.Connection' objects}
       24    0.000    0.000    0.001    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:256(__request_metadata_piece)
        1    0.000    0.000    0.006    0.006 /usr/lib/python3.5/traceback.py:1(<module>)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:159(__init__)
       34    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1279(register)
       10    0.000    0.000    0.000    0.000 {built-in method builtins.globals}
       27    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:710(<genexpr>)
       32    0.000    0.000    0.000    0.000 /usr/lib/python3.5/abc.py:9(abstractmethod)
        1    0.000    0.000    0.010    0.010 /usr/lib/python3.5/sqlite3/dbapi2.py:23(<module>)
        8    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:312(_class_escape)
       58    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:16(_is_dunder)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sqlite3/dbapi2.py:50(<listcomp>)
        1    0.000    0.000    0.005    0.005 /usr/lib/python3.5/string.py:15(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1251(setLevel)
       14    0.000    0.000    0.001    0.000 /usr/lib/python3.5/logging/__init__.py:819(format)
      187    0.000    0.000    0.000    0.000 {method 'add' of 'set' objects}
     8779    0.053    0.000    0.081    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:257(__calculate_token)
        1    0.005    0.005    0.005    0.005 /usr/lib/python3.5/datetime.py:641(date)
        4    0.000    0.000    0.001    0.000 /usr/lib/python3.5/typing.py:543(__getitem__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1322(_Protocol)
       15    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_weakrefset.py:52(_commit_removals)
        5    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:92(_path_isdir)
       14    0.000    0.000    0.009    0.001 /usr/lib/python3.5/logging/__init__.py:1392(_log)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:162(_eval_type)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:644(__new__)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/abc.py:151(register)
       26    0.000    0.000    0.000    0.000 /usr/lib/python3.5/posixpath.py:71(join)
        1    0.000    0.000    0.003    0.003 /usr/lib/python3.5/argparse.py:1605(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:598(_BaseNetwork)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1586(ArgumentParser)
   366725    5.364    0.000    9.885    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:253(<listcomp>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1366(Iterator)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/token.py:1(<module>)
      156    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:324(<genexpr>)
      450    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:366(_verbose_message)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:675(__init__)
   179551    0.027    0.000    0.027    0.000 {method 'fileno' of '_socket.socket' objects}
      136    0.000    0.000    0.000    0.000 {method 'issuperset' of 'frozenset' objects}
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/locale.py:341(_replace_encoding)
       10    0.002    0.000    0.045    0.004 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:65(add_metadata)
       55    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:24(_is_sunder)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:715(__eq__)
        1    0.000    0.000    0.000    0.000 {built-in method sys.exit}
     1629    0.002    0.000    0.002    0.000 {built-in method builtins.getattr}
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:134(shutdown)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1378(SupportsFloat)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:88(TypingMeta)
       22    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:999(<genexpr>)
       15    0.000    0.000    0.000    0.000 {method '__subclasses__' of 'type' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/socket.py:123(socket)
       37    0.000    0.000    0.000    0.000 {method 'items' of 'collections.OrderedDict' objects}
      226    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:79(<genexpr>)
       37    0.000    0.000    0.000    0.000 {method 'shutdown' of '_socket.socket' objects}
       63    0.000    0.000    0.000    0.000 {method 'get' of 'mappingproxy' objects}
       28    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_weakrefset.py:58(__iter__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:141(__new__)
       27    0.000    0.000    0.000    0.000 /usr/lib/python3.5/collections/__init__.py:419(<genexpr>)
        1    3.035    3.035  331.744  331.744 /home/adas/.local/lib/python3.5/site-packages/magneticod/__main__.py:135(loop)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:834(_StoreAction)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:264(SplitResultBytes)
      476    0.001    0.000    0.003    0.000 <frozen importlib._bootstrap_external>:50(_path_join)
        1    0.000    0.000    0.017    0.017 /usr/lib/python3.5/hashlib.py:53(<module>)
       27    0.002    0.000    0.003    0.000 /usr/lib/python3.5/selectors.py:414(unregister)
     8779    0.012    0.000    0.012    0.000 {built-in method zlib.adler32}
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:419(parent)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/functools.py:192(total_ordering)
    25/11    0.001    0.000    0.003    0.000 /usr/lib/python3.5/sre_parse.py:491(_parse)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:211(_acquireLock)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1283(_registry_get)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:714(ArgumentError)
       10    0.000    0.000    0.000    0.000 {built-in method _sre.compile}
      108    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:109(__init__)
        1    0.000    0.000    0.000    0.000 {built-in method from_iterable}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:250(ParseResult)
     8779    0.015    0.000    0.015    0.000 {built-in method _socket.inet_aton}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1362(IPv4Interface)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1012(__init__)
   419539    4.004    0.000    4.004    0.000 {method 'tobytes' of 'array.array' objects}
        4    0.001    0.000    0.002    0.001 /usr/lib/python3.5/enum.py:88(__new__)
        3    0.000    0.000    0.000    0.000 {built-in method builtins.eval}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:743(Action)
        3    0.000    0.000    0.017    0.006 <frozen importlib._bootstrap_external>:903(create_module)
       15    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_weakrefset.py:26(__exit__)
       57    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap_external>:78(_path_is_mode_type)
       51    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:103(<genexpr>)
        2    0.000    0.000    0.001    0.001 /usr/lib/python3.5/re.py:175(sub)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:117(_ResultMixinStr)
       67    0.000    0.000    0.001    0.000 /usr/lib/python3.5/typing.py:282(_type_vars)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:85(_RLock)
        7    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:78(opengroup)
       33    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
     15/4    0.001    0.000    0.001    0.000 /usr/lib/python3.5/abc.py:194(__subclasscheck__)
       14    0.000    0.000    0.003    0.000 /usr/lib/python3.5/logging/__init__.py:1471(callHandlers)
       13    0.000    0.000    0.000    0.000 {method 'lower' of 'str' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:664(ArgumentDefaultsHelpFormatter)
        1    0.000    0.000    0.000    0.000 {function Random.seed at 0x7fbe9774a840}
       16    0.000    0.000    0.000    0.000 {method 'remove' of 'list' objects}
       37    0.001    0.000    0.002    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:270(shutdown)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/string.py:55(_TemplateMetaclass)
       38    0.000    0.000    0.000    0.000 {method 'setblocking' of '_socket.socket' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1116(Manager)
        1    0.000    0.000    0.001    0.001 /usr/lib/python3.5/enum.py:1(<module>)
       39    0.000    0.000    0.000    0.000 {method 'pop' of 'dict' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:245(SplitResult)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:653(RawTextHelpFormatter)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1043(__subclasscheck__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:591(BufferingFormatter)
      207    0.000    0.000    0.000    0.000 {method 'items' of 'dict' objects}
       86    0.004    0.000    0.018    0.000 /usr/lib/python3.5/abc.py:132(__new__)
        1    0.000    0.000    0.001    0.001 /usr/lib/python3.5/argparse.py:153(HelpFormatter)
        1    0.000    0.000    0.004    0.004 /usr/lib/python3.5/ipaddress.py:9(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:485(Event)
        1    0.000    0.000    0.000    0.000 <string>:5(ParseResult)
       10    0.000    0.000    0.001    0.000 /usr/lib/python3.5/abc.py:178(__instancecheck__)
      168    0.000    0.000    0.000    0.000 {built-in method _sre.getlower}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:681(MetavarTypeHelpFormatter)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_compile.py:391(_generate_overlap_table)
       27    0.001    0.000    0.001    0.000 {method 'read' of '_io.FileIO' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1342(Awaitable)
        1    0.000    0.000    0.000    0.000 {method 'findall' of '_sre.SRE_Pattern' objects}
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:1838(_create)
       54    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap_external>:56(_path_split)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1402(SupportsAbs)
        6    0.000    0.000    0.000    0.000 /usr/lib/python3.5/hashlib.py:98(__get_openssl_constructor)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1353(AsyncIterator)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:935(tzinfo)
    43259    0.021    0.000    0.022    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:131(on_sendable)
       55    0.000    0.000    0.000    0.000 {method 'find' of 'bytearray' objects}
   386286    0.155    0.000    0.155    0.000 {built-in method math.ceil}
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1494(_check_conflict)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:2056(IPv6Interface)
      526    0.001    0.000    0.001    0.000 {built-in method builtins.hasattr}
       25    0.000    0.000    0.000    0.000 /usr/lib/python3.5/genericpath.py:16(exists)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1741(parse_known_args)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:1030(__new__)
     39/1    0.000    0.000    0.131    0.131 <frozen importlib._bootstrap>:939(_find_and_load_unlocked)
        1    0.000    0.000    0.005    0.005 /usr/lib/python3.5/tokenize.py:21(<module>)
        5    0.000    0.000    0.001    0.000 /usr/lib/python3.5/typing.py:470(__new__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:62(__init__)
        5    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:45(_days_in_month)
       27    0.000    0.000    0.001    0.000 /usr/lib/python3.5/selectors.py:246(unregister)
       25    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:433(_ip_int_from_prefix)
       44    0.001    0.000    0.001    0.000 {method 'send' of '_socket.socket' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1548(Dict)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:532(_get_type_vars)
       99    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:852(__enter__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1121(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1921(consume_positionals)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:565(_metavar_formatter)
       35    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_weakrefset.py:70(__contains__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/posixpath.py:221(expanduser)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1029(_VersionAction)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:755(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:670(Filterer)
       27    0.000    0.000    0.011    0.000 <frozen importlib._bootstrap_external>:474(_compile_bytecode)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:1815(timezone)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:467(UnionMeta)
        1    0.000    0.000    0.012    0.012 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:15(<module>)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:205(__init__)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/types.py:120(__init__)
        1    0.000    0.000    0.000    0.000 {method 'upper' of 'str' objects}
       43    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:105(__init__)
       37    0.001    0.000    0.005    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:31(__init__)
       27    0.001    0.000    0.016    0.001 <frozen importlib._bootstrap_external>:729(get_code)
      6/5    0.000    0.000    0.056    0.011 {built-in method builtins.__import__}
       27    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:786(__init__)
       27    0.000    0.000    0.000    0.000 {method 'unregister' of 'select.epoll' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1556(LoggerAdapter)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:633(Filter)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:190(cb)
       15    0.000    0.000    0.004    0.000 /usr/lib/python3.5/sre_compile.py:221(_compile_charset)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/re.py:240(escape)
        9    0.000    0.000    0.001    0.000 /usr/lib/python3.5/typing.py:404(__new__)
        2    0.000    0.000    0.001    0.000 /usr/lib/python3.5/argparse.py:1308(add_argument)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:453(Enum)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:343(PollSelector)
       79    0.002    0.000    0.022    0.000 /usr/lib/python3.5/typing.py:907(__new__)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:716(find_spec)
       40    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:8(_is_descriptor)
       32    0.000    0.000    0.000    0.000 {method 'release' of '_thread.RLock' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_collections_abc.py:599(__contains__)
        9    0.002    0.000    0.002    0.000 {built-in method _imp.create_builtin}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:510(set)
       10    0.000    0.000    0.005    0.001 /usr/lib/python3.5/sre_compile.py:516(_code)
       25    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:476(_prefix_from_prefix_string)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:596(<listcomp>)
       99    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1882(__init__)
      154    0.000    0.000    0.000    0.000 {method 'decode' of 'bytes' objects}
       54    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:45(_r_long)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1902(NullHandler)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1526(KeysView)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/traceback.py:403(TracebackException)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1212(__init__)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:574(format)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1245(IPv4Address)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1876(IPv6Address)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/os.py:44(<listcomp>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1010(_HelpAction)
      661    0.000    0.000    0.000    0.000 {method 'isupper' of 'str' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1410(SupportsRound)
       39    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap>:163(__enter__)
    39/38    0.000    0.000    0.022    0.001 <frozen importlib._bootstrap>:570(module_from_spec)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:963(_AppendConstAction)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/random.py:639(SystemRandom)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:122(_get_type_vars)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:199(_TypeAlias)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:332(notify)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1049(_BaseV4)
       55    0.000    0.000    0.001    0.000 /usr/lib/python3.5/enum.py:51(__setitem__)
       39    0.002    0.000    0.005    0.000 /usr/lib/python3.5/selectors.py:233(register)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:370(PercentStyle)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1365(_add_action)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:321(getMessage)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:382(format)
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/appdirs.py:9(<module>)
       12    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:362(_escape)
        4    0.000    0.000    0.000    0.000 {method 'mro' of 'type' objects}
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/genericpath.py:111(_splitext)
       14    0.000    0.000    0.000    0.000 {built-in method posix.getpid}
       15    0.000    0.000    0.009    0.001 /usr/lib/python3.5/re.py:278(_compile)
      173    0.000    0.000    0.002    0.000 <frozen importlib._bootstrap_external>:68(_path_stat)
        2    0.000    0.000    0.008    0.004 /usr/lib/python3.5/enum.py:532(_convert)
      188    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:550(__int__)
      108    0.001    0.000  222.150    2.057 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:62(on_tick)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/posixpath.py:115(splitext)
      105    0.000    0.000    0.000    0.000 {built-in method builtins.min}
  5193290    4.506    0.000    9.005    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:261(__random_bytes)
    65537    0.022    0.000    0.022    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:45(<genexpr>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:1205(_DummyThread)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:394(EpollSelector)
      108    0.194    0.002    0.194    0.002 {method 'clear' of 'dict' objects}
       47    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:158(_split_optional_netmask)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:182(_checkLevel)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/random.py:84(__init__)
        1    0.000    0.000    0.000    0.000 {built-in method _hashlib.openssl_sha512}
       54    0.000    0.000    0.002    0.000 <frozen importlib._bootstrap_external>:246(cache_from_source)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/token.py:74(<dictcomp>)
       38    0.001    0.000    0.001    0.000 /usr/lib/python3.5/socket.py:399(_real_close)
       10    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:797(fix_flags)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/posixpath.py:99(split)
        2    0.000    0.000    0.001    0.000 /usr/lib/python3.5/logging/__init__.py:1257(debug)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:385(_IPAddressBase)
1720201/1720182    0.374    0.000    0.374    0.000 {built-in method builtins.len}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:869(_StoreConstAction)
        2    0.000    0.000    0.000    0.000 {built-in method builtins.vars}
   386275    1.782    0.000    1.782    0.000 {method 'poll' of 'select.epoll' objects}
       52    0.000    0.000    0.000    0.000 {built-in method builtins.all}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:201(Condition)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/__init__.py:1(<module>)
        1    0.000    0.000    0.029    0.029 /usr/lib/python3.5/typing.py:1(<module>)
   788542    0.463    0.000    1.443    0.000 /usr/lib/python3.5/selectors.py:214(_fileobj_lookup)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1556(DefaultDict)
  5193327    2.175    0.000    2.175    0.000 {method 'getrandbits' of '_random.Random' objects}
        1    0.000    0.000    0.001    0.001 /usr/lib/python3.5/random.py:37(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/tokenize.py:98(TokenInfo)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1734(parse_args)
        3    0.000    0.000    0.001    0.000 /usr/lib/python3.5/gettext.py:424(translation)
       14    0.000    0.000    0.000    0.000 {built-in method time.strftime}
        1    0.000    0.000    0.000    0.000 <string>:5(DefragResult)
       40    0.000    0.000    0.000    0.000 {method 'setdefault' of 'dict' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:853(Callable)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:59(_SelectorMapping)
        1    0.000    0.000    0.000    0.000 <string>:5(SelectorKey)
        9    0.000    0.000    0.000    0.000 {built-in method builtins.round}
      330    0.000    0.000    0.001    0.000 /usr/lib/python3.5/socket.py:76(<lambda>)
       72    0.000    0.000    0.000    0.000 {built-in method builtins.abs}
       84    0.000    0.000    0.001    0.000 /usr/lib/python3.5/typing.py:295(_type_check)
        2    0.000    0.000    0.000    0.000 {built-in method _sqlite3.register_converter}
        2    0.002    0.001    0.004    0.002 /usr/lib/python3.5/enum.py:215(__call__)
        2    0.000    0.000    0.000    0.000 {method 'close' of 'sqlite3.Cursor' objects}
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:372(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/weakref.py:101(__init__)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/functools.py:43(update_wrapper)
     1009    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
        9    0.000    0.000    0.002    0.000 <frozen importlib._bootstrap>:737(create_module)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/socket.py:532(SocketIO)
       25    0.000    0.000    0.000    0.000 {built-in method time.time}
   429535    0.161    0.000    0.161    0.000 /usr/lib/python3.5/selectors.py:275(_key_from_fd)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:532(usesTime)
       27    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:382(_check_name_wrapper)
        7    0.000    0.000    0.000    0.000 {method 'translate' of 'bytearray' objects}
    64/31    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:167(getwidth)
        2    0.000    0.000    0.001    0.000 /usr/lib/python3.5/argparse.py:160(__init__)
        1    0.000    0.000    0.000    0.000 {built-in method _hashlib.openssl_md5}
      108    0.000    0.000    0.019    0.000 /usr/lib/python3.5/typing.py:103(__new__)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:285(__members__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:367(Semaphore)
     39/2    0.001    0.000    0.130    0.065 <frozen importlib._bootstrap>:659(_load_unlocked)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:252(_is_owned)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1450(Mapping)
       28    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:695(filter)
       80    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1125(_parse_octet)
       74    0.000    0.000    0.000    0.000 {built-in method builtins.setattr}
      166    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:417(_check_int_address)
       15    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_weakrefset.py:20(__enter__)
       17    0.000    0.000    0.000    0.000 {method 'encode' of 'str' objects}
        1    0.000    0.000    0.000    0.000 {built-in method _hashlib.openssl_sha224}
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:406(_find_new_)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:119(release)
        9    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:140(<genexpr>)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:74(__init__)
       16    0.000    0.000    0.003    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/__main__.py:128(on_peer_error)
       86    0.001    0.000    0.002    0.000 /usr/lib/python3.5/abc.py:135(<setcomp>)
       37    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:288(__random_bytes)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:742(_addHandlerRef)
        1    0.000    0.000    0.002    0.002 /usr/lib/python3.5/argparse.py:62(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:456(close)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:361(_get_mixins_)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1445(_get_optional_kwargs)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:581(_format_args)
      199    0.002    0.000    0.002    0.000 {built-in method posix.stat}
        3    0.000    0.000    0.000    0.000 {built-in method posix.listdir}
      164    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_compile.py:101(fixup)
        1    0.000    0.000    0.000    0.000 {built-in method builtins.compile}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1787(TextIO)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:1074(name)
        2    0.000    0.000    0.004    0.002 /usr/lib/python3.5/enum.py:547(<dictcomp>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1225(_ActionsContainer)
       47    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:607(__init__)
       13    0.000    0.000    0.001    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:168(__on_bt_handshake)
       14    0.000    0.000    0.001    0.000 /usr/lib/python3.5/logging/__init__.py:554(format)
   386289    0.186    0.000    0.186    0.000 {built-in method builtins.max}
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bencode.py:69(BencodeEncodingError)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1538(ValuesView)
        1    0.000    0.000    0.019    0.019 /usr/lib/python3.5/logging/__init__.py:24(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:2072(_match_arguments_partial)
       29    0.000    0.000    0.000    0.000 /usr/lib/python3.5/posixpath.py:50(normcase)
        9    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:338(__new__)
       68    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1251(__init__)
        7    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:90(closegroup)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/string.py:77(Template)
     57/2    0.000    0.000    0.131    0.065 <frozen importlib._bootstrap>:214(_call_with_frames_removed)
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:99(get_complete_info_hashes)
        1    0.000    0.000    0.003    0.003 /home/adas/.local/lib/python3.5/site-packages/magneticod/bencode.py:31(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:727(__subclasscheck__)
        2    0.000    0.000    0.000    0.000 {built-in method _sqlite3.register_adapter}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1542(RootLogger)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/os.py:814(getenv)
      216    0.013    0.000    0.013    0.000 {built-in method __new__ of type object at 0xa3ddc0}
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:538(formatMessage)
       10    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:664(__new__)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:761(__init__)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:957(flush)
     33/1    0.006    0.000  331.942  331.942 {built-in method builtins.exec}
       99    0.000    0.000    0.000    0.000 {built-in method _imp.acquire_lock}
       27    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:656(create_module)
       15    0.000    0.000    0.000    0.000 {method 'remove' of 'set' objects}
   788542    0.666    0.000    0.980    0.000 /usr/lib/python3.5/selectors.py:20(_fileobj_to_fd)
  2925434    3.143    0.000    3.143    0.000 {built-in method _socket.inet_ntoa}
       37    0.003    0.000    0.014    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/__main__.py:95(on_peer_found)
   386275    1.970    0.000    4.449    0.000 /usr/lib/python3.5/selectors.py:424(select)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:641(OptionalMeta)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:333(AnyMeta)
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        4    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:209(fileno)
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/__init__.py:15(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:926(_AppendAction)
  2605460    0.418    0.000    0.418    0.000 {method 'append' of 'collections.deque' objects}
        9    0.000    0.000    0.001    0.000 /usr/lib/python3.5/typing.py:698(__getitem__)
       20    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1099(_ip_int_from_string)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_compile.py:379(_bytes_to_codes)
        1    0.000    0.000    0.000    0.000 {method 'bind' of '_socket.socket' objects}
       27    0.000    0.000    0.000    0.000 {built-in method _imp._fix_co_filename}
       10    0.000    0.000    0.000    0.000 {built-in method builtins.sum}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:734(ArgumentTypeError)
       55    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:276(tell)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:556(IntEnum)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1050(_StderrHandler)
        6    0.000    0.000    0.000    0.000 /usr/lib/python3.5/gettext.py:113(_expand_lang)
       45    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
        1    0.000    0.000    0.000    0.000 {built-in method _stat.S_ISDIR}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1532(_ArgumentGroup)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1592(_BaseV6)
        5    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:721(__hash__)
  2605497  202.096    0.000  202.096    0.000 {bencoder.bencode}
        3    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:911(exec_module)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1727(<listcomp>)
       69    0.006    0.000    0.066    0.001 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:74(on_receivable)
       15    0.000    0.000    0.000    0.000 {method 'isalnum' of 'str' objects}
       31    0.000    0.000    0.000    0.000 {method 'isidentifier' of 'str' objects}
        1    0.000    0.000    0.000    0.000 {method '__enter__' of '_thread.lock' objects}
       15    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_collections_abc.py:308(__subclasshook__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1511(FrozenSet)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1386(SupportsComplex)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:418(Formatter)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/tokenize.py:219(TokenError)
      157    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:157(__getitem__)
    16972    3.875    0.000   37.960    0.002 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:67(on_receivable)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/encodings/__init__.py:42(normalize_encoding)
      108    0.002    0.000    0.025    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:212(__bootstrap)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:336(__new__)
     27/2    0.000    0.000    0.130    0.065 <frozen importlib._bootstrap_external>:659(exec_module)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1531(ItemsView)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:564(Barrier)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:290(SelectSelector)
       27    0.000    0.000    0.000    0.000 /usr/lib/python3.5/collections/__init__.py:421(<genexpr>)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:1224(current_thread)
      4/3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:671(_get_type_vars)
       10    0.000    0.000    0.000    0.000 {method 'digest' of '_hashlib.HASH' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:237(__enter__)
       24    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:1184(<genexpr>)
      435    0.001    0.000    0.001    0.000 /usr/lib/python3.5/sre_parse.py:226(__next)
       10    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:70(__init__)
       30    0.001    0.000    0.010    0.000 <frozen importlib._bootstrap_external>:1101(_get_spec)
        1    0.000    0.000    0.000    0.000 <string>:5(SplitResult)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/traceback.py:223(FrameSummary)
      107    0.000    0.000    0.000    0.000 {method 'endswith' of 'str' objects}
        1    0.000    0.000    0.005    0.005 /usr/lib/python3.5/linecache.py:6(<module>)
      361    0.000    0.000    0.001    0.000 /usr/lib/python3.5/sre_parse.py:247(get)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1501(getEffectiveLevel)
   386383    0.181    0.000    0.181    0.000 {built-in method time.monotonic}
       38    0.001    0.000    0.001    0.000 /usr/lib/python3.5/socket.py:129(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:1311(datetime)
      138    0.000    0.000    0.000    0.000 {built-in method _imp.release_lock}
        4    0.000    0.000    0.000    0.000 {method 'tolist' of 'memoryview' objects}
       11    0.001    0.000    0.009    0.001 /usr/lib/python3.5/logging/__init__.py:1269(info)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:118(_AttributeHolder)
       17    0.000    0.000    0.000    0.000 /usr/lib/python3.5/os.py:720(__getitem__)
      112    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap_external>:1064(_path_importer_cache)
        3    0.000    0.000    0.000    0.000 {method 'index' of 'str' objects}
        1    0.000    0.000    0.013    0.013 /usr/lib/python3.5/socket.py:47(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/tokenize.py:224(Untokenizer)
       89    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:914(<genexpr>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:355(notify_all)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1394(SupportsBytes)
        1    0.000    0.000    0.000    0.000 {built-in method builtins.dir}
   179547    0.113    0.000    0.141    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:285(fileno)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:19(AddressValueError)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:860(setFormatter)
       39    0.002    0.000    0.002    0.000 <string>:12(__new__)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:47(__init__)
   419561    0.638    0.000   10.046    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bencode.py:48(loads)
        1    0.000    0.000    0.000    0.000 {built-in method _thread._set_sentinel}
       39    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap>:176(_get_module_lock)
   386274    0.221    0.000    0.221    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:130(would_send)
       57    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap>:406(cached)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:269(ParseResultBytes)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:165(_NetlocResultMixinStr)
       12    0.001    0.000    0.003    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:186(__on_ext_handshake_message)
       15    0.003    0.000    0.003    0.000 /usr/lib/python3.5/sre_compile.py:248(_optimize_charset)
        9    0.000    0.000    0.000    0.000 {built-in method _imp.exec_builtin}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:268(close)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1444(IPv4Network)
  2966642    0.561    0.000    0.561    0.000 {method 'pop' of 'collections.deque' objects}
        1    0.000    0.000    0.000    0.000 {built-in method _hashlib.openssl_sha384}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1151(FileType)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1556(_add_action)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:447(BoundedSemaphore)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:170(__exit__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:397(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1350(AsyncIterable)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:671(__new__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sqlite3/dbapi2.py:51(<listcomp>)
       27    0.002    0.000    0.002    0.000 <frozen importlib._bootstrap_external>:419(_validate_bytecode_header)
       45    0.000    0.000    0.000    0.000 {built-in method builtins.divmod}
       15    0.000    0.000    0.000    0.000 /usr/lib/python3.5/posixpath.py:136(basename)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:892(_StoreTrueAction)
        9    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:745(exec_module)
       30    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:513(spec_from_file_location)
       27    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:811(get_filename)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1427(addHandler)
       17    0.000    0.000    0.000    0.000 {method 'replace' of 'str' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:129(Final)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1422(Reversible)
       39    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap>:321(__exit__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1205(Namespace)
       14    0.000    0.000    0.000    0.000 {method 'flush' of '_io.TextIOWrapper' objects}
        1    0.000    0.000    0.011    0.011 /usr/lib/python3.5/sqlite3/__init__.py:23(<module>)
   386275    0.108    0.000    0.108    0.000 {built-in method builtins.iter}
        1    0.000    0.000    0.001    0.001 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:29(__init__)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:260(__getattr__)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:225(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:765(__new__)
      139    0.000    0.000    0.001    0.000 {built-in method builtins.any}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:1156(Timer)
       74    0.000    0.000    0.000    0.000 {method 'setsockopt' of '_socket.socket' objects}
       10    0.000    0.000    0.004    0.000 /usr/lib/python3.5/sre_parse.py:819(parse)
        2    0.000    0.000    0.000    0.000 {method 'setter' of 'property' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/random.py:93(seed)
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bencode.py:73(BencodeDecodingError)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:278(seek)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1370(SupportsInt)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:195(_NetlocResultMixinBytes)
      145    0.001    0.000    0.001    0.000 {method 'recv' of '_socket.socket' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1472(ByteString)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/os.py:40(_get_exports_list)
   222717    0.179    0.000    0.221    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:282(would_send)
    19/10    0.000    0.000    0.003    0.000 /usr/lib/python3.5/sre_parse.py:429(_parse_sub)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:319(timedelta)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:376(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:1186(_MainThread)
       52    0.000    0.000    0.001    0.000 <frozen importlib._bootstrap_external>:87(_path_isfile)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:648(Quoter)
       14    0.000    0.000    0.000    0.000 {built-in method time.localtime}
       31    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1734(_parse_hextet)
        1    0.001    0.001    0.001    0.001 {method 'close' of 'sqlite3.Connection' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:208(__init__)
  2605497    1.516    0.000  203.612    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bencode.py:41(dumps)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:647(__getitem__)
       39    0.001    0.000    0.012    0.000 <frozen importlib._bootstrap>:879(_find_spec)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:275(_fix_result_transcoding)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:1005(time)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:212(__new__)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:84(__prepare__)
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:225(_verbose_message)
        1    0.000    0.000    0.001    0.001 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:38(__connect)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1433(Container)
        7    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_compile.py:376(<listcomp>)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/functools.py:422(decorating_function)
       30    0.000    0.000    0.000    0.000 {built-in method _imp.is_frozen}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:394(StringTemplateStyle)
   419584    9.409    0.000    9.409    0.000 {bencoder.decode_dict}
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:379(usesTime)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:260(getuntil)
        1    0.000    0.000    0.006    0.006 /usr/lib/python3.5/urllib/parse.py:28(<module>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/tokenize.py:221(StopTokenizing)
        1    0.000    0.000    0.000    0.000 {built-in method posix.urandom}
        2    0.000    0.000    0.002    0.001 /usr/lib/python3.5/enum.py:314(_create_)
        3    0.017    0.006    0.017    0.006 {built-in method _imp.create_dynamic}
        1    0.000    0.000  331.942  331.942 magneticod:4(<module>)
        3    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:1301(path_hook_for_FileFinder)
        1    0.000    0.000    0.001    0.001 /usr/lib/python3.5/threading.py:1(<module>)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:794(__init__)
        1    0.000    0.000    0.000    0.000 {built-in method posix.mkdir}
       32    0.000    0.000    0.000    0.000 {method 'acquire' of '_thread.RLock' objects}
  1210838    0.355    0.000    0.356    0.000 {built-in method builtins.isinstance}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:642(RawDescriptionHelpFormatter)
       15    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_weakrefset.py:16(__init__)
       89    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:34(_relax_case)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:652(Optional)
        7    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_compile.py:374(_mk_bitmap)
       89    0.002    0.000    0.008    0.000 <frozen importlib._bootstrap_external>:1215(find_spec)
  2925847    1.378    0.000    1.378    0.000 {built-in method from_bytes}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:749(Tuple)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:904(GenericMeta)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1088(Generic)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:736(Thread)
        1    0.000    0.000    0.007    0.007 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:107(__commit_metadata)
      278    0.000    0.000    0.000    0.000 {method 'rpartition' of 'str' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1224(Logger)
  5193388    2.324    0.000    2.324    0.000 {method 'to_bytes' of 'int' objects}
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:462(__init__)
        5    0.000    0.000    0.000    0.000 {built-in method builtins.hash}
    43/10    0.001    0.000    0.005    0.000 /usr/lib/python3.5/sre_compile.py:64(_compile)
       10    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_compile.py:412(_compile_info)
      459    0.001    0.000    0.001    0.000 {method 'format' of 'str' objects}
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:118(getLevelName)
       12    0.000    0.000    0.008    0.001 /usr/lib/python3.5/re.py:222(compile)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1726(_get_positional_actions)
       10    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:217(__init__)
        1    0.000    0.000    0.001    0.001 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:133(close)
      273    0.001    0.000    0.001    0.000 /usr/lib/python3.5/_weakrefset.py:36(__init__)
       18    0.000    0.000    0.000    0.000 {method 'values' of 'dict' objects}
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:149(<lambda>)
       80    0.000    0.000    0.000    0.000 {built-in method _thread.allocate_lock}
        1    0.000    0.000    0.000    0.000 {method '__exit__' of '_thread.lock' objects}
        1    0.000    0.000    0.004    0.004 /home/adas/.local/lib/python3.5/site-packages/magneticod/__main__.py:166(parse_cmdline_arguments)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1497(_FrozenSetMeta)
       47    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:553(__eq__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:138(_ForwardRef)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:231(LogRecord)
        3    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:892(__init__)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/tokenize.py:113(maybe)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1676(basicConfig)
        2    0.000    0.000    0.001    0.000 /usr/lib/python3.5/logging/__init__.py:1840(debug)
      476    0.001    0.000    0.001    0.000 <frozen importlib._bootstrap_external>:52(<listcomp>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1479(List)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:161(__setitem__)
  181/179    0.008    0.000    0.034    0.000 {built-in method builtins.__build_class__}
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:314(__enter__)
       34    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:75(groups)
        1    0.000    0.000    0.007    0.007 /usr/lib/python3.5/datetime.py:5(<module>)
   179485    0.221    0.000    0.768    0.000 /usr/lib/python3.5/selectors.py:253(modify)
       28    0.000    0.000    0.001    0.000 /usr/lib/python3.5/ipaddress.py:2158(__init__)
       37    0.002    0.000    0.002    0.000 {method 'connect_ex' of '_socket.socket' objects}
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/appdirs.py:407(AppDirs)
       67    0.000    0.000    0.000    0.000 {built-in method builtins.ord}
       10    0.001    0.000    0.048    0.005 /home/adas/.local/lib/python3.5/site-packages/magneticod/__main__.py:112(on_metadata_found)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1440(AbstractSet)
        1    0.000    0.000    0.000    0.000 {function TupleMeta.__subclasscheck__ at 0x7fbe977c5bf8}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:909(_StoreFalseAction)
      107    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
        1    0.034    0.034    0.057    0.057 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:38(__init__)
       63    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:301(__setattr__)
       14    0.001    0.000    0.003    0.000 /usr/lib/python3.5/logging/__init__.py:1417(handle)
       35    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:247(_check_int_field)
        1    0.000    0.000  331.810  331.810 /home/adas/.local/lib/python3.5/site-packages/magneticod/__main__.py:55(main)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:385(StrFormatStyle)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1776(_parse_known_args)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:185(__subclasscheck__)
        1    0.000    0.000    0.000    0.000 {built-in method atexit.register}
       28    0.000    0.000    0.000    0.000 {method 'write' of '_io.TextIOWrapper' objects}
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:37(SybilNode)
   366731    2.307    0.000    2.307    0.000 {method 'update' of 'dict' objects}
       13    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_collections_abc.py:592(get)
        9    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:762(is_package)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:23(NetmaskValueError)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:240(__exit__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1574(Generator)
       46    0.000    0.000    0.000    0.000 {built-in method posix.getcwd}
       19    0.000    0.000    0.000    0.000 /usr/lib/python3.5/tokenize.py:111(group)
       18    0.000    0.000    0.000    0.000 /usr/lib/python3.5/_weakrefset.py:81(add)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/socket.py:120(_GiveupOnSendfile)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/selectors.py:79(BaseSelector)
       39    0.002    0.000    0.007    0.000 /usr/lib/python3.5/selectors.py:404(register)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:989(_CountAction)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:237(DefragResult)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1455(MutableMapping)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:2142(IPv6Network)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1261(_ProtocolMeta)
        5    0.000    0.000    0.000    0.000 {built-in method builtins.repr}
   366725    1.377    0.000   11.320    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:236(__decode_nodes)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1488(Set)
       60    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:153(__len__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1362(Iterable)
      737    0.000    0.000    0.000    0.000 {method 'startswith' of 'str' objects}
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:220(_releaseLock)
        1    0.000    0.000    0.001    0.001 /usr/lib/python3.5/textwrap.py:415(dedent)
        4    0.000    0.000    0.000    0.000 {method 'cast' of 'memoryview' objects}
        1    0.000    0.000    0.130    0.130 /home/adas/.local/lib/python3.5/site-packages/magneticod/__main__.py:15(<module>)
        1    0.000    0.000    0.000    0.000 {built-in method _sqlite3.connect}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:125(_ResultMixinBytes)
   386274    0.307    0.000    0.415    0.000 /usr/lib/python3.5/selectors.py:75(__iter__)
       28    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:511(<genexpr>)
        2    0.000    0.000    0.000    0.000 {method 'clear' of 'list' objects}
       27    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:35(_new_module)
        5    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:277(_check_time_fields)
       27    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:826(path_stats)
       27    0.011    0.000    0.011    0.000 {built-in method marshal.loads}
        6    0.000    0.000    0.000    0.000 /usr/lib/python3.5/locale.py:375(normalize)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1056(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1566(_MutuallyExclusiveGroup)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sqlite3/dbapi2.py:56(register_adapters_and_converters)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:790(createLock)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1534(__init__)
        1    0.000    0.000    0.003    0.003 /usr/lib/python3.5/typing.py:1677(IO)
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:28(Database)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1817(io)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:72(RLock)
        5    0.000    0.000    0.000    0.000 /usr/lib/python3.5/os.py:800(decode)
       64    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:976(__eq__)
       14    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:519(<genexpr>)
      101    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/persistence.py:88(<genexpr>)
       28    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1630(_ip_int_from_string)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:513(__neg__)
   366725    1.773    0.000   15.602    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:137(__on_FIND_NODE_response)
        1    0.000    0.000    0.005    0.005 /usr/lib/python3.5/string.py:65(__init__)
       28    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:806(release)
    65/42    0.000    0.000    0.001    0.000 {built-in method builtins.issubclass}
        1    0.000    0.000    0.000    0.000 {method 'close' of 'select.epoll' objects}
       28    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1612(_make_netmask)
       14    0.000    0.000    0.003    0.000 /usr/lib/python3.5/logging/__init__.py:1377(makeRecord)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/functools.py:195(<listcomp>)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:946(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1548(__init__)
        5    0.001    0.000    0.007    0.001 /usr/lib/python3.5/collections/__init__.py:356(namedtuple)
       84    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:165(append)
        4    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bencode.py:74(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:360(TypeVar)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:203(_Section)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:1319(__new__)
       44    0.001    0.000    0.018    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:173(__on_ANNOUNCE_PEER_query)
       19    0.000    0.000    0.000    0.000 /usr/lib/python3.5/ipaddress.py:1075(_make_netmask)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:213(__init__)
        1    0.000    0.000    0.001    0.001 /usr/lib/python3.5/ipaddress.py:1558(_IPv4Constants)
        2    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1355(add_argument_group)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/enum.py:121(<setcomp>)
        1    0.000    0.000    0.000    0.000 {built-in method math.sqrt}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:937(StreamHandler)
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:155(__delitem__)
      653    0.024    0.000    0.025    0.000 {method 'join' of 'str' objects}
        4    0.000    0.000    0.000    0.000 /usr/lib/python3.5/functools.py:391(lru_cache)
        2    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
       39    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:310(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:1057(_ChoicesPseudoAction)
       99    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:856(__exit__)
       42    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:959(_get_type_vars)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:1188(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:349(Any)
       38    0.000    0.000    0.001    0.000 /usr/lib/python3.5/socket.py:403(close)
       39    0.000    0.000    0.002    0.000 <frozen importlib._bootstrap>:510(_init_module_attrs)
        3    0.002    0.001    0.002    0.001 {method 'execute' of 'sqlite3.Cursor' objects}
       30    0.000    0.000    0.011    0.000 <frozen importlib._bootstrap_external>:1133(find_spec)
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/magneticod/bittorrent.py:30(DisposablePeer)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/argparse.py:836(__init__)
        3    0.000    0.000    0.000    0.000 /usr/lib/python3.5/datetime.py:40(_days_before_year)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:496(__init__)
        3    0.000    0.000    0.000    0.000 {built-in method _imp.exec_dynamic}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/threading.py:888(_set_ident)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/logging/__init__.py:1316(critical)
        1    0.000    0.000    0.000    0.000 /home/adas/.local/lib/python3.5/site-packages/appdirs.py:45(user_data_dir)
        3    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:1178(__init__)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1590(Type)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1522(MappingView)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/genericpath.py:39(isdir)
        1    0.000    0.000    0.000    0.000 <string>:5(TokenInfo)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1835(re)
   430449    0.126    0.000    0.126    0.000 {method 'append' of 'list' objects}
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/os.py:216(makedirs)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:256(DefragResultBytes)
        3    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap_external>:1260(_fill_cache)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/urllib/parse.py:133(_NetlocResultMixinBase)
      108    9.992    0.093  221.931    2.055 /home/adas/.local/lib/python3.5/site-packages/magneticod/dht.py:224(__make_neighbours)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:584(Union)
        3    0.000    0.000    0.001    0.000 /usr/lib/python3.5/gettext.py:528(gettext)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/traceback.py:310(StackSummary)
        1    0.000    0.000    0.000    0.000 /usr/lib/python3.5/typing.py:1773(BinaryIO)
      102    0.000    0.000    0.000    0.000 /usr/lib/python3.5/sre_parse.py:242(match)
       32    0.000    0.000    0.000    0.000 {built-in method _imp.is_builtin}
        1    0.000    0.000    0.001    0.001 /usr/lib/python3.5/logging/__init__.py:1785(critical)
    59/39    0.000    0.000    0.054    0.001 <frozen importlib._bootstrap>:996(_handle_fromlist)
       20    0.000    0.000    0.000    0.000 {built-in method sys._getframe}
   386274    0.114    0.000    0.114    0.000 /usr/lib/python3.5/selectors.py:272(get_map)
      331    0.003    0.000    0.003    0.000 /usr/lib/python3.5/socket.py:81(<lambda>)

Based on them I draw some graph:

graf

60% of script was spend in bencoder.bencode. It was executed 2605497 times.

Greetings,

@ngosang
Copy link
Contributor

ngosang commented Apr 18, 2017

Based on them I draw some graph:

Did you use some software?

@boramalper
Copy link
Owner

@ad-m Thanks for the incredibly detailed bug report, I sincerely appreciate that.

I thought using bencoder.pyx (written in Cython) instead of the pure Python solution would solve the performance issues, but as you have also said, my CPU usage (on 5$ Linode instance) stayed same.

I'll have a look at writing it in Cython myself to solve the issue, or as a last resort in C itself (whether I write it myself or adapt from somewhere else).


I would be also very much grateful if you can analyse the SQL queries in magneticow, if you can. Queries are extremely slow and I honestly don't know why.

@ad-m
Copy link
Contributor Author

ad-m commented Apr 18, 2017

@ngosang , yes, i googled "python profiling", visited http://stackoverflow.com/questions/582336/how-can-you-profile-a-script, collect data python -m cProfile ~/.local/bin/magneticow -o data, next to draw gprof2dot.py -f pstats data > graph.dot; dot2png "graph.dot" > graph.png.

@boramalper , I don't know a lot about C++ binding (I don't write any yet), but there might be some costs of context switching. There will be 2605497 context switch in bencoder.bencode, so there might be some bulking required. Again I emphasize, I do not know C++ binding.

@ngosang
Copy link
Contributor

ngosang commented Apr 18, 2017

I thought using bencoder.pyx (written in Cython) instead of the pure Python solution would solve the performance issues, but as you have also said, my CPU usage (on 5$ Linode instance) stayed same.
I'll have a look at writing it in Cython myself to solve the issue, or as a last resort in C itself (whether I write it myself or adapt from somewhere else).

Before doing that (I think you aren’t going to improve speed enough), ask yourself if it's necessary to bencode all time practically the same data.
What happens if you save this in a global constant:

bencode.dumps({
                b"y": b"q",
                b"q": b"find_node",
                b"t": self.__random_bytes(2),
                b"a": {
                    b"id": self.__true_id,
                    b"target": self.__random_bytes(20)
}

and send the same request data to all nodes (bootstrap and neighbours). Since your id is the same and other fields are random should work...

I would be also very much grateful if you can analyse the SQL queries in magneticow, if you can. Queries are extremely slow and I honestly don't know why.

You aren't doing anything wrong. SQLite is not designed to store many documents, performance is degraded after few thousand rows. If you want to use a relational DB use MySQL or PostgreSQL instead. SQL syntax is almost the same and your queries will be x10000 times faster. Since it's a search engine, using Elasticsearch (no relational search engine) will be awesome but you have to change too much code...

@ad-m
Copy link
Contributor Author

ad-m commented Apr 18, 2017

@boramalper , SQL queries in magneticow is described in #8

@ngosang
Copy link
Contributor

ngosang commented Apr 18, 2017

I was wrong in my previous comment, some bencoding is necessary. I did some hack #42
@ad-m could you profile it? 😄

@boramalper
Copy link
Owner

Before doing that (I think you aren’t going to improve speed enough), ask yourself if it's necessary to bencode all time practically the same data.
What happens if you save this in a global constant […]

@ngosang That's a great idea indeed! I added some comments on your "hack". :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants