@@ -473,7 +473,7 @@ KsCaptureDialog::KsCaptureDialog(QWidget *parent)
_captureMon(this),
_captureProc(this)
{
- QString captureExe(TRACECMD_BIN_DIR);
+ QString captureExe;
this->setWindowTitle("Capture");
_layout.addWidget(&_captureCtrl);
@@ -489,6 +489,11 @@ KsCaptureDialog::KsCaptureDialog(QWidget *parent)
connect(&_captureCtrl._closeButton, &QPushButton::pressed,
this, &KsCaptureDialog::close);
+ if (KsUtils::isInstalled())
+ captureExe = QString(_INSTALL_PREFIX) + QString("/bin");
+ else
+ captureExe = TRACECMD_BIN_DIR;
+
captureExe += "/trace-cmd";
_captureProc.setProgram(captureExe);
@@ -142,10 +142,10 @@ bool matchCPUVisible(struct kshark_context *kshark_ctx,
*/
bool isInstalled()
{
- QString appPath = QCoreApplication::applicationFilePath();
+ QString appPath = QCoreApplication::applicationDirPath();
QString installPath(_INSTALL_PREFIX);
- installPath += "/bin/kernelshark";
+ installPath += "/bin";
installPath = QDir::cleanPath(installPath);
return appPath == installPath;
@@ -112,6 +112,8 @@ inline QString Ts2String(int64_t ts, int prec)
bool matchCPUVisible(struct kshark_context *kshark_ctx,
struct kshark_entry *e, int cpu);
+bool isInstalled();
+
QString getFile(QWidget *parent,
const QString &windowName,
const QString &filter,
If kshark-record has been started from its installation location it will use the installed version of trace-cmd. Otherwise the trace-cmd executable found by Cmake when building KernelShark (see FindTraceCmd.cmake) will be used. Suggested-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> --- kernel-shark/src/KsCaptureDialog.cpp | 7 ++++++- kernel-shark/src/KsUtils.cpp | 4 ++-- kernel-shark/src/KsUtils.hpp | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-)