[prev in list] [next in list] [prev in thread] [next in thread] 

List:       oprofile-list
Subject:    Re: 'precise_ip' compile error from OProfile Git tree
From:       Maynard Johnson <maynardj () us ! ibm ! com>
Date:       2013-07-22 15:44:47
Message-ID: 51ED536F.3010109 () us ! ibm ! com
[Download RAW message or body]

On 04/30/2013 08:29 AM, Maynard Johnson wrote:
> On 04/29/2013 08:13 PM, Langley, Scott E wrote:
> > Hi Folks,
> > 
> > I've trying to build OProfile from the latest source on a  machine running SUSE \
> > Enterprise Desktop Linux 11 SP2 with a recent Intel core7 CPU and I'm \
> > encountering the following error: 
> > Making all in libperf_events
> > make[2]: Entering directory `/local_static/git/oprofile/libperf_events'
> > g++ -DHAVE_CONFIG_H -I. -I..  -I ../libabi -I ../libutil -I ../libutil++ -I \
> > ../libop -I ../libdb -I ../libperf_events    -g -O2 -MT operf_utils.o -MD -MP -MF \
> > .deps/operf_utils.Tpo -c -o operf_utils.o operf_utils.cpp mv -f \
> > .deps/operf_utils.Tpo .deps/operf_utils.Po g++ -DHAVE_CONFIG_H -I. -I..  -I \
> > ../libabi -I ../libutil -I ../libutil++ -I ../libop -I ../libdb -I \
> > ../libperf_events    -g -O2 -MT operf_counter.o -MD -MP -MF \
> >                 .deps/operf_counter.Tpo -c -o operf_counter.o operf_counter.cpp
> > operf_counter.cpp: In constructor 'operf_counter::operf_counter(operf_event_t&, \
> > bool, bool, bool, bool, int)': operf_counter.cpp:211: error: 'struct \
> > perf_event_attr' has no member named 'precise_ip' make[2]: *** [operf_counter.o] \
> > Error 1
> 
> *Andi*, the code that's failing to compile above was added in a patch you \
> contributed (and which I accepted) on Oct 31, 2012. We did not take into \
> consideration that the precise_ip field did not exist in earlier versions of \
> perf_event.h.  Below is a partial patch to fix this problem.  It defines a new \
> macro, HAVE_PERF_PRECISE_IP, which will be set to '1' if the field exists or '0' \
> otherwise.  What's missing in the patch is what to do -- if anything -- if \
> HAVE_PERF_PRECISE_IP is '0'.  Can you help with that part of the patch, please. 
> Thanks!
Patch committed.

*Andi*, in the commit, I indicated "Acked by: Andi Kleen".

-Maynard

> 
> -Maynard
> 
> Index: op-master/configure.ac
> ===================================================================
> --- op-master.orig/configure.ac
> +++ op-master/configure.ac
> @@ -156,6 +156,25 @@ if test "$kernel_has_perf_events_support
> 	fi
> 	AC_DEFINE_UNQUOTED(HAVE_PERF_GUEST_MACROS, $HAVE_PERF_GUEST_MACROS, \
> [PERF_RECORD_MISC_GUEST_KERNEL is defined in perf_event.h])  rm -f \
> test-for-PERF_GUEST* +
> +	AC_MSG_CHECKING([whether precise_ip is defined in perf_event.h])
> +	rm -f test-for-precise-ip
> +	AC_LANG_CONFTEST(
> +		[AC_LANG_PROGRAM([[#include <linux/perf_event.h>]],
> +			[[struct perf_event_attr attr;
> +			attr.precise_ip = 2;]])
> +		])
> +	$CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS $PERF_EVENT_FLAGS -o \
> test-for-precise-ip  > /dev/null 2>&1 +	if test -f test-for-precise-ip; then
> +		echo "yes"
> +		HAVE_PERF_PRECISE_IP='1'
> +	else
> +		echo "no"
> +		HAVE_PERF_PRECISE_IP='0'
> +	fi
> +	AC_DEFINE_UNQUOTED(HAVE_PERF_PRECISE_IP, $HAVE_PERF_PRECISE_IP, [precise_ip is \
> defined in perf_event.h]) +	rm -f test-for-precise-ip*
> +
> else
> 	HAVE_PERF_EVENTS='0'
> 	AC_MSG_RESULT([No perf_events support available; falling back to legacy oprofile])
> Index: op-master/libperf_events/operf_counter.cpp
> ===================================================================
> --- op-master.orig/libperf_events/operf_counter.cpp
> +++ op-master/libperf_events/operf_counter.cpp
> @@ -206,7 +206,7 @@ operf_counter::operf_counter(operf_event
> 	if (separate_cpu)
> 		attr.sample_type |= PERF_SAMPLE_CPU;
> 	attr.type = PERF_TYPE_RAW;
> -#if defined(__i386__) || defined(__x86_64__)
> +#if ((defined(__i386__) || defined(__x86_64__)) && (HAVE_PERF_PRECISE_IP))
> 	if (evt.evt_code & EXTRA_PEBS) {
> 		attr.precise_ip = 2;
> 		evt.evt_code ^= EXTRA_PEBS;
> 
> --------------------------------------------
> > 
> > 
> > Here are my machine specs:
> > 
> > uname -a
> > Linux hyena 3.0.38-0.5-default #1 SMP Fri Aug 3 09:02:17 UTC 2012 (358029e) \
> > x86_64 x86_64 x86_64 GNU/Linux 
> > cat /etc/SuSE-release
> > SUSE Linux Enterprise Desktop 11 (x86_64)
> > VERSION = 11
> > PATCHLEVEL = 2
> > 
> > cat /proc/cpuinfo 
> > processor	: 0
> > vendor_id	: GenuineIntel
> > cpu family	: 6
> > model		: 58
> > model name	: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
> > stepping	: 9
> > cpu MHz		: 1600.000
> > cache size	: 8192 KB
> > physical id	: 0
> > siblings	: 8
> > core id		: 0
> > cpu cores	: 4
> > apicid		: 0
> > initial apicid	: 0
> > fpu		: yes
> > fpu_exception	: yes
> > cpuid level	: 13
> > wp		: yes
> > flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 \
> > clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc \
> > arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni \
> > pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 \
> > sse4_2 x2apic popcnt aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln \
> > pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms bogomips	: \
> > 6785.06 clflush size	: 64
> > cache_alignment	: 64
> > address sizes	: 36 bits physical, 48 bits virtual
> > power management:
> > ...
> > 
> > Any help or suggestions would be appreciated.
> > 
> > Thanks.
> > 
> 
> 
> ------------------------------------------------------------------------------
> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
> Get 100% visibility into your production application - at no cost.
> Code-level diagnostics for performance bottlenecks with <2% overhead
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap1
> _______________________________________________
> oprofile-list mailing list
> oprofile-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oprofile-list
> 


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
oprofile-list mailing list
oprofile-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic