From: Joe Perches on 5 Aug 2010 22:00 On Thu, 2010-08-05 at 22:46 -0300, Arnaldo Carvalho de Melo wrote: > From: Arnaldo Carvalho de Melo <acme(a)redhat.com> > By using BITS_PER_LONG/4 as the width specifier. [] > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > index 1c61a4f..b62a553 100644 > --- a/tools/perf/util/sort.c > +++ b/tools/perf/util/sort.c [] > - ret += repsep_snprintf(bf, size, "%#018llx %c ", self->ip, o); > + ret += repsep_snprintf(bf, size, "%*Lx %c ", > + BITS_PER_LONG / 4, self->ip, o); [] > - ret += repsep_snprintf(bf + ret, size - ret, "%#016llx", self->ip); > + ret += repsep_snprintf(bf + ret, size - ret, "%*Lx", > + BITS_PER_LONG / 4, self->ip); This drops leading 0's. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Joe Perches on 6 Aug 2010 11:40 On Fri, 2010-08-06 at 11:29 -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Aug 05, 2010 at 06:58:07PM -0700, Joe Perches escreveu: > > On Thu, 2010-08-05 at 22:46 -0300, Arnaldo Carvalho de Melo wrote: > > > From: Arnaldo Carvalho de Melo <acme(a)redhat.com> > > > By using BITS_PER_LONG/4 as the width specifier. > > [] > > > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > > > index 1c61a4f..b62a553 100644 > > > --- a/tools/perf/util/sort.c > > > +++ b/tools/perf/util/sort.c > > [] > > > - ret += repsep_snprintf(bf, size, "%#018llx %c ", self->ip, o); > > > + ret += repsep_snprintf(bf, size, "%*Lx %c ", > > > + BITS_PER_LONG / 4, self->ip, o); > > [] > > > - ret += repsep_snprintf(bf + ret, size - ret, "%#016llx", self->ip); > > > + ret += repsep_snprintf(bf + ret, size - ret, "%*Lx", > > > + BITS_PER_LONG / 4, self->ip); > > > > This drops leading 0's. > > Is this a problem? This removes clutter from the output, right? Dunno, you made an output that looked like a pointer address, 64 bit: "0x0123456789abcdef" now is " 123456789abcdef" 32 bit: "0x0000000001234567" now is " 1234567" snprintf(loc, size, "%#0*lx", BITS_PER_LONG / 4 + 2, (long)) might be better. snprintf(loc, size, "%p", (void)long) might be best. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Joe Perches on 6 Aug 2010 11:50 On Fri, 2010-08-06 at 08:35 -0700, Joe Perches wrote: > snprintf(loc, size, "%p", (void)long) > might be best. Oops. On the other hand, "%p", (void *) would compile without warnings and be what I meant in the first place... snprintf(loc, size, "%p", (void *)long) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: [PATCH 07/10] perf probe: Remove duplicated #include Next: [GIT PULL] viafb updates |