forked from qt-creator/qt-creator
PerfProfiler: When saving is canceled, don't flush the buffer anymore
Flushing the compression buffer can be expensive. If the save operation is canceled we know that the user wants the process to stop ASAP. So, rather discard all remaining buffered data in that case. Change-Id: Id77ec6fabb5a26690a7d2d8596f25f44d3185253 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -376,6 +376,7 @@ public:
|
||||
device()->reset();
|
||||
}
|
||||
|
||||
void clear() { m_content.clear(); }
|
||||
int length() const { return m_content.length(); }
|
||||
|
||||
private:
|
||||
@@ -492,12 +493,16 @@ void PerfProfilerTraceFile::writeToDevice()
|
||||
|
||||
++i;
|
||||
if (bufferStream.length() > (1 << 25)) {
|
||||
updateProgress(progress + (remainingProgress * i / traceManager->numEvents()));
|
||||
if (updateProgress(progress + (remainingProgress * i / traceManager->numEvents())))
|
||||
bufferStream.flush();
|
||||
else
|
||||
bufferStream.clear();
|
||||
}
|
||||
}, nullptr, [&](){
|
||||
if (updateProgress(progress += remainingProgress))
|
||||
bufferStream.flush();
|
||||
else
|
||||
bufferStream.clear();
|
||||
}, [this](const QString &message) {
|
||||
fail(message);
|
||||
}, future());
|
||||
|
Reference in New Issue
Block a user