Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org" 
	<linux-trace-devel@vger.kernel.org>,
	Yordan Karadzhov <ykaradzhov@vmware.com>,
	Alan Mikhak <alanmikhak@gmail.com>
Subject: [PATCH v2 3/3] kernel-shark: Fix all warnings when building on 32 bit systems
Date: Fri, 14 Jun 2019 13:51:23 +0000
Message-ID: <20190614135045.17223-4-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20190614135045.17223-1-ykaradzhov@vmware.com>

Fixing warnings coming from:
../examples/datahisto.c
../src/KsTraceGraph.cpp
../src/libkshark.c

Reported-by: Alan Mikhak <alanmikhak@gmail.com>
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark/examples/datahisto.c |  4 ++--
 kernel-shark/src/KsTraceGraph.cpp | 10 +++++-----
 kernel-shark/src/libkshark.c      |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel-shark/examples/datahisto.c b/kernel-shark/examples/datahisto.c
index 02c6285..b177b08 100644
--- a/kernel-shark/examples/datahisto.c
+++ b/kernel-shark/examples/datahisto.c
@@ -56,11 +56,11 @@ void dump_bin(struct kshark_trace_histo *histo, int bin,
 		puts ("EMPTY BIN");
 	} else {
 		entry_str = kshark_dump_entry(e_front);
-		printf("%li -> %s\n", i_front, entry_str);
+		printf("%zd -> %s\n", i_front, entry_str);
 		free(entry_str);
 
 		entry_str = kshark_dump_entry(e_back);
-		printf("%li -> %s\n", i_back, entry_str);
+		printf("%zd -> %s\n", i_back, entry_str);
 		free(entry_str);
 	}
 
diff --git a/kernel-shark/src/KsTraceGraph.cpp b/kernel-shark/src/KsTraceGraph.cpp
index da2c6aa..324f36e 100644
--- a/kernel-shark/src/KsTraceGraph.cpp
+++ b/kernel-shark/src/KsTraceGraph.cpp
@@ -277,7 +277,7 @@ void KsTraceGraph::_resetPointer(uint64_t ts, int cpu, int pid)
 	QString pointer;
 
 	kshark_convert_nano(ts, &sec, &usec);
-	pointer.sprintf("%lu.%06lu", sec, usec);
+	pointer.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
 	_labelP2.setText(pointer);
 
 	if (pid > 0 && cpu >= 0) {
@@ -313,7 +313,7 @@ void KsTraceGraph::_setPointerInfo(size_t i)
 	uint64_t sec, usec;
 
 	kshark_convert_nano(e->ts, &sec, &usec);
-	pointer.sprintf("%lu.%06lu", sec, usec);
+	pointer.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
 	_labelP2.setText(pointer);
 
 	comm.append("-");
@@ -601,17 +601,17 @@ void KsTraceGraph::_updateTimeLegends()
 	QString tMin, tMid, tMax;
 
 	kshark_convert_nano(_glWindow.model()->histo()->min, &sec, &usec);
-	tMin.sprintf("%lu.%06lu", sec, usec);
+	tMin.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
 	_labelXMin.setText(tMin);
 
 	tsMid = (_glWindow.model()->histo()->min +
 		 _glWindow.model()->histo()->max) / 2;
 	kshark_convert_nano(tsMid, &sec, &usec);
-	tMid.sprintf("%lu.%06lu", sec, usec);
+	tMid.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
 	_labelXMid.setText(tMid);
 
 	kshark_convert_nano(_glWindow.model()->histo()->max, &sec, &usec);
-	tMax.sprintf("%lu.%06lu", sec, usec);
+	tMax.sprintf("%" PRIu64 ".%06" PRIu64 "", sec, usec);
 	_labelXMax.setText(tMax);
 }
 
diff --git a/kernel-shark/src/libkshark.c b/kernel-shark/src/libkshark.c
index 0f0a1ba..9aaf1b7 100644
--- a/kernel-shark/src/libkshark.c
+++ b/kernel-shark/src/libkshark.c
@@ -1423,7 +1423,7 @@ char* kshark_dump_custom_entry(struct kshark_context *kshark_ctx,
 	event_name = info_func(kshark_ctx, entry, false);
 	info = info_func(kshark_ctx, entry, true);
 
-	size = asprintf(&entry_str, "%li; %s-%i; CPU %i; ; %s; %s",
+	size = asprintf(&entry_str, "%" PRIu64 "; %s-%i; CPU %i; ; %s; %s",
 			entry->ts,
 			task,
 			entry->pid,
@@ -1472,7 +1472,7 @@ char* kshark_dump_entry(const struct kshark_entry *entry)
 		event_name = event? event->name : "[UNKNOWN EVENT]";
 		lat = kshark_get_latency(kshark_ctx->pevent, data);
 
-		size = asprintf(&temp_str, "%li; %s-%i; CPU %i; %s;",
+		size = asprintf(&temp_str, "%" PRIu64 "; %s-%i; CPU %i; %s;",
 				entry->ts,
 				task,
 				entry->pid,
-- 
2.20.1


  parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-14 13:51 [PATCH v2 0/3] Fixes needed befor KS 1.0 Yordan Karadzhov
2019-06-14 13:51 ` [PATCH v2 1/3] kernel-shark: Fix a bug when plotting the last trace record Yordan Karadzhov
2019-06-14 13:51 ` [PATCH v2 2/3] kernel-shark: Always use 64 bit variables for timestamps Yordan Karadzhov
2019-06-14 13:51 ` Yordan Karadzhov [this message]
2019-06-15 10:26   ` [PATCH v2 3/3] kernel-shark: Fix all warnings when building on 32 bit systems Alan Mikhak

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190614135045.17223-4-ykaradzhov@vmware.com \
    --to=ykaradzhov@vmware.com \
    --cc=alanmikhak@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org linux-trace-devel@archiver.kernel.org
	public-inbox-index linux-trace-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox