Merge lp:~loic.molinari/ubuntu-ui-toolkit/uitk-aligned-alloc-for-apple-and-win32 into lp:ubuntu-ui-toolkit/staging

Proposed by Loïc Molinari
Status: Needs review
Proposed branch: lp:~loic.molinari/ubuntu-ui-toolkit/uitk-aligned-alloc-for-apple-and-win32
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~loic.molinari/ubuntu-ui-toolkit/uitk-linux-clang
Diff against target: 106 lines (+44/-5)
6 files modified
src/UbuntuMetrics/UbuntuMetrics.pro (+2/-1)
src/UbuntuMetrics/applicationmonitor.cpp (+1/-1)
src/UbuntuMetrics/events.cpp (+2/-2)
src/UbuntuMetrics/overlay.cpp (+1/-1)
src/UbuntuMetrics/ubuntumetricsglobal.cpp (+34/-0)
src/UbuntuMetrics/ubuntumetricsglobal_p.h (+4/-0)
To merge this branch: bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/uitk-aligned-alloc-for-apple-and-win32
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Needs Fixing
Zsombor Egri Approve
Review via email: mp+306472@code.launchpad.net

Commit message

Added aligned alloc support for Apple and Windows.

Description of the change

Added aligned alloc support for Apple and Windows.

To post a comment you must log in.
Revision history for this message
Zsombor Egri (zsombi) wrote :

Looks good, thanks!

review: Approve
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) :
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: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/UbuntuMetrics/UbuntuMetrics.pro'
--- src/UbuntuMetrics/UbuntuMetrics.pro 2016-09-12 08:18:53 +0000
+++ src/UbuntuMetrics/UbuntuMetrics.pro 2016-09-22 14:21:44 +0000
@@ -30,6 +30,7 @@
30 $$PWD/events.cpp \30 $$PWD/events.cpp \
31 $$PWD/gputimer.cpp \31 $$PWD/gputimer.cpp \
32 $$PWD/logger.cpp \32 $$PWD/logger.cpp \
33 $$PWD/overlay.cpp33 $$PWD/overlay.cpp \
34 $$PWD/ubuntumetricsglobal.cpp
3435
35load(ubuntu_qt_module)36load(ubuntu_qt_module)
3637
=== modified file 'src/UbuntuMetrics/applicationmonitor.cpp'
--- src/UbuntuMetrics/applicationmonitor.cpp 2016-09-12 09:03:50 +0000
+++ src/UbuntuMetrics/applicationmonitor.cpp 2016-09-22 14:21:44 +0000
@@ -36,7 +36,7 @@
36 , m_flags(0)36 , m_flags(0)
37{37{
38 m_queue = static_cast<UMEvent*>(38 m_queue = static_cast<UMEvent*>(
39 aligned_alloc(logQueueAlignment, logQueueSize * sizeof(UMEvent)));39 alignedAlloc(logQueueAlignment, logQueueSize * sizeof(UMEvent)));
4040
41#if !defined(QT_NO_DEBUG)41#if !defined(QT_NO_DEBUG)
42 setObjectName(QStringLiteral("UbuntuMetrics logging")); // Thread name.42 setObjectName(QStringLiteral("UbuntuMetrics logging")); // Thread name.
4343
=== modified file 'src/UbuntuMetrics/events.cpp'
--- src/UbuntuMetrics/events.cpp 2016-09-22 10:49:07 +0000
+++ src/UbuntuMetrics/events.cpp 2016-09-22 14:21:44 +0000
@@ -37,9 +37,9 @@
37EventUtilsPrivate::EventUtilsPrivate()37EventUtilsPrivate::EventUtilsPrivate()
38{38{
39#if !defined(QT_NO_DEBUG)39#if !defined(QT_NO_DEBUG)
40 ASSERT(m_buffer = static_cast<char*>(aligned_alloc(bufferAlignment, bufferSize)));40 ASSERT(m_buffer = static_cast<char*>(alignedAlloc(bufferAlignment, bufferSize)));
41#else41#else
42 m_buffer = static_cast<char*>(aligned_alloc(bufferAlignment, bufferSize));42 m_buffer = static_cast<char*>(alignedAlloc(bufferAlignment, bufferSize));
43#endif43#endif
44 m_cpuTimer.start();44 m_cpuTimer.start();
45 m_cpuTicks = times(&m_cpuTimes);45 m_cpuTicks = times(&m_cpuTimes);
4646
=== modified file 'src/UbuntuMetrics/overlay.cpp'
--- src/UbuntuMetrics/overlay.cpp 2016-09-09 17:49:07 +0000
+++ src/UbuntuMetrics/overlay.cpp 2016-09-22 14:21:44 +0000
@@ -96,7 +96,7 @@
96{96{
97 DASSERT(text);97 DASSERT(text);
9898
99 m_buffer = aligned_alloc(bufferAlignment, bufferSize);99 m_buffer = alignedAlloc(bufferAlignment, bufferSize);
100 memset(&m_processEvent, 0, sizeof(m_processEvent));100 memset(&m_processEvent, 0, sizeof(m_processEvent));
101 m_processEvent.type = UMEvent::Process;101 m_processEvent.type = UMEvent::Process;
102}102}
103103
=== added file 'src/UbuntuMetrics/ubuntumetricsglobal.cpp'
--- src/UbuntuMetrics/ubuntumetricsglobal.cpp 1970-01-01 00:00:00 +0000
+++ src/UbuntuMetrics/ubuntumetricsglobal.cpp 2016-09-22 14:21:44 +0000
@@ -0,0 +1,34 @@
1// Copyright © 2016 Canonical Ltd.
2// Author: Loïc Molinari <loic.molinari@canonical.com>
3//
4// This file is part of Ubuntu UI Toolkit.
5//
6// Ubuntu UI Toolkit is free software: you can redistribute it and/or modify it
7// under the terms of the GNU Lesser General Public License as published by the
8// Free Software Foundation; version 3.
9//
10// Ubuntu UI Toolkit is distributed in the hope that it will be useful, but
11// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13// for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with Ubuntu UI Toolkit. If not, see <http://www.gnu.org/licenses/>.
17
18#include "ubuntumetricsglobal_p.h"
19
20void* alignedAlloc(size_t alignment, size_t size)
21{
22 DASSERT(IS_POWER_OF_TWO(alignment));
23 // DASSERT(((size % alignment) == 0)); // FIXME(loicm) ASSERT doesn't support '%'...
24
25#if defined(__APPLE__)
26 void* pointer;
27 posix_memalign(&pointer, alignment, size);
28 return pointer;
29#elif defined(_WIN32)
30 return _aligned_malloc(size, alignment);
31#else
32 return aligned_alloc(alignment, size);
33#endif
34}
035
=== modified file 'src/UbuntuMetrics/ubuntumetricsglobal_p.h'
--- src/UbuntuMetrics/ubuntumetricsglobal_p.h 2016-09-09 17:49:07 +0000
+++ src/UbuntuMetrics/ubuntumetricsglobal_p.h 2016-09-22 14:21:44 +0000
@@ -51,4 +51,8 @@
5151
52#define UBUNTU_METRICS_PRIVATE_EXPORT UBUNTU_METRICS_EXPORT52#define UBUNTU_METRICS_PRIVATE_EXPORT UBUNTU_METRICS_EXPORT
5353
54// Allocates size bytes and returns an pointer to the aligned memory. alignment
55// must be a power-of-two and size a multiple of alignment.
56void* alignedAlloc(size_t alignment, size_t size);
57
54#endif // UBUNTUMETRICSGLOBAL_P_H58#endif // UBUNTUMETRICSGLOBAL_P_H

Subscribers

People subscribed via source and target branches