Add ttrace 75/59175/3 accepted/tizen/ivi/20160218.025249 accepted/tizen/mobile/20160216.001902 accepted/tizen/tv/20160216.001921 accepted/tizen/wearable/20160216.001939 submit/tizen/20160215.063405 submit/tizen_common/20160218.142243 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000006
authorJengHyun Kang <jhyuni.kang@samsung.com>
Thu, 11 Feb 2016 06:44:36 +0000 (15:44 +0900)
committerJengHyun Kang <jhyuni.kang@samsung.com>
Thu, 11 Feb 2016 08:13:51 +0000 (17:13 +0900)
Change-Id: I82a316d226c967a396f6ce5671feeafbfb37bd0f

configure.ac
packaging/libinput.spec
src/Makefile.am
src/evdev.c
src/libinput-private.h
src/libinput.c

index 1a4eb3af7eae7fb739eb072f793e309ae012f5a9..ed3854657bb7ffde33e282423206835aa45e360b 100644 (file)
@@ -165,6 +165,15 @@ if test "x$build_tests" = "xyes"; then
        AC_PATH_PROG(VALGRIND, [valgrind])
 fi
 
+# 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(BUILD_DOCS, [test "x$build_documentation" = "xyes"])
index b1922005e85de481548173459ecd3da4ceda5db3..b6f23b53971509a6a9e4f66f57f67852203f108b 100644 (file)
@@ -16,7 +16,7 @@ BuildRequires:  pkgconfig(libevdev)
 BuildRequires:  pkgconfig(libevent)
 BuildRequires:  pkgconfig(libudev)
 BuildRequires:  pkgconfig(mtdev)
-
+BuildRequires:  pkgconfig(ttrace)
 
 %description
 
index b5eba731c32ba47d58c1b342ca6af48ffe7b1f01..31df128f5d9c332a815325f5c3ade4447d94400b 100644 (file)
@@ -29,12 +29,14 @@ libinput_la_SOURCES =                       \
 libinput_la_LIBADD = $(MTDEV_LIBS) \
                     $(LIBUDEV_LIBS) \
                     $(LIBEVDEV_LIBS) \
+                    $(TTRACE_LIBS) \
                     libinput-util.la
 
 libinput_la_CFLAGS = -I$(top_srcdir)/include \
                     $(MTDEV_CFLAGS)    \
                     $(LIBUDEV_CFLAGS)  \
                     $(LIBEVDEV_CFLAGS) \
+                    $(TTRACE_CFLAGS)   \
                     $(GCC_CFLAGS)
 EXTRA_libinput_la_DEPENDENCIES = $(srcdir)/libinput.sym
 
index 9e23867366cd6af78b8518d8f90ac9d6edf0a740..0377687c38b97e5ee258663036841aa53a192553 100644 (file)
@@ -340,11 +340,14 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
                .orientation = DEFAULT_TOUCH_ORIENTATION
        };
 
+       TRACE_BEGIN(evdev_flush_pending_event);
+
        slot = device->mt.slot;
        slot_data = &device->mt.slots[slot];
 
        switch (device->pending_event) {
        case EVDEV_NONE:
+               TRACE_END();
                return;
        case EVDEV_RELATIVE_MOTION:
                dx_unaccel = device->rel.dx / ((double) device->dpi /
@@ -495,6 +498,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
        }
 
        device->pending_event = EVDEV_NONE;
+       TRACE_END();
 }
 
 static enum evdev_key_type
@@ -567,13 +571,18 @@ evdev_process_key(struct evdev_device *device,
 {
        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)
                        evdev_process_touch_button(device, time, e->value);
+               TRACE_END();
                return;
        }
 
@@ -589,8 +598,10 @@ evdev_process_key(struct evdev_device *device,
                        break;
                case EVDEV_KEY_TYPE_KEY:
                case EVDEV_KEY_TYPE_BUTTON:
-                       if (!hw_is_key_down(device, e->code))
+                       if (!hw_is_key_down(device, e->code)) {
+                               TRACE_END();
                                return;
+                       }
                }
        }
 
