Merge lp:~aacid/ubuntu-ui-toolkit/lttng_ui_ready_tracepoint into lp:ubuntu-ui-toolkit/staging

Proposed by Albert Astals Cid
Status: Rejected
Rejected by: Albert Astals Cid
Proposed branch: lp:~aacid/ubuntu-ui-toolkit/lttng_ui_ready_tracepoint
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 342 lines (+235/-3)
11 files modified
components.api (+2/-0)
debian/control (+1/-0)
debian/qml-module-ubuntu-components.install (+1/-0)
src/Ubuntu/Components/Components.pro (+2/-1)
src/Ubuntu/Components/lttng/lttng.pro (+9/-0)
src/Ubuntu/Components/lttng/tracepoints.c (+21/-0)
src/Ubuntu/Components/lttng/uclttng_tp.h (+37/-0)
src/Ubuntu/Components/plugin/plugin.cpp (+11/-0)
src/Ubuntu/Components/plugin/plugin.pri (+9/-2)
src/Ubuntu/Components/plugin/uclttng.cpp (+104/-0)
src/Ubuntu/Components/plugin/uclttng.h (+38/-0)
To merge this branch: bzr merge lp:~aacid/ubuntu-ui-toolkit/lttng_ui_ready_tracepoint
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Cris Dywan Needs Fixing
Loïc Molinari Pending
Review via email: mp+298618@code.launchpad.net

Commit message

Add LTTNG.userInterfaceReady

With it developers can signal to lttng that their UI is ready

Description of the change

To post a comment you must log in.
2023. By Albert Astals Cid

Update components.api

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2024. By Albert Astals Cid

install the .so and only create one .so

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2025. By Albert Astals Cid

the world is too pedantic and makes me waste time

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2026. By Albert Astals Cid

soname without version

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Florian Boucault (fboucault) wrote :

#ifndef UPM_RENDERING_TIMES_LTTNG_H seems incorrect

Revision history for this message
Florian Boucault (fboucault) wrote :

Needs documentation: 1 example + a short explanation of where it is typically used

Revision history for this message
Cris Dywan (kalikiana) wrote :

Me thinks this could live in PerformanceMetrics since it's another aspect of "how to measure performance".

Examples would be nice, for instance "If used in a messaging application, ready could mean that all visible messages are rendered on screen. In a camera use case, once the view finder shows a picture it's ready to use."
Maybe once this lands we can have a blog post with some code patterns to answer those questions, some of which might not be trivial.

Should lttng be in Recommends? To ensure it's available on a developer machine, albeit not required. And I'll assume it's seeded on phone images?

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

Loic is thinking that we might have a Ubuntu.Metrics module in the future. Maybe it belongs there rather than in Ubuntu.Components

2027. By Albert Astals Cid

fix the ifdef/define

2028. By Albert Astals Cid

Add code/documentation

Revision history for this message
Albert Astals Cid (aacid) wrote :

> #ifndef UPM_RENDERING_TIMES_LTTNG_H seems incorrect

Fixed

Revision history for this message
Albert Astals Cid (aacid) wrote :

> Needs documentation: 1 example + a short explanation of where it is typically
> used

Added some documentation, please review

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
2029. By Albert Astals Cid

Add Recommends as per kalikiana's suggestion

Revision history for this message
Albert Astals Cid (aacid) wrote :

> Me thinks this could live in PerformanceMetrics since it's another aspect of
> "how to measure performance".

I'm going to need someone else to make the decision:
 A) leave it here
 B) Move it to PerformanceMetrics
 C) Create a new Metrics module that Loic will later extend

Who can make a call on this?

> Examples would be nice, for instance "If used in a messaging application,
> ready could mean that all visible messages are rendered on screen. In a camera
> use case, once the view finder shows a picture it's ready to use."
> Maybe once this lands we can have a blog post with some code patterns to
> answer those questions, some of which might not be trivial.

I think the "That is the program has loaded enough buttons, labels, etc. so that the user can now start using it." should be enough for people to understand it, but if you have a better wording/suggestion i'm open to adding that instead.

>
> Should lttng be in Recommends? To ensure it's available on a developer
> machine, albeit not required. And I'll assume it's seeded on phone images?

