diff --git a/rbkit-lib/subscriber.cpp b/rbkit-lib/subscriber.cpp index b80695c..28b088e 100644 --- a/rbkit-lib/subscriber.cpp +++ b/rbkit-lib/subscriber.cpp @@ -62,6 +62,10 @@ void Subscriber::takeSnapshot() commandSocket->sendCommand(triggerSnapshot); } +void Subscriber::startCPUSnapshot() { + qDebug() <<"Start CPU Snapshot command received"; +} + void Subscriber::startSubscriber() { qDebug() << "** (start subscriber) Thread id is : " << QThread::currentThreadId(); diff --git a/rbkit-lib/subscriber.h b/rbkit-lib/subscriber.h index b6c304a..a029ceb 100644 --- a/rbkit-lib/subscriber.h +++ b/rbkit-lib/subscriber.h @@ -81,6 +81,7 @@ public slots: void onTimerExpiry(); void triggerGc(); void takeSnapshot(); + void startCPUSnapshot(); void startSubscriber(); private: diff --git a/rbkit-lib/ui/actiontoolbar.cpp b/rbkit-lib/ui/actiontoolbar.cpp index 881a813..20ef054 100644 --- a/rbkit-lib/ui/actiontoolbar.cpp +++ b/rbkit-lib/ui/actiontoolbar.cpp @@ -68,6 +68,7 @@ void ActionToolbar::setupSubscriber() subscriber, SLOT(startListening(QString, QString))); connect(this, SIGNAL(triggerGc()), subscriber, SLOT(triggerGc())); connect(this, SIGNAL(takeSnapshot()), subscriber, SLOT(takeSnapshot())); + connect(this, SIGNAL(startCPUSnapshot()), subscriber, SLOT(startCPUSnapshot())); connect(subscriber, &Subscriber::errored, centralWidget, &CentralWidget::onError); connect(subscriber, &Subscriber::connected, this, &ActionToolbar::connectedToSocket); @@ -152,6 +153,13 @@ void ActionToolbar::setupToolBar() "stop_cpu_profiling", QIcon(":/icons/Compare-32.png"), "cpu_profiling"); + + cpusnapshotButton = toolBar->addRibbonAction("Take Snapshot", + "start_snapshot", + QIcon(":/icons/snapshot-32.png"), + "cpu_profiling"); + connect(snapshotButton, &QToolButton::clicked, this, &ActionToolbar::performCPUSnapshot); + toolBar->loadStyleSheet(":/icons/style.css"); } @@ -160,6 +168,10 @@ void ActionToolbar::performGCAction() emit triggerGc(); } +void ActionToolbar::performCPUSnapshot() { + emit startCPUSnapshot(); +} + void ActionToolbar::takeSnapshotAction() { if (centralWidget->attemptMemorySnapshot()) { diff --git a/rbkit-lib/ui/actiontoolbar.h b/rbkit-lib/ui/actiontoolbar.h index 7ae74ea..dd89e91 100644 --- a/rbkit-lib/ui/actiontoolbar.h +++ b/rbkit-lib/ui/actiontoolbar.h @@ -51,15 +51,18 @@ class ActionToolbar : public QObject QToolButton *gcButton; QToolButton *connectButton; QToolButton *snapshotButton; + QToolButton *cpusnapshotButton; QToolButton *compareSnapshotButton; signals: void connectToSocket(QString commandSocket, QString eventSocket); void triggerGc(); void disconnectSubscriber(); void takeSnapshot(); + void startCPUSnapshot(); public slots: void performGCAction(); void takeSnapshotAction(); + void performCPUSnapshot(); void attemptConnection(); void compareSnapshots(); void useSelectedHost(QString commandSocket, QString eventSocket);