* [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes
@ 2015-04-08 4:02 Yunlong Song
2015-04-08 8:55 ` Peter Zijlstra
2015-04-08 13:03 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 6+ messages in thread
From: Yunlong Song @ 2015-04-08 4:02 UTC (permalink / raw)
To: a.p.zijlstra, paulus, mingo, acme; +Cc: linux-kernel, wangnan0
Commit 31a9883106cc ("perf record: Add clockid parameter") used
CLOCK_MONOTONIC_RAW in the struct clockid_map clockids[], but the
CLOCK_MONOTONIC_RAW macro is not defined in older releases (e.g., SLES
11 SP2), thus there is a building error when making perf:
builtin-record.c:738: error: ‘CLOCK_MONOTONIC_RAW’ undeclared here (not in a function)
make[2]: *** [builtin-record.o] Error 1
make[2]: *** Waiting for unfinished jobs....
LD bench/perf-in.o
LD tests/perf-in.o
make[1]: *** [perf-in.o] Error 2
make: *** [all] Error 2
So define this macro if it is not defined.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
tools/perf/builtin-record.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index cfdff50..5b0962a 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -731,6 +731,9 @@ struct clockid_map {
#ifndef CLOCK_TAI
#define CLOCK_TAI 11
#endif
+#ifndef CLOCK_MONOTONIC_RAW
+#define CLOCK_MONOTONIC_RAW 4
+#endif
static const struct clockid_map clockids[] = {
/* available for all events, NMI safe */
--
1.8.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes
2015-04-08 4:02 [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes Yunlong Song
@ 2015-04-08 8:55 ` Peter Zijlstra
2015-04-08 12:46 ` Yunlong Song
2015-04-08 13:03 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2015-04-08 8:55 UTC (permalink / raw)
To: Yunlong Song; +Cc: paulus, mingo, acme, linux-kernel, wangnan0
On Wed, Apr 08, 2015 at 12:02:28PM +0800, Yunlong Song wrote:
> Commit 31a9883106cc ("perf record: Add clockid parameter") used
> CLOCK_MONOTONIC_RAW in the struct clockid_map clockids[], but the
> CLOCK_MONOTONIC_RAW macro is not defined in older releases (e.g., SLES
> 11 SP2), thus there is a building error when making perf:
>
> builtin-record.c:738: error: ‘CLOCK_MONOTONIC_RAW’ undeclared here (not in a function)
Weird that, CLOCK_MONOTONIC_RAW is said to be in the kernel since
2.6.28, SLES11 SP2 is 3.0 based, SP1 is 2.6.32.
Now the original SLES11 started life with 2.6.27, so it looks like
someone forgot to update their kernel headers when upgrading.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes
2015-04-08 8:55 ` Peter Zijlstra
@ 2015-04-08 12:46 ` Yunlong Song
0 siblings, 0 replies; 6+ messages in thread
From: Yunlong Song @ 2015-04-08 12:46 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: paulus, mingo, acme, linux-kernel, wangnan0
On 2015/4/8 16:55, Peter Zijlstra wrote:
> On Wed, Apr 08, 2015 at 12:02:28PM +0800, Yunlong Song wrote:
>> Commit 31a9883106cc ("perf record: Add clockid parameter") used
>> CLOCK_MONOTONIC_RAW in the struct clockid_map clockids[], but the
>> CLOCK_MONOTONIC_RAW macro is not defined in older releases (e.g., SLES
>> 11 SP2), thus there is a building error when making perf:
>>
>> builtin-record.c:738: error: ‘CLOCK_MONOTONIC_RAW’ undeclared here (not in a function)
>
> Weird that, CLOCK_MONOTONIC_RAW is said to be in the kernel since
> 2.6.28, SLES11 SP2 is 3.0 based, SP1 is 2.6.32.
>
> Now the original SLES11 started life with 2.6.27, so it looks like
> someone forgot to update their kernel headers when upgrading.
>
>
>
> .
>
Hi, Peter,
SLES 11 SP2 uses linux-kernel-headers-2.6.32-1.4.13, which really defines CLOCK_MONOTONIC_RAW
in <linux/time.h>. But the perf.h which is included in builtin-record.c uses <time.h> rather
than <linux/time.h>, and <time.h> finally includes <bits/time.h>. Both <time.h> and <bits/time.h>
belong to glibc-devel package, which is glibc-devel-2.11.3-17.31.1 for SLES11 SP2, and it does
not define CLOCK_MONOTONIC_RAW indeed. However, for the latest OSes (or say distributions), the
corresponding glibc-devel packages have already defined CLOCK_MONOTONIC_RAW.
--
Thanks,
Yunlong Song
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes
2015-04-08 4:02 [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes Yunlong Song
2015-04-08 8:55 ` Peter Zijlstra
@ 2015-04-08 13:03 ` Arnaldo Carvalho de Melo
2015-04-08 13:10 ` Yunlong Song
1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-04-08 13:03 UTC (permalink / raw)
To: Yunlong Song; +Cc: a.p.zijlstra, paulus, mingo, linux-kernel, wangnan0
Em Wed, Apr 08, 2015 at 12:02:28PM +0800, Yunlong Song escreveu:
> Commit 31a9883106cc ("perf record: Add clockid parameter") used
> CLOCK_MONOTONIC_RAW in the struct clockid_map clockids[], but the
> CLOCK_MONOTONIC_RAW macro is not defined in older releases (e.g., SLES
> 11 SP2), thus there is a building error when making perf:
>
> builtin-record.c:738: error: ‘CLOCK_MONOTONIC_RAW’ undeclared here (not in a function)
> make[2]: *** [builtin-record.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
> LD bench/perf-in.o
> LD tests/perf-in.o
> make[1]: *** [perf-in.o] Error 2
> make: *** [all] Error 2
>
> So define this macro if it is not defined.
Since I am fixing that pull request batch, I am folding this patch into
Peter's original, adding credit to you, ok?
- Arnaldo
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
> tools/perf/builtin-record.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index cfdff50..5b0962a 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -731,6 +731,9 @@ struct clockid_map {
> #ifndef CLOCK_TAI
> #define CLOCK_TAI 11
> #endif
> +#ifndef CLOCK_MONOTONIC_RAW
> +#define CLOCK_MONOTONIC_RAW 4
> +#endif
>
> static const struct clockid_map clockids[] = {
> /* available for all events, NMI safe */
> --
> 1.8.5.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes
2015-04-08 13:03 ` Arnaldo Carvalho de Melo
@ 2015-04-08 13:10 ` Yunlong Song
2015-04-08 13:33 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 6+ messages in thread
From: Yunlong Song @ 2015-04-08 13:10 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: a.p.zijlstra, paulus, mingo, linux-kernel, wangnan0
On 2015/4/8 21:03, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 08, 2015 at 12:02:28PM +0800, Yunlong Song escreveu:
>> Commit 31a9883106cc ("perf record: Add clockid parameter") used
>> CLOCK_MONOTONIC_RAW in the struct clockid_map clockids[], but the
>> CLOCK_MONOTONIC_RAW macro is not defined in older releases (e.g., SLES
>> 11 SP2), thus there is a building error when making perf:
>>
>> builtin-record.c:738: error: ‘CLOCK_MONOTONIC_RAW’ undeclared here (not in a function)
>> make[2]: *** [builtin-record.o] Error 1
>> make[2]: *** Waiting for unfinished jobs....
>> LD bench/perf-in.o
>> LD tests/perf-in.o
>> make[1]: *** [perf-in.o] Error 2
>> make: *** [all] Error 2
>>
>> So define this macro if it is not defined.
>
> Since I am fixing that pull request batch, I am folding this patch into
> Peter's original, adding credit to you, ok?
>
> - Arnaldo
OK.
--
Thanks,
Yunlong Song
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes
2015-04-08 13:10 ` Yunlong Song
@ 2015-04-08 13:33 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-04-08 13:33 UTC (permalink / raw)
To: Yunlong Song; +Cc: a.p.zijlstra, paulus, mingo, linux-kernel, wangnan0
Em Wed, Apr 08, 2015 at 09:10:47PM +0800, Yunlong Song escreveu:
> On 2015/4/8 21:03, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Apr 08, 2015 at 12:02:28PM +0800, Yunlong Song escreveu:
> >> Commit 31a9883106cc ("perf record: Add clockid parameter") used
> >> CLOCK_MONOTONIC_RAW in the struct clockid_map clockids[], but the
> >> CLOCK_MONOTONIC_RAW macro is not defined in older releases (e.g., SLES
> >> 11 SP2), thus there is a building error when making perf:
> >>
> >> builtin-record.c:738: error: ‘CLOCK_MONOTONIC_RAW’ undeclared here (not in a function)
> >> make[2]: *** [builtin-record.o] Error 1
> >> make[2]: *** Waiting for unfinished jobs....
> >> LD bench/perf-in.o
> >> LD tests/perf-in.o
> >> make[1]: *** [perf-in.o] Error 2
> >> make: *** [all] Error 2
> >>
> >> So define this macro if it is not defined.
> >
> > Since I am fixing that pull request batch, I am folding this patch into
> > Peter's original, adding credit to you, ok?
> >
> > - Arnaldo
>
> OK.
Thanks, that helps keeping the tree bisectable :-)
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-08 13:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-08 4:02 [PATCH] perf record: Conditionally define CLOCK_MONOTONIC_RAW for older OSes Yunlong Song
2015-04-08 8:55 ` Peter Zijlstra
2015-04-08 12:46 ` Yunlong Song
2015-04-08 13:03 ` Arnaldo Carvalho de Melo
2015-04-08 13:10 ` Yunlong Song
2015-04-08 13:33 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox