1 #include "traceprocess.h"
8 TraceProcess::TraceProcess(QObject *parent)
12 m_process = new QProcess(this);
14 connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
15 this, SLOT(traceFinished()));
16 connect(m_process, SIGNAL(error(QProcess::ProcessError)),
17 this, SLOT(traceError(QProcess::ProcessError)));
20 TraceProcess::~TraceProcess()
24 void TraceProcess::setApi(const QString &str)
29 void TraceProcess::setExecutablePath(const QString &str)
33 QFileInfo fi(m_execPath);
34 QString baseName = fi.baseName();
36 QString format = QString::fromLatin1("%1.trace");
42 while (QFile::exists(m_tracePath)) {
43 format = QString::fromLatin1("%1.%2.trace");
50 QString TraceProcess::executablePath() const
55 void TraceProcess::setArguments(const QStringList &args)
60 QStringList TraceProcess::arguments() const
65 void TraceProcess::traceFinished()
68 qDebug()<<"trace finished on " << m_tracePath;
69 qDebug()<<"\terr = "<<m_process->readAllStandardError();
70 qDebug()<<"\tout = "<<m_process->readAllStandardOutput();
72 emit tracedFile(m_tracePath);
75 void TraceProcess::traceError(QProcess::ProcessError err)
78 qDebug()<<"trace error = "<<m_tracePath;
79 qDebug()<<"\terr = "<<m_process->readAllStandardError();
80 qDebug()<<"\tout = "<<m_process->readAllStandardOutput();
82 emit error(m_process->readAllStandardError());
86 void TraceProcess::start()
88 QStringList arguments;
90 arguments << QLatin1String("trace");
91 arguments << QLatin1String("--api");
93 arguments << QLatin1String("--output");
94 arguments << m_tracePath;
95 arguments << QLatin1String("--");
96 arguments << m_execPath;
99 m_process->start(QLatin1String("apitrace"), arguments);
102 bool TraceProcess::canTrace() const
107 #include "traceprocess.moc"