Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Alan Mikhak <alanmikhak@gmail.com>
To: Yordan Karadzhov <ykaradzhov@vmware.com>
Cc: "rostedt@goodmis.org" <rostedt@goodmis.org>,
	"linux-trace-devel@vger.kernel.org" 
	<linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] kernel-shark: Fix all warnings when building on 32 bit systems
Date: Sat, 15 Jun 2019 03:26:22 -0700
Message-ID: <CAOY98NeyG3HD-94SUC5+=iivi8rcw_3Vo8ESKrKz91X2DMCa6Q@mail.gmail.com> (raw)
In-Reply-To: <20190614135045.17223-4-ykaradzhov@vmware.com>

On Fri, Jun 14, 2019 at 6:51 AM Yordan Karadzhov <ykaradzhov@vmware.com> wrote:
>
> 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
>

Hi Yordan,

I had to manually apply your two patches from 2019-06-14 manually on top of your
first patch from 2019-06-12. I was able to build KernelShark on my
Raspberry Pi 3
model B+ and observe that your combined changes resolved the abort issue as
well as compiler warnings. I also observed the same good results on my
ODROID-XU3
from hardkernel.com which also runs a 32-bit armv7l kernel as well as
my 96Boards
ROCK960 model C which runs a 64-bit aarch64 kernel.

Please see bugzilla for an attached patch file which shows the
combined changes I
manually applied as your patches intended.

Regards,
Alan

      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 ` [PATCH v2 3/3] kernel-shark: Fix all warnings when building on 32 bit systems Yordan Karadzhov
2019-06-15 10:26   ` Alan Mikhak [this message]

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='CAOY98NeyG3HD-94SUC5+=iivi8rcw_3Vo8ESKrKz91X2DMCa6Q@mail.gmail.com' \
    --to=alanmikhak@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=ykaradzhov@vmware.com \
    /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