diff options
author | Mark Janes <mark.a.janes@intel.com> | 2015-10-15 08:56:56 -0700 |
---|---|---|
committer | Mark Janes <mark.a.janes@intel.com> | 2017-06-19 14:04:45 -0700 |
commit | 6e069a27dce2173d1c3f5999133a184ccf671d4f (patch) | |
tree | 9900654c94ab4ed09ff1923f57e4164f0ed1a4d8 /retrace/daemon/ui/main.cpp | |
parent | 22edc7ec91c5baa4b7f8a09c2ad4df6942ae485c (diff) |
add QML visualization of metrics list.
This commit connects the metrics query operations in retrace to the QML
UI. A ComboBox displays the metrics that are available for query.
Currently, the bar graph shows canned data.
Diffstat (limited to 'retrace/daemon/ui/main.cpp')
-rw-r--r-- | retrace/daemon/ui/main.cpp | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/retrace/daemon/ui/main.cpp b/retrace/daemon/ui/main.cpp index bcf898a6..13b5bb99 100644 --- a/retrace/daemon/ui/main.cpp +++ b/retrace/daemon/ui/main.cpp @@ -27,33 +27,34 @@ #include <unistd.h> -#include <sstream> - #include <QGuiApplication> #include <QQmlApplicationEngine> #include <QtQml> +#include <google/protobuf/io/zero_copy_stream_impl_lite.h> +#include <google/protobuf/io/coded_stream.h> +#include <sstream> + +#include "glframe_glhelper.hpp" #include "glframe_os.hpp" +#include "glframe_qbargraph.hpp" +#include "glframe_retrace_images.hpp" #include "glframe_retrace_model.hpp" #include "glframe_retrace_skeleton.hpp" #include "glframe_retrace_stub.hpp" #include "glframe_socket.hpp" -#include "glframe_retrace_images.hpp" - -#include <google/protobuf/io/zero_copy_stream_impl_lite.h> -#include <google/protobuf/io/coded_stream.h> - using glretrace::FrameRetraceModel; using glretrace::FrameRetraceSkeleton; using glretrace::FrameRetraceStub; +using glretrace::GlFunctions; +using glretrace::QMetric; using glretrace::QRenderBookmark; using glretrace::ServerSocket; int fork_retracer() { ServerSocket sock(0); pid_t pid = fork(); - //pid_t pid = 0; if (pid == -1) { // When fork() returns -1, an error happened. perror("fork failed"); @@ -65,30 +66,38 @@ int fork_retracer() { skel.Run(); exit(0); // exit() is unreliable here, so _exit must be used } - //exit(0); // exit() is unreliable here, so _exit must be used return sock.GetPort(); } int main(int argc, char *argv[]) { - GOOGLE_PROTOBUF_VERIFY_VERSION; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + GlFunctions::Init(); + + const int port = fork_retracer(); + + FrameRetraceStub::Init(port); + QGuiApplication app(argc, argv); - const int port = fork_retracer(); + qmlRegisterType<glretrace::QRenderBookmark>("ApiTrace", 1, 0, + "QRenderBookmark"); + qmlRegisterType<glretrace::QMetric>("ApiTrace", 1, 0, + "QMetric"); + qmlRegisterType<glretrace::FrameRetraceModel>("ApiTrace", 1, 0, + "FrameRetrace"); - FrameRetraceStub::Init(port); - - QGuiApplication app(argc, argv); + qmlRegisterType<glretrace::BarGraphView>("ApiTrace", 1, 0, "BarGraph"); + qmlRegisterType<glretrace::QSelection>("ApiTrace", 1, 0, "Selection"); - qmlRegisterType<glretrace::QRenderBookmark>("ApiTrace", 1, 0, "QRenderBookmark"); - qmlRegisterType<glretrace::FrameRetraceModel>("ApiTrace", 1, 0, "FrameRetrace"); + glretrace::FrameImages::Create(); - glretrace::FrameImages::Create(); - - QQmlApplicationEngine engine(QUrl("qrc:///qml/mainwin.qml")); - engine.addImageProvider("myimageprovider", glretrace::FrameImages::instance()); - int ret = app.exec(); + QQmlApplicationEngine engine(QUrl("qrc:///qml/mainwin.qml")); + engine.addImageProvider("myimageprovider", + glretrace::FrameImages::instance()); + int ret = app.exec(); - FrameRetraceStub::Shutdown(); - ::google::protobuf::ShutdownProtobufLibrary(); - glretrace::FrameImages::Destroy(); - return ret; + FrameRetraceStub::Shutdown(); + ::google::protobuf::ShutdownProtobufLibrary(); + glretrace::FrameImages::Destroy(); + return ret; } |