Re: [PATCH 1/4] kernel-shark :Fix all build warnings for gcc 10.2.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 30.09.20 г. 0:05 ч., Steven Rostedt wrote:
On Wed, 16 Sep 2020 09:50:04 +0300
"Yordan Karadzhov (VMware)" <y.karadz@xxxxxxxxx> wrote:

@@ -606,21 +603,17 @@ void KsTraceGraph::_updateGraphLegends()
  void KsTraceGraph::_updateTimeLegends()
  {
  	uint64_t sec, usec, tsMid;
-	QString tMin, tMid, tMax;
kshark_convert_nano(_glWindow.model()->histo()->min, &sec, &usec);
-	tMin.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
-	_labelXMin.setText(tMin);
+	_labelXMin.setText(_t2str(sec, usec));
tsMid = (_glWindow.model()->histo()->min +
  		 _glWindow.model()->histo()->max) / 2;
  	kshark_convert_nano(tsMid, &sec, &usec);
-	tMid.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
-	_labelXMid.setText(tMid);
+	_labelXMid.setText(_t2str(sec, usec));
kshark_convert_nano(_glWindow.model()->histo()->max, &sec, &usec);
-	tMax.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
-	_labelXMax.setText(tMax);
+	_labelXMax.setText(_t2str(sec, usec));
  }
/**
diff --git a/kernel-shark/src/KsTraceGraph.hpp b/kernel-shark/src/KsTraceGraph.hpp
index c53258c..8abc06b 100644
--- a/kernel-shark/src/KsTraceGraph.hpp
+++ b/kernel-shark/src/KsTraceGraph.hpp
@@ -108,6 +108,10 @@ private:
void _markerReDraw(); + QString _t2str(uint64_t sec, uint64_t usec) {
+		return QString::number(sec) + "." + QString::number(usec);

Hmm, if sec is 5 and usec is 1, would the above work? That is, would it
give:

	"5.000001"

Or would it give:

	"5.1"

which would be wrong.


Yes, this is wrong. Thanks a lot Steven!
Do you prefer to re-send the entire patch-set or only this one?

thanks,
Yordan

-- Steve

+	};
+
  	enum class GraphActions {
  		ZoomIn,
  		ZoomOut,



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux