--- /dev/null
+QT -= gui
+
+TEMPLATE = lib
+
+TARGET = threadweaver
+
+# change the variable if ThreadWeaver sources are located in another directory
+SRC_PATH = ../../kf5/threadweaver/src/
+
+win32 {
+ CONFIG(debug, debug|release) {
+ TARGET = $${TARGET}d
+ DESTDIR = ../bin/debug
+ }
+ else {
+ DESTDIR = ../bin/release
+ }
+}
+
+# Probably you don't need to build the library on Linux - check whether it's available
+# in your Linux distribution's repositories.
+unix {
+ target.path = /usr/lib
+ INSTALLS += target
+}
+
+DEFINES += THREADWEAVER_LIBRARY
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which has been marked as deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+INCLUDEPATH += ThreadWeaver
+
+SOURCES += \
+ $${SRC_PATH}collection.cpp \
+ $${SRC_PATH}collection_p.cpp \
+ $${SRC_PATH}debuggingaids.cpp \
+ $${SRC_PATH}dependency.cpp \
+ $${SRC_PATH}dependencypolicy.cpp \
+ $${SRC_PATH}destructedstate.cpp \
+ $${SRC_PATH}exception.cpp \
+ $${SRC_PATH}executewrapper.cpp \
+ $${SRC_PATH}executor.cpp \
+ $${SRC_PATH}iddecorator.cpp \
+ $${SRC_PATH}inconstructionstate.cpp \
+ $${SRC_PATH}job.cpp \
+ $${SRC_PATH}job_p.cpp \
+ $${SRC_PATH}qobjectdecorator.cpp \
+ $${SRC_PATH}queue.cpp \
+ $${SRC_PATH}queueapi.cpp \
+ $${SRC_PATH}queuesignals.cpp \
+ $${SRC_PATH}queuesignals_p.cpp \
+ $${SRC_PATH}queuestream.cpp \
+ $${SRC_PATH}resourcerestrictionpolicy.cpp \
+ $${SRC_PATH}sequence.cpp \
+ $${SRC_PATH}sequence_p.cpp \
+ $${SRC_PATH}shuttingdownstate.cpp \
+ $${SRC_PATH}state.cpp \
+ $${SRC_PATH}suspendedstate.cpp \
+ $${SRC_PATH}suspendingstate.cpp \
+ $${SRC_PATH}thread.cpp \
+ $${SRC_PATH}threadweaver.cpp \
+ $${SRC_PATH}weaver.cpp \
+ $${SRC_PATH}weaver_p.cpp \
+ $${SRC_PATH}weaverimplstate.cpp \
+ $${SRC_PATH}workinghardstate.cpp
+
+HEADERS += \
+ ThreadWeaver/threadweaver_export.h \
+ $${SRC_PATH}collection.h \
+ $${SRC_PATH}collection_p.h \
+ $${SRC_PATH}debuggingaids.h \
+ $${SRC_PATH}dependency.h \
+ $${SRC_PATH}dependencypolicy.h \
+ $${SRC_PATH}destructedstate.h \
+ $${SRC_PATH}exception.h \
+ $${SRC_PATH}executewrapper_p.h \
+ $${SRC_PATH}executor_p.h \
+ $${SRC_PATH}iddecorator.h \
+ $${SRC_PATH}inconstructionstate.h \
+ $${SRC_PATH}job.h \
+ $${SRC_PATH}job_p.h \
+ $${SRC_PATH}jobinterface.h \
+ $${SRC_PATH}jobpointer.h \
+ $${SRC_PATH}lambda.h \
+ $${SRC_PATH}managedjobpointer.h \
+ $${SRC_PATH}qobjectdecorator.h \
+ $${SRC_PATH}queue.h \
+ $${SRC_PATH}queueapi.h \
+ $${SRC_PATH}queueing.h \
+ $${SRC_PATH}queueinterface.h \
+ $${SRC_PATH}queuepolicy.h \
+ $${SRC_PATH}queuesignals.h \
+ $${SRC_PATH}queuesignals_p.h \
+ $${SRC_PATH}queuestream.h \
+ $${SRC_PATH}resourcerestrictionpolicy.h \
+ $${SRC_PATH}sequence.h \
+ $${SRC_PATH}sequence_p.h \
+ $${SRC_PATH}shuttingdownstate.h \
+ $${SRC_PATH}state.h \
+ $${SRC_PATH}suspendedstate.h \
+ $${SRC_PATH}suspendingstate.h \
+ $${SRC_PATH}thread.h \
+ $${SRC_PATH}threadweaver.h \
+ $${SRC_PATH}weaver.h \
+ $${SRC_PATH}weaver_p.h \
+ $${SRC_PATH}weaverimplstate.h \
+ $${SRC_PATH}weaverinterface.h \
+ $${SRC_PATH}workinghardstate.h
--- /dev/null
+#ifndef THREADWEAVER_GLOBAL_H
+#define THREADWEAVER_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#if defined(THREADWEAVER_LIBRARY)
+# define THREADWEAVER_EXPORT Q_DECL_EXPORT
+#else
+# define THREADWEAVER_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // THREADWEAVER_GLOBAL_H
#ifdef NO_K_LIB
#include "noklib.h"
+#ifdef THREAD_WEAVER
+#include <threadweaver.h>
+#endif // THREAD_WEAVER
#else
#include <KColorScheme>
#include <KLocalizedString>
#include <KStandardAction>
#include <ThreadWeaver/ThreadWeaver>
-#endif
+#endif // NO_K_LIB
#include "util.h"
bool collapseRecursion = m_collapseRecursion;
auto source = m_costSource->currentData().value<CostType>();
auto threshold = m_costThreshold;
-#ifdef NO_K_LIB
+#ifndef THREAD_WEAVER
setData(parseData(data, source, threshold, collapseRecursion));
#else
using namespace ThreadWeaver;
#ifdef NO_K_LIB
#include "noklib.h"
+#ifdef THREAD_WEAVER
+#include <threadweaver.h>
+#endif // THREAD_WEAVER
#else
#include <KLocalizedString>
#include <ThreadWeaver/ThreadWeaver>
-#endif
+#endif // NO_K_LIB
#include <QDebug>
void Parser::parse(const QString& path, const QString& diffBase)
{
-#ifdef NO_K_LIB
+#ifndef THREAD_WEAVER
parseJob(path, diffBase);
#else
ThreadWeaver::stream() << ThreadWeaver::make_job([this, path, diffBase]() {
const auto diffMode = data->stringCache.diffMode;
emit progressMessageAvailable(i18n("building charts..."));
-#ifndef NO_K_LIB
+#ifdef THREAD_WEAVER
using namespace ThreadWeaver;
auto parallel = new Collection;
*parallel << make_job([this, mergedAllocations]()
const auto topDownData = toTopDownData(mergedAllocations);
emit topDownDataAvailable(topDownData);
}
-#ifndef NO_K_LIB
+#ifdef THREAD_WEAVER
) << make_job([this, mergedAllocations, diffMode]()
#endif
{
const auto callerCalleeData = toCallerCalleeData(mergedAllocations, diffMode);
emit callerCalleeDataAvailable(callerCalleeData);
}
-#ifndef NO_K_LIB
+#ifdef THREAD_WEAVER
);
#endif
if (!data->stringCache.diffMode) {
// only build charts when we are not diffing
-#ifndef NO_K_LIB
+#ifdef THREAD_WEAVER
*parallel << make_job([this, data, stdPath]()
#endif
{
emit allocatedChartDataAvailable(data->allocatedChartData);
emit temporaryChartDataAvailable(data->temporaryChartData);
}
-#ifndef NO_K_LIB
+#ifdef THREAD_WEAVER
);
#endif
}
-#ifdef NO_K_LIB
+#ifndef THREAD_WEAVER
emit finished();
#else
auto sequential = new Sequence;
}
win32 {
- CONFIG += NO_K_LIB NO_K_CHART
+ # Third-party libraries used:
+ # QWT: http://qwt.sourceforge.net (SVN: https://svn.code.sf.net/p/qwt/code/trunk)
+ # ThreadWeaver: https://cgit.kde.org/threadweaver.git (git://anongit.kde.org/threadweaver.git)
-# comment the next line to not use QWT (i.e. don't show charts)
+ # comment the next line to not use QWT library (charts will not be displayed in this case)
CONFIG += QWT_CHART
+ # comment the next line to not use ThreadWeaver library (used to parse data files faster)
+ CONFIG += THREAD_WEAVER
+
+ CONFIG += NO_K_LIB NO_K_CHART
+
DEFINES += NO_K_LIB NO_K_CHART WINDOWS
INCLUDEPATH += $$(BOOST_LIB)
LIBS += -L$$(BOOST_LIB)/stage/lib
RC_ICONS += analyze/gui/icons/if_diagram_v2-14_37134.ico
+
+ CONFIG(debug, debug|release) {
+ TARGET = $${TARGET}Dbg
+ DESTDIR = ../bin/debug
+ }
+ else {
+ DESTDIR = ../bin/release
+ }
+}
+
+THREAD_WEAVER {
+ DEFINES += THREAD_WEAVER
+ win32 {
+ # ThreadWeaver shall be built beforehand (load ThreadWeaver.pro, edit it if necessary, and build)
+
+ # change the variable if ThreadWeaver headers are located in another directory
+ THREAD_WEAVE_HEADER_PATH = ../../kf5/threadweaver/src/
+
+ INCLUDEPATH += $$THREAD_WEAVE_HEADER_PATH ThreadWeaver
+ CONFIG(debug, debug|release) {
+ win32-msvc:LIBS += $${DESTDIR}/threadweaverd.lib
+ }
+ else {
+ win32-msvc:LIBS += $${DESTDIR}/threadweaver.lib
+ }
+ }
+ unix {
+ QT += ThreadWeaver
+ }
}
unix {
CONFIG *= USE_CHART
DEFINES *= USE_CHART
-# uncomment the next line to use QWT instead of KChart
+ # uncomment the next line to use QWT instead of KChart
# CONFIG += QWT_CHART
QWT_CHART {
LIBS += -lboost_program_options -lboost_iostreams -lpthread
}
+QWT_CHART {
+ # QMAKEFEATURES and QWT_ROOT environment variables must be set (e.g. to d:\Qwt\Qwt-6.2).
+ # This is the directory where qwt.prf and qwt*.pri files reside.
+ # Windows: file qwt.dll must exist in $${DESTDIR}\release and qwtd.dll in $${DESTDIR}\debug
+ # to be able to run the application.
+ CONFIG *= USE_CHART QWT
+ DEFINES *= USE_CHART QWT
+}
+
#Test only!
#CONFIG *= NO_K_LIB NO_K_CHART
#DEFINES *= NO_K_LIB NO_K_CHART
util/config.h
QWT_CHART {
- # QMAKEFEATURES and QWT_ROOT environment variables must be set (e.g. to d:\Qwt\Qwt-6.2).
- # This is the directory where qwt.prf and qwt*.pri files reside.
- CONFIG *= USE_CHART QWT
- DEFINES *= USE_CHART QWT
-
SOURCES += \
analyze/gui/chartmodel2qwtseriesdata.cpp \
analyze/gui/chartwidgetqwtplot.cpp \
QT += KItemModels
- QT += ThreadWeaver
+ QT *= ThreadWeaver
+ DEFINES *= THREAD_WEAVER
}
!NO_K_CHART {