From: JengHyun Kang Date: Thu, 11 Feb 2016 06:44:36 +0000 (+0900) Subject: Add ttrace X-Git-Tag: submit/tizen/20171107.103302~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ea08aa102723b2cc18aada0438393f5c4095e1b;p=platform%2Fupstream%2Flibinput.git Add ttrace Change-Id: I82a316d226c967a396f6ce5671feeafbfb37bd0f --- diff --git a/configure.ac b/configure.ac index eabc9e14..7ee2584a 100644 --- a/configure.ac +++ b/configure.ac @@ -245,6 +245,17 @@ AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"]) AC_SUBST([GCOV_CFLAGS]) AC_SUBST([GCOV_LDFLAGS]) +####################### +# check for ttrace header files # +####################### +PKG_CHECK_MODULES(TTRACE, + [ttrace], + [have_ttrace="yes"], [have_ttrace="no"]) + +if test "x$have_ttrace" = "xyes"; then + AC_DEFINE(ENABLE_TTRACE, 1, [ttrace available]) +fi + AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"]) AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"]) AM_CONDITIONAL(RUN_TESTS, [test "x$run_tests" = "xyes"]) diff --git a/packaging/libinput.spec b/packaging/libinput.spec index b1922005..b6f23b53 100644 --- a/packaging/libinput.spec +++ b/packaging/libinput.spec @@ -16,7 +16,7 @@ BuildRequires: pkgconfig(libevdev) BuildRequires: pkgconfig(libevent) BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(mtdev) - +BuildRequires: pkgconfig(ttrace) %description diff --git a/src/Makefile.am b/src/Makefile.am index 6723d5ae..10c3094b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,6 +39,7 @@ libinput_la_LIBADD = $(MTDEV_LIBS) \ $(LIBUDEV_LIBS) \ $(LIBEVDEV_LIBS) \ $(LIBWACOM_LIBS) \ + $(TTRACE_LIBS) \ libinput-util.la libinput_la_LDFLAGS = $(GCOV_LDFLAGS) \ -version-info $(LIBINPUT_LT_VERSION) -shared \ @@ -51,6 +52,8 @@ libinput_la_CFLAGS = -I$(top_srcdir)/include \ $(LIBWACOM_CFLAGS) \ $(GCC_CFLAGS) \ $(GCOV_CFLAGS) + $(TTRACE_CFLAGS) \ + $(GCC_CFLAGS) EXTRA_libinput_la_DEPENDENCIES = $(srcdir)/libinput.sym libinput_util_la_SOURCES = \ diff --git a/src/evdev.c b/src/evdev.c index e51f5511..c9071bb0 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -559,8 +559,12 @@ fallback_flush_relative_motion(struct fallback_dispatch *dispatch, struct normalized_coords accel, unaccel; struct device_float_coords raw; - if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) + TRACE_BEGIN(fallback_flush_relative_motion); + + if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) { + TRACE_END(); return; + } fallback_rotate_relative(dispatch, device); @@ -571,8 +575,10 @@ fallback_flush_relative_motion(struct fallback_dispatch *dispatch, dispatch->rel.y = 0; /* Use unaccelerated deltas for pointing stick scroll */ - if (evdev_post_trackpoint_scroll(device, unaccel, time)) + if (evdev_post_trackpoint_scroll(device, unaccel, time)) { + TRACE_END(); return; + } if (device->pointer.filter) { /* Apply pointer acceleration. */ @@ -586,10 +592,14 @@ fallback_flush_relative_motion(struct fallback_dispatch *dispatch, accel = unaccel; } - if (normalized_is_zero(accel) && normalized_is_zero(unaccel)) + if (normalized_is_zero(accel) && normalized_is_zero(unaccel)) { + TRACE_END(); return; + } pointer_notify_motion(base, time, &accel, &raw); + + TRACE_END(); } static void @@ -927,9 +937,13 @@ fallback_process_key(struct fallback_dispatch *dispatch, { enum evdev_key_type type; + TRACE_BEGIN(evdev_process_key); + /* ignore kernel key repeat */ - if (e->value == 2) + if (e->value == 2) { + TRACE_END(); return; + } if (e->code == BTN_TOUCH) { if (!device->is_mt) @@ -937,6 +951,7 @@ fallback_process_key(struct fallback_dispatch *dispatch, device, time, e->value); + TRACE_END(); return; } @@ -952,8 +967,10 @@ fallback_process_key(struct fallback_dispatch *dispatch, break; case EVDEV_KEY_TYPE_KEY: case EVDEV_KEY_TYPE_BUTTON: - if (!hw_is_key_down(dispatch, e->code)) + if (!hw_is_key_down(dispatch, e->code)) { + TRACE_END(); return; + } } } @@ -980,6 +997,7 @@ fallback_process_key(struct fallback_dispatch *dispatch, LIBINPUT_BUTTON_STATE_RELEASED); break; } + TRACE_END(); } static void @@ -1112,8 +1130,12 @@ fallback_process_relative(struct fallback_dispatch *dispatch, struct discrete_coords discrete = { 0.0, 0.0 }; enum libinput_pointer_axis_source source; - if (fallback_reject_relative(device, e, time)) + TRACE_BEGIN(fallback_process_relative); + + if (fallback_reject_relative(device, e, time)) { + TRACE_END(); return; + } switch (e->code) { case REL_X: @@ -1165,6 +1187,7 @@ fallback_process_relative(struct fallback_dispatch *dispatch, &discrete); break; } + TRACE_END(); } static inline void @@ -1173,11 +1196,13 @@ fallback_process_absolute(struct fallback_dispatch *dispatch, struct input_event *e, uint64_t time) { + TRACE_BEGIN(evdev_process_absolute); if (device->is_mt) { fallback_process_touch(dispatch, device, e, time); } else { fallback_process_absolute_motion(dispatch, device, e); } + TRACE_END(); } static inline bool @@ -2039,7 +2064,11 @@ evdev_process_event(struct evdev_device *device, struct input_event *e) e->value); #endif + TRACE_BEGIN(evdev_process_event); + dispatch->interface->process(dispatch, device, e, time); + + TRACE_END(); } static inline void diff --git a/src/libinput-private.h b/src/libinput-private.h index 39fcbf8e..667d4e92 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -42,6 +42,16 @@ #define HTTP_DOC_LINK "https://wayland.freedesktop.org/libinput/doc/" LIBINPUT_VERSION "/" #endif +#ifdef ENABLE_TTRACE +#include + +#define TRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_INPUT, "INPUT:LIBINPUT:"#NAME) +#define TRACE_END() traceEnd(TTRACE_TAG_INPUT) +#else +#define TRACE_BEGIN(NAME) +#define TRACE_END() +#endif + struct libinput_source; /* A coordinate pair in device coordinates */ diff --git a/src/libinput.c b/src/libinput.c index cb9b27e6..c2e7297f 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -2343,13 +2343,19 @@ notify_added_device(struct libinput_device *device) { struct libinput_event_device_notify *added_device_event; + TRACE_BEGIN(notify_added_device); + added_device_event = zalloc(sizeof *added_device_event); - if (!added_device_event) + if (!added_device_event) { + TRACE_END(); return; + } post_base_event(device, LIBINPUT_EVENT_DEVICE_ADDED, &added_device_event->base); + + TRACE_END(); } void @@ -2357,13 +2363,19 @@ notify_removed_device(struct libinput_device *device) { struct libinput_event_device_notify *removed_device_event; + TRACE_BEGIN(notify_removed_device); + removed_device_event = zalloc(sizeof *removed_device_event); - if (!removed_device_event) + if (!removed_device_event) { + TRACE_END(); return; + } post_base_event(device, LIBINPUT_EVENT_DEVICE_REMOVED, &removed_device_event->base); + + TRACE_END(); } static inline bool @@ -2416,12 +2428,18 @@ keyboard_notify_key(struct libinput_device *device, struct libinput_event_keyboard *key_event; uint32_t seat_key_count; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) + TRACE_BEGIN(keyboard_notify_key); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) { + TRACE_END(); return; + } key_event = zalloc(sizeof *key_event); - if (!key_event) + if (!key_event) { + TRACE_END(); return; + } seat_key_count = update_seat_key_count(device->seat, key, state); @@ -2435,6 +2453,8 @@ keyboard_notify_key(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_KEYBOARD_KEY, &key_event->base); + + TRACE_END(); } void @@ -2445,12 +2465,18 @@ pointer_notify_motion(struct libinput_device *device, { struct libinput_event_pointer *motion_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) - return; + TRACE_BEGIN(pointer_notify_motion); + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) { + TRACE_END(); + return; + } + motion_event = zalloc(sizeof *motion_event); - if (!motion_event) + if (!motion_event) { + TRACE_END(); return; + } *motion_event = (struct libinput_event_pointer) { .time = time, @@ -2461,6 +2487,8 @@ pointer_notify_motion(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_POINTER_MOTION, &motion_event->base); + + TRACE_END(); } void @@ -2470,12 +2498,18 @@ pointer_notify_motion_absolute(struct libinput_device *device, { struct libinput_event_pointer *motion_absolute_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) + TRACE_BEGIN(pointer_notify_motion_absolute); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) { + TRACE_END(); return; + } motion_absolute_event = zalloc(sizeof *motion_absolute_event); - if (!motion_absolute_event) + if (!motion_absolute_event) { + TRACE_END(); return; + } *motion_absolute_event = (struct libinput_event_pointer) { .time = time, @@ -2485,6 +2519,8 @@ pointer_notify_motion_absolute(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, &motion_absolute_event->base); + + TRACE_END(); } void @@ -2496,12 +2532,18 @@ pointer_notify_button(struct libinput_device *device, struct libinput_event_pointer *button_event; int32_t seat_button_count; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) + TRACE_BEGIN(pointer_notify_button); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) { + TRACE_END(); return; + } button_event = zalloc(sizeof *button_event); - if (!button_event) + if (!button_event) { + TRACE_END(); return; + } seat_button_count = update_seat_button_count(device->seat, button, @@ -2517,6 +2559,8 @@ pointer_notify_button(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_POINTER_BUTTON, &button_event->base); + + TRACE_END(); } void @@ -2529,12 +2573,18 @@ pointer_notify_axis(struct libinput_device *device, { struct libinput_event_pointer *axis_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) + TRACE_BEGIN(pointer_notify_axis); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) { + TRACE_END(); return; + } axis_event = zalloc(sizeof *axis_event); - if (!axis_event) + if (!axis_event) { + TRACE_END(); return; + } *axis_event = (struct libinput_event_pointer) { .time = time, @@ -2547,6 +2597,8 @@ pointer_notify_axis(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_POINTER_AXIS, &axis_event->base); + + TRACE_END(); } void @@ -2560,12 +2612,18 @@ touch_notify_touch_down(struct libinput_device *device, { struct libinput_event_touch *touch_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) + TRACE_BEGIN(touch_notify_touch_down); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) { + TRACE_END(); return; + } touch_event = zalloc(sizeof *touch_event); - if (!touch_event) + if (!touch_event) { + TRACE_END(); return; + } *touch_event = (struct libinput_event_touch) { .time = time, @@ -2579,6 +2637,8 @@ touch_notify_touch_down(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_TOUCH_DOWN, &touch_event->base); + + TRACE_END(); } void @@ -2592,12 +2652,18 @@ touch_notify_touch_motion(struct libinput_device *device, { struct libinput_event_touch *touch_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) + TRACE_BEGIN(touch_notify_touch_motion); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) { + TRACE_END(); return; + } touch_event = zalloc(sizeof *touch_event); - if (!touch_event) + if (!touch_event) { + TRACE_END(); return; + } *touch_event = (struct libinput_event_touch) { .time = time, @@ -2611,6 +2677,8 @@ touch_notify_touch_motion(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_TOUCH_MOTION, &touch_event->base); + + TRACE_END(); } void @@ -2621,12 +2689,18 @@ touch_notify_touch_up(struct libinput_device *device, { struct libinput_event_touch *touch_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) + TRACE_BEGIN(touch_notify_touch_up); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) { + TRACE_END(); return; + } touch_event = zalloc(sizeof *touch_event); - if (!touch_event) + if (!touch_event) { + TRACE_END(); return; + } *touch_event = (struct libinput_event_touch) { .time = time, @@ -2637,6 +2711,8 @@ touch_notify_touch_up(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_TOUCH_UP, &touch_event->base); + + TRACE_END(); } void