aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-12-13 12:06:09 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-12-17 07:24:44 +0000
commit8fc9828a369b227d94428f4015b6f5006d312517 (patch)
tree42ccf02784446bae9a94f042e5d7b036e6dd6a37
parentab26e8add8521422f54102beed214686e98592c3 (diff)
qmlprofiler: Use std::cerr directly rather than through QTextStream
The application output already is in the right text encoding. There is no point in re-encoding it. The re-encoding is actually expensive enough to delay the target application in some cases, and that distorts the profiling results. Change-Id: I3a6c47801cba072f6cfff8d0d2c3d10725750d00 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 04ad4b31e2..a1e4d9a153 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -29,7 +29,6 @@
#include "qmlprofilerapplication.h"
#include "constants.h"
#include <QtCore/QStringList>
-#include <QtCore/QTextStream>
#include <QtCore/QProcess>
#include <QtCore/QTimer>
#include <QtCore/QDateTime>
@@ -38,6 +37,8 @@
#include <QtCore/QCommandLineParser>
#include <QtCore/QTemporaryFile>
+#include <iostream>
+
static const char commandTextC[] =
"The following commands are available:\n"
"'r', 'record'\n"
@@ -120,10 +121,8 @@ QmlProfilerApplication::~QmlProfilerApplication()
logStatus("Killing process ...");
m_process->kill();
}
- if (isInteractive()) {
- QTextStream err(stderr);
- err << endl;
- }
+ if (isInteractive())
+ std::cerr << std::endl;
delete m_process;
}
@@ -539,10 +538,8 @@ void QmlProfilerApplication::disconnected()
void QmlProfilerApplication::processHasOutput()
{
Q_ASSERT(m_process);
- while (m_process->bytesAvailable()) {
- QTextStream out(stderr);
- out << m_process->readAll();
- }
+ while (m_process->bytesAvailable())
+ std::cerr << m_process->readAll().constData();
}
void QmlProfilerApplication::processFinished()
@@ -594,10 +591,9 @@ void QmlProfilerApplication::traceFinished()
void QmlProfilerApplication::prompt(const QString &line, bool ready)
{
if (m_interactive) {
- QTextStream err(stderr);
if (!line.isEmpty())
- err << line << endl;
- err << QLatin1String("> ");
+ std::cerr << qPrintable(line) << std::endl;
+ std::cerr << "> ";
if (ready)
emit readyForCommand();
}
@@ -605,14 +601,12 @@ void QmlProfilerApplication::prompt(const QString &line, bool ready)
void QmlProfilerApplication::logError(const QString &error)
{
- QTextStream err(stderr);
- err << "Error: " << error << endl;
+ std::cerr << "Error: " << qPrintable(error) << std::endl;
}
void QmlProfilerApplication::logStatus(const QString &status)
{
if (!m_verbose)
return;
- QTextStream err(stderr);
- err << status << endl;
+ std::cerr << qPrintable(status) << std::endl;
}