Re: [PATCH 00/12] libperf: Add events to perf/event.h

From: Jiri Olsa
Date: Tue Aug 27 2019 - 03:41:12 EST


On Mon, Aug 26, 2019 at 07:41:36PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Aug 26, 2019 at 07:14:19PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Mon, Aug 26, 2019 at 06:58:52PM +0200, Jiri Olsa escreveu:
> > > On Mon, Aug 26, 2019 at 01:18:49PM -0300, Arnaldo Carvalho de Melo wrote:
> > >
> > > SNIP
> > >
> > > > [perfbuilder@490c2c7bdaab ~]$ grep 'printf("lost' /tmp/build/perf/builtin-sched.i
> > > > printf("lost %" "l" "ll""u" " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > > [perfbuilder@490c2c7bdaab ~]$
> > > >
> > > > And if we do this on a fedora:30 x86_64:
> > > >
> > > > $ make -C tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i
> > > > [acme@quaco perf]$ grep -A4 'printf("lost' /tmp/build/perf/builtin-sched.i
> > > > printf("lost %" "l"
> > > > # 2646 "builtin-sched.c" 3 4
> > > > "l" "u"
> > > > # 2646 "builtin-sched.c"
> > > > " events on cpu %d\n", event->lost.lost, sample->cpu);
> > > > [acme@quaco perf]$
> > > >
> > > > I.e. on 32-bit arches we shouldn't add that extra "l", right?
> > >
> > > hum, I guess we could #ifdef it 64/32 bits
> >
> > I tried to figure out how to fix this better, but the int-ll64.h versus
> > int-l64.h versus how __u64 is defined got me confused and I ended up
> > with:
> >
> > #if __WORDSIZE == 64
>
> Make that:
>
> #ifdef __LP64__ to build on Alpine/musl libc.

awesome, thanks ;-)

jirka