Added as Recommends, liblttng-ust0 is required by lots of stuff on the phone, so yes it's already in the image.

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> > Me thinks this could live in PerformanceMetrics since it's another aspect of
> > "how to measure performance".
>
> I'm going to need someone else to make the decision:
> A) leave it here
> B) Move it to PerformanceMetrics
> C) Create a new Metrics module that Loic will later extend
>
> Who can make a call on this?

A new module should have good reason to be added. Right now it's a single function.

Is there an argument warranting a new module? Florian didn't seem to have a strong opinion when I asked him.
How would "Metrics" differ from "PerformanceMetrics"? That'd be a very bad and confusing name to be honest.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Loic can you comment on why we would need a new module?

Revision history for this message
Loïc Molinari (loic.molinari) wrote :

The metrics library is now ready to be reviewed here [1]. Maybe we can discuss the naming there, the main reason being that it contains all kind of metrics (to be either logged to various devices and rendered as an overlay on top of QtQuick windows).

In light of this new library, I think it makes it's more consistent to integrate the feature proposed in this MR directly with the new library. So, Albert, I basically ported and integrated your nice work to the new lib in these 3 MRs [2][3][4].

[1] https://code.launchpad.net/~loic.molinari/ubuntu-ui-toolkit/ubuntu-metrics/+merge/302362
[2] https://code.launchpad.net/~loic.molinari/ubuntu-ui-toolkit/ubuntu-metrics-lttng/+merge/302363
[3] https://code.launchpad.net/~loic.molinari/ubuntu-ui-toolkit/ubuntu-metrics-generic-events/+merge/302364
[4] https://code.launchpad.net/~loic.molinari/ubuntu-ui-toolkit/ubuntu-metrics-module/+merge/302365

Revision history for this message
Albert Astals Cid (aacid) wrote :

Ok, abandoned this MR

Unmerged revisions

2029. By Albert Astals Cid

Add Recommends as per kalikiana's suggestion

2028. By Albert Astals Cid

Add code/documentation

2027. By Albert Astals Cid

fix the ifdef/define

2026. By Albert Astals Cid

soname without version

2025. By Albert Astals Cid

the world is too pedantic and makes me waste time

2024. By Albert Astals Cid

install the .so and only create one .so

2023. By Albert Astals Cid

Update components.api

2022. By Albert Astals Cid

Add LTTNG.userInterfaceReady

With it developers can signal to lttng that their UI is ready

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'components.api'
--- components.api 2016-06-27 10:03:01 +0000
+++ components.api 2016-06-30 12:40:45 +0000
@@ -489,6 +489,8 @@
489 property var model489 property var model
490 property bool multiSelection490 property bool multiSelection
491 property int selectedIndex491 property int selectedIndex
492Ubuntu.Components.LTTNG 1.3: QtObject singleton
493 function userInterfaceReady()
492Ubuntu.Components.Label 1.0 0.1: Text494Ubuntu.Components.Label 1.0 0.1: Text
493 property string fontSize495 property string fontSize
494Ubuntu.Components.Label 1.3 UbuntuToolkit::UCLabel: Text496Ubuntu.Components.Label 1.3 UbuntuToolkit::UCLabel: Text
495497
=== modified file 'debian/control'
--- debian/control 2016-06-24 13:10:20 +0000
+++ debian/control 2016-06-30 12:40:45 +0000
@@ -83,6 +83,7 @@
83 ubuntu-ui-toolkit-theme (= ${binary:Version}),83 ubuntu-ui-toolkit-theme (= ${binary:Version}),
84 ${misc:Depends},84 ${misc:Depends},
85 ${shlibs:Depends},85 ${shlibs:Depends},
86Recommends: liblttng-ust0,
86Conflicts: qt-components-ubuntu,87Conflicts: qt-components-ubuntu,
87Breaks: qtdeclarative5-ubuntu-ui-toolkit-plugin (<< ${source:Version}),88Breaks: qtdeclarative5-ubuntu-ui-toolkit-plugin (<< ${source:Version}),
88Replaces: qt-components-ubuntu,89Replaces: qt-components-ubuntu,
8990
=== modified file 'debian/qml-module-ubuntu-components.install'
--- debian/qml-module-ubuntu-components.install 2016-06-23 09:13:51 +0000
+++ debian/qml-module-ubuntu-components.install 2016-06-30 12:40:45 +0000
@@ -22,6 +22,7 @@
22usr/lib/*/qt5/qml/Ubuntu/Components/Styles/qmldir22usr/lib/*/qt5/qml/Ubuntu/Components/Styles/qmldir
23usr/lib/*/qt5/qml/Ubuntu/Components/artwork23usr/lib/*/qt5/qml/Ubuntu/Components/artwork
24usr/lib/*/qt5/qml/Ubuntu/Components/libUbuntuComponents.so24usr/lib/*/qt5/qml/Ubuntu/Components/libUbuntuComponents.so
25usr/lib/*/qt5/qml/Ubuntu/Components/libUbuntuComponentsLTTNG.so
25usr/lib/*/qt5/qml/Ubuntu/Components/plugins.qmltypes26usr/lib/*/qt5/qml/Ubuntu/Components/plugins.qmltypes
26usr/lib/*/qt5/qml/Ubuntu/Components/qmldir27usr/lib/*/qt5/qml/Ubuntu/Components/qmldir
27usr/share/locale/*/LC_MESSAGES/ubuntu-ui-toolkit.mo28usr/share/locale/*/LC_MESSAGES/ubuntu-ui-toolkit.mo
2829
=== modified file 'src/Ubuntu/Components/Components.pro'
--- src/Ubuntu/Components/Components.pro 2016-06-23 13:37:24 +0000
+++ src/Ubuntu/Components/Components.pro 2016-06-30 12:40:45 +0000
@@ -6,4 +6,5 @@
6 Popups \6 Popups \
7 Styles \7 Styles \
8 Themes \8 Themes \
9 Labs9 Labs \
10 lttng
1011
=== added directory 'src/Ubuntu/Components/lttng'
=== added file 'src/Ubuntu/Components/lttng/lttng.pro'
--- src/Ubuntu/Components/lttng/lttng.pro 1970-01-01 00:00:00 +0000
+++ src/Ubuntu/Components/lttng/lttng.pro 2016-06-30 12:40:45 +0000
@@ -0,0 +1,9 @@
1TEMPLATE = lib
2TARGET = UbuntuComponentsLTTNG
3SOURCES = tracepoints.c
4LIBS += -llttng-ust
5CONFIG -= create_prl
6CONFIG += unversioned_libname
7
8target.path = $$[QT_INSTALL_QML]/Ubuntu/Components
9INSTALLS += target
010
=== added file 'src/Ubuntu/Components/lttng/tracepoints.c'
--- src/Ubuntu/Components/lttng/tracepoints.c 1970-01-01 00:00:00 +0000
+++ src/Ubuntu/Components/lttng/tracepoints.c 2016-06-30 12:40:45 +0000
@@ -0,0 +1,21 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18/* The probes need to be compiled in a C file (not C++) */
19#define TRACEPOINT_CREATE_PROBES
20
21#include "uclttng_tp.h"
022
=== added file 'src/Ubuntu/Components/lttng/uclttng_tp.h'
--- src/Ubuntu/Components/lttng/uclttng_tp.h 1970-01-01 00:00:00 +0000
+++ src/Ubuntu/Components/lttng/uclttng_tp.h 2016-06-30 12:40:45 +0000
@@ -0,0 +1,37 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#undef TRACEPOINT_PROVIDER
19#define TRACEPOINT_PROVIDER uc_lttng
20
21#if !defined(UC_LTTNG_TP_H_) || defined(TRACEPOINT_HEADER_MULTI_READ)
22#define UC_LTTNG_TP_H_
23
24#include <lttng/tracepoint.h>
25
26TRACEPOINT_EVENT(uc_lttng, user_interface_ready,
27 TP_ARGS(),
28 TP_FIELDS()
29)
30
31#endif
32
33#undef TRACEPOINT_INCLUDE
34#define TRACEPOINT_INCLUDE "./uclttng_tp.h"
35
36/* This part must be outside ifdef protection */
37#include <lttng/tracepoint-event.h>
038
=== modified file 'src/Ubuntu/Components/plugin/plugin.cpp'
--- src/Ubuntu/Components/plugin/plugin.cpp 2016-06-21 14:21:46 +0000
+++ src/Ubuntu/Components/plugin/plugin.cpp 2016-06-30 12:40:45 +0000
@@ -17,10 +17,19 @@
1717
18#include <QtQml/QQmlEngine>18#include <QtQml/QQmlEngine>
19#include "plugin.h"19#include "plugin.h"
20#include "uclttng.h"
20#include "ucnamespace.h"21#include "ucnamespace.h"
21#include <ubuntutoolkitmodule.h>22#include <ubuntutoolkitmodule.h>
22#include <ubuntugesturesmodule.h>23#include <ubuntugesturesmodule.h>
2324
25static QObject *lttng_singleton_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
26{
27 Q_UNUSED(engine)
28 Q_UNUSED(scriptEngine)
29
30 return new UbuntuComponentsLTTNG();
31}
32
24UbuntuComponentsPlugin::~UbuntuComponentsPlugin()33UbuntuComponentsPlugin::~UbuntuComponentsPlugin()
25{34{
26 UT_PREPEND_NAMESPACE(UbuntuToolkitModule)::undefineModule();35 UT_PREPEND_NAMESPACE(UbuntuToolkitModule)::undefineModule();
@@ -34,6 +43,8 @@
3443
35 qmlRegisterSimpleSingletonType<UbuntuToolkit::UCNamespace>(uri, 1, 2, "Ubuntu");44 qmlRegisterSimpleSingletonType<UbuntuToolkit::UCNamespace>(uri, 1, 2, "Ubuntu");
36 qmlRegisterSimpleSingletonType<UbuntuToolkit::UCNamespaceV13>(uri, 1, 3, "Ubuntu");45 qmlRegisterSimpleSingletonType<UbuntuToolkit::UCNamespaceV13>(uri, 1, 3, "Ubuntu");
46 qmlRegisterSingletonType<UbuntuComponentsLTTNG>(uri, 1, 3, "LTTNG", lttng_singleton_provider);
47
3748
38 UG_PREPEND_NAMESPACE(UbuntuGesturesModule)::defineModule(uri);49 UG_PREPEND_NAMESPACE(UbuntuGesturesModule)::defineModule(uri);
39 UT_PREPEND_NAMESPACE(UbuntuToolkitModule)::defineModule();50 UT_PREPEND_NAMESPACE(UbuntuToolkitModule)::defineModule();
4051
=== modified file 'src/Ubuntu/Components/plugin/plugin.pri'
--- src/Ubuntu/Components/plugin/plugin.pri 2016-06-17 15:55:58 +0000
+++ src/Ubuntu/Components/plugin/plugin.pri 2016-06-30 12:40:45 +0000
@@ -5,12 +5,19 @@
5 QT += v8-private5 QT += v8-private
6}6}
77
8DEFINES += LTTNG_INSTALL_LIB_PATH=\\\"$$[QT_INSTALL_QML]/$$TARGETPATH/libUbuntuComponentsLTTNG.so\\\"
9DEFINES += LTTNG_BUILD_LIB_PATH=\\\"$$OUT_PWD/lttng/libUbuntuComponentsLTTNG.so\\\"
10
8CONFIG += no_keywords c++1111CONFIG += no_keywords c++11
912
10INCLUDEPATH+=$$PWD13INCLUDEPATH+=$$PWD
1114
12HEADERS += $$PWD/plugin.h \15HEADERS += $$PWD/plugin.h \
13 $$PWD/ucnamespace.h16 $$PWD/ucnamespace.h \
17 $$PWD/uclttng.h
1418
15SOURCES += $$PWD/plugin.cpp \19SOURCES += $$PWD/plugin.cpp \
16 $$PWD/ucnamespace.cpp20 $$PWD/ucnamespace.cpp \
21 $$PWD/uclttng.cpp
22
23LIBS += -ldl
17\ No newline at end of file24\ No newline at end of file
1825
=== added file 'src/Ubuntu/Components/plugin/uclttng.cpp'
--- src/Ubuntu/Components/plugin/uclttng.cpp 1970-01-01 00:00:00 +0000
+++ src/Ubuntu/Components/plugin/uclttng.cpp 2016-06-30 12:40:45 +0000
@@ -0,0 +1,104 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#include "uclttng.h"
19
20#include <QDebug>
21#include <QtCore/qmath.h>
22
23#include <dlfcn.h>
24
25#define TRACEPOINT_DEFINE
26#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
27#include "../lttng/uclttng_tp.h"
28
29/*!
30 * \qmltype LTTNG
31 * \instantiates UbuntuComponentsLTTNG
32 * \inqmlmodule Ubuntu.Components
33 * \ingroup ubuntu
34 * \brief Singleton to emit LTTNG tracepoints.
35 *
36 * Logging to LTTNG can be useful for posterior analysis. This class
37 * provides a singleton that can be used to emit LTTNG tracepoints (at
38 * this point only the userInterfaceReady one).
39 *
40 * Example:
41 * \qml
42 * import QtQuick 2.4
43 * import Ubuntu.Components 1.3
44 *
45 * MainView {
46 * width: units.gu(48)
47 * height: units.gu(60)
48 * Page {
49 * header: PageHeader {
50 * id: pageHeader
51 * title: "Simple page"
52 * }
53 * Button {
54 * anchors {
55 * horizontalCenter: parent.horizontalCenter
56 * top: pageHeader.bottom
57 * topMargin: units.gu(5)
58 * }
59 * width: units.gu(15)
60 * text: "Push me"
61 * }
62 * }
63 * Component.onCompleted: LTTNG.userInterfaceReady();
64 * }
65 * \endqml
66 */
67UbuntuComponentsLTTNG::UbuntuComponentsLTTNG(QObject* parent) :
68 QObject(parent),
69 m_lttngLib(nullptr),
70 m_lttngLibLoadTried(false)
71{
72}
73
74UbuntuComponentsLTTNG::~UbuntuComponentsLTTNG()
75{
76 dlclose(m_lttngLib);
77}
78
79/*!
80 * \qmlmethod void LTTNG::userInterfaceReady()
81 * Logs an LTTNG tracepoint about the user interface being ready. That is
82 * the program has loaded enough buttons, labels, etc. so that
83 * the user can now start using it.
84 */
85void UbuntuComponentsLTTNG::userInterfaceReady()
86{
87 if (!m_lttngLib && !m_lttngLibLoadTried) {
88 m_lttngLibLoadTried = true;
89
90 m_lttngLib = dlopen(LTTNG_INSTALL_LIB_PATH, RTLD_NOW);
91 if (!m_lttngLib) {
92 qWarning() << "Failed to load installed tracepoint provider: " << dlerror();
93 qWarning() << "Trying with build time one";
94
95 m_lttngLib = dlopen(LTTNG_BUILD_LIB_PATH, RTLD_NOW);
96 if (!m_lttngLib) {
97 qWarning() << "Failed to load build time tracepoint provider: " << dlerror();
98 }
99 }
100 }
101 if (m_lttngLib) {
102 tracepoint(uc_lttng, user_interface_ready);
103 }
104}
0105
=== added file 'src/Ubuntu/Components/plugin/uclttng.h'
--- src/Ubuntu/Components/plugin/uclttng.h 1970-01-01 00:00:00 +0000
+++ src/Ubuntu/Components/plugin/uclttng.h 2016-06-30 12:40:45 +0000
@@ -0,0 +1,38 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#ifndef UCLTTNG_H
19#define UCLTTNG_H
20
21#include <QObject>
22
23class UbuntuComponentsLTTNG : public QObject
24{
25 Q_OBJECT
26
27public:
28 explicit UbuntuComponentsLTTNG(QObject* parent = 0);
29 ~UbuntuComponentsLTTNG();
30
31 Q_INVOKABLE void userInterfaceReady();
32
33private:
34 void* m_lttngLib;
35 bool m_lttngLibLoadTried;
36};
37
38#endif

Subscribers

People subscribed via source and target branches