@@ -621,6 +632,7 @@ evdev_process_key(struct evdev_device *device,
                                   LIBINPUT_BUTTON_STATE_RELEASED);
                break;
        }
+       TRACE_END();
 }
 
 static void
@@ -714,6 +726,7 @@ static inline void
 evdev_process_relative(struct evdev_device *device,
                       struct input_event *e, uint64_t time)
 {
+       TRACE_BEGIN(evdev_process_relative);
        switch (e->code) {
        case REL_X:
                if (device->pending_event != EVDEV_RELATIVE_MOTION)
@@ -752,6 +765,7 @@ evdev_process_relative(struct evdev_device *device,
                        0.0);
                break;
        }
+       TRACE_END();
 }
 
 static inline void
@@ -759,11 +773,13 @@ evdev_process_absolute(struct evdev_device *device,
                       struct input_event *e,
                       uint64_t time)
 {
+       TRACE_BEGIN(evdev_process_absolute);
        if (device->is_mt) {
                evdev_process_touch(device, e, time);
        } else {
                evdev_process_absolute_motion(device, e);
        }
+       TRACE_END();
 }
 
 static inline bool
@@ -1244,7 +1260,11 @@ evdev_process_event(struct evdev_device *device, struct input_event *e)
        struct evdev_dispatch *dispatch = device->dispatch;
        uint64_t time = e->time.tv_sec * 1000ULL + e->time.tv_usec / 1000;
 
+       TRACE_BEGIN(evdev_process_event);
+
        dispatch->interface->process(dispatch, device, e, time);
+
+       TRACE_END();
 }
 
 static inline void
index 0b216f4188ab60075916cd566b14d4b5e2c30881..863889d7a58e4a37c880a1b2f2a9249656664b0e 100644 (file)
 #include "libinput.h"
 #include "libinput-util.h"
 
+#ifdef ENABLE_TTRACE
+#include <ttrace.h>
+
+#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;
 
 /* Ellipse parameters in device coordinates */
index 7a1055ca178f3aaff13c13817cf82d292ea50fe4..b9c3c82052bfd84f905eae8e47cb73fcd2d1f721 100644 (file)
@@ -1167,13 +1167,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
@@ -1181,13 +1187,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();
 }
 
 void
@@ -1199,9 +1211,13 @@ keyboard_notify_key(struct libinput_device *device,
        struct libinput_event_keyboard *key_event;
        uint32_t seat_key_count;
 
+       TRACE_BEGIN(keyboard_notify_key);
+
        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);
 
@@ -1215,6 +1231,8 @@ keyboard_notify_key(struct libinput_device *device,
        post_device_event(device, time,
                          LIBINPUT_EVENT_KEYBOARD_KEY,
                          &key_event->base);
+
+       TRACE_END();
 }
 
 void
@@ -1227,9 +1245,13 @@ pointer_notify_motion(struct libinput_device *device,
 {
        struct libinput_event_pointer *motion_event;
 
+       TRACE_BEGIN(pointer_notify_motion);
+
        motion_event = zalloc(sizeof *motion_event);
-       if (!motion_event)
+       if (!motion_event) {
+               TRACE_END();
                return;
+       }
 
        *motion_event = (struct libinput_event_pointer) {
                .time = time,
@@ -1242,6 +1264,8 @@ pointer_notify_motion(struct libinput_device *device,
        post_device_event(device, time,
                          LIBINPUT_EVENT_POINTER_MOTION,
                          &motion_event->base);
+
+       TRACE_END();
 }
 
 void
@@ -1252,9 +1276,13 @@ pointer_notify_motion_absolute(struct libinput_device *device,
 {
        struct libinput_event_pointer *motion_absolute_event;
 
+       TRACE_BEGIN(pointer_notify_motion_absolute);
+
        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,
@@ -1265,6 +1293,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
@@ -1276,9 +1306,13 @@ pointer_notify_button(struct libinput_device *device,
        struct libinput_event_pointer *button_event;
        int32_t seat_button_count;
 
+       TRACE_BEGIN(pointer_notify_button);
+
        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,
@@ -1294,6 +1328,8 @@ pointer_notify_button(struct libinput_device *device,
        post_device_event(device, time,
                          LIBINPUT_EVENT_POINTER_BUTTON,
                          &button_event->base);
+
+       TRACE_END();
 }
 
 void
@@ -1306,9 +1342,13 @@ pointer_notify_axis(struct libinput_device *device,
 {
        struct libinput_event_pointer *axis_event;
 
+       TRACE_BEGIN(pointer_notify_axis);
+
        axis_event = zalloc(sizeof *axis_event);
-       if (!axis_event)
+       if (!axis_event) {
+               TRACE_END();
                return;
+       }
 
        *axis_event = (struct libinput_event_pointer) {
                .time = time,
@@ -1323,6 +1363,8 @@ pointer_notify_axis(struct libinput_device *device,
        post_device_event(device, time,
                          LIBINPUT_EVENT_POINTER_AXIS,
                          &axis_event->base);
+
+       TRACE_END();
 }
 
 void
@@ -1337,9 +1379,13 @@ touch_notify_touch_down(struct libinput_device *device,
 {
        struct libinput_event_touch *touch_event;
 
+       TRACE_BEGIN(touch_notify_touch_down);
+
        touch_event = zalloc(sizeof *touch_event);
-       if (!touch_event)
+       if (!touch_event) {
+               TRACE_END();
                return;
+       }
 
        *touch_event = (struct libinput_event_touch) {
                .time = time,
@@ -1354,6 +1400,8 @@ touch_notify_touch_down(struct libinput_device *device,
        post_device_event(device, time,
                          LIBINPUT_EVENT_TOUCH_DOWN,
                          &touch_event->base);
+
+       TRACE_END();
 }
 
 void
@@ -1368,9 +1416,13 @@ touch_notify_touch_motion(struct libinput_device *device,
 {
        struct libinput_event_touch *touch_event;
 
+       TRACE_BEGIN(touch_notify_touch_motion);
+
        touch_event = zalloc(sizeof *touch_event);
-       if (!touch_event)
+       if (!touch_event) {
+               TRACE_END();
                return;
+       }
 
        *touch_event = (struct libinput_event_touch) {
                .time = time,
@@ -1385,6 +1437,8 @@ touch_notify_touch_motion(struct libinput_device *device,
        post_device_event(device, time,
                          LIBINPUT_EVENT_TOUCH_MOTION,
                          &touch_event->base);
+
+       TRACE_END();
 }
 
 void
@@ -1395,9 +1449,13 @@ touch_notify_touch_up(struct libinput_device *device,
 {
        struct libinput_event_touch *touch_event;
 
+       TRACE_BEGIN(touch_notify_touch_up);
+
        touch_event = zalloc(sizeof *touch_event);
-       if (!touch_event)
+       if (!touch_event) {
+               TRACE_END();
                return;
+       }
 
        *touch_event = (struct libinput_event_touch) {
                .time = time,
@@ -1408,6 +1466,8 @@ touch_notify_touch_up(struct libinput_device *device,
        post_device_event(device, time,
                          LIBINPUT_EVENT_TOUCH_UP,
                          &touch_event->base);
+
+       TRACE_END();
 }
 
 void
@@ -1416,9 +1476,13 @@ touch_notify_frame(struct libinput_device *device,
 {
        struct libinput_event_touch *touch_event;
 
+       TRACE_BEGIN(touch_notify_frame);
+
        touch_event = zalloc(sizeof *touch_event);
-       if (!touch_event)
+       if (!touch_event) {
+               TRACE_END();
                return;
+       }
 
        *touch_event = (struct libinput_event_touch) {
                .time = time,
@@ -1427,6 +1491,8 @@ touch_notify_frame(struct libinput_device *device,
        post_device_event(device, time,
                          LIBINPUT_EVENT_TOUCH_FRAME,
                          &touch_event->base);
+
+       TRACE_END();
 }
 
 static void