Add extra logging to debug the event loop

This should make tracking down the root cause of the
event loop pauses on X11 easier. And the infrastructure
should come in handy in the future as well.
This commit is contained in:
Kovid Goyal
2019-04-24 16:16:40 +05:30
parent 099510f4d1
commit 0987a536b1
6 changed files with 46 additions and 4 deletions

View File

@@ -178,7 +178,8 @@ class Env:
def init_env(
debug=False, sanitize=False, native_optimizations=True, profile=False
debug=False, sanitize=False, native_optimizations=True, profile=False,
extra_logging=()
):
native_optimizations = native_optimizations and not sanitize and not debug
cc, ccver = cc_version()
@@ -200,6 +201,8 @@ def init_env(
)
)
cppflags = shlex.split(cppflags)
for el in extra_logging:
cppflags.append('-DDEBUG_{}'.format(el.upper().replace('-', '_')))
cflags = os.environ.get(
'OVERRIDE_CFLAGS', (
'-Wextra -Wno-missing-field-initializers -Wall -std=c11'
@@ -508,7 +511,7 @@ def build(args, native_optimizations=True):
compilation_database = {
(k['file'], k.get('output')): k['arguments'] for k in compilation_database
}
env = init_env(args.debug, args.sanitize, native_optimizations, args.profile)
env = init_env(args.debug, args.sanitize, native_optimizations, args.profile, args.extra_logging)
try:
compile_c_extension(
kitty_env(), 'kitty/fast_data_types', args.incremental, compilation_database, all_keys, *find_c_files()
@@ -842,6 +845,13 @@ def option_parser(): # {{{
default='lib',
help='The name of the directory inside --prefix in which to store compiled files. Defaults to "lib"'
)
p.add_argument(
'--extra-logging',
action='append',
choices=('event-loop',),
help='Turn on extra logging for debugging in this build. Can be specified multiple times, to turn'
'on different types of logging.'
)
return p
# }}}