Maynard Johnson | 25 May 16:00
Picon
Favicon

[PATCH] Fix up anonymous mapping support in operf to include vdso, stack, and heap

[PATCH] Fix up anonymous mapping support in operf to include vdso, stack, and heap

Signed-off-by: Maynard Johnson <maynardj <at> us.ibm.com>

This patch has been pushed to the perf-events branch, but review comments are
welcome.

---
 libperf_events/operf_mangling.cpp |    2 +-
 libperf_events/operf_utils.cpp    |   17 +++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/libperf_events/operf_mangling.cpp b/libperf_events/operf_mangling.cpp
index 5b31e29..5165807 100644
--- a/libperf_events/operf_mangling.cpp
+++ b/libperf_events/operf_mangling.cpp
@@ -63,7 +63,7 @@ mangle_filename(struct operf_sfile * last, struct operf_sfile const * sf, int co
 	} else if (sf->is_anon) {
 		values.flags |= MANGLE_ANON;
 		values.image_name = mangle_anon(sf);
-		values.anon_name = "anon";
+		values.anon_name = sf->image_name;
 	} else {
 		values.image_name = sf->image_name;
 	}
diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp
index 42eecce..9ee9b80 100644
--- a/libperf_events/operf_utils.cpp
+++ b/libperf_events/operf_utils.cpp
@@ -208,12 +208,17 @@ static void __handle_mmap_event(event_t * event)
(Continue reading)

SourceForge.net | 23 May 17:05
Picon

[ oprofile-Bugs-3529111 ] opjitconv failed to parse JIT dump header

Bugs item #3529111, was opened at 2012-05-23 08:05
Message generated for change (Tracker Item Submitted) made by 
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116191&aid=3529111&group_id=16191

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: https://www.google.com/accounts ()
Assigned to: Nobody/Anonymous (nobody)
Summary: opjitconv failed to parse JIT dump header

Initial Comment:
The bug occurs on x86_64 Linux (Fedora 15) with oprofile installed from
oprofile-0.9.6-21.fc15.x86_64.rpm while trying to profile JIT code produced by 32-bit application.

The debug output of opjitconv shows:

header: bfd-arch=9, bfd-mach=1, bfd_target_name=2-i386

Note that target name must be "elf32-i386"

I assume that the "u64 timestamp" field of "jitheader" structure is 8-byte aligned and as result field
"bfd_target" is shifted 4 bytes forward.
(Continue reading)

Andi Kleen | 23 May 02:48

[PATCH 1/2] Implement the ANY Intel extra bit

From: Andi Kleen <ak <at> linux.intel.com>

Implement the ANY (any thread) extra bit for Intel CPUs. Needed
for some of the new events.

Signed-off-by: Andi Kleen <ak <at> linux.intel.com>
---
 libop/op_events.c |    3 +++
 libop/op_events.h |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libop/op_events.c b/libop/op_events.c
index bbb0130..49b9563 100644
--- a/libop/op_events.c
+++ b/libop/op_events.c
@@ -127,6 +127,9 @@ unsigned parse_extra(const char *s)
 		} else if (sscanf(s, "cmask=%x%n", &w, &o) >= 1) {
 			v |= (w & EXTRA_CMASK_MASK) << EXTRA_CMASK_SHIFT;
 			s += o;
+		} else if (strisprefix(s, "any")) {
+			v |= EXTRA_ANY;
+			s += 3;
 		} else {
 			parse_error("Illegal extra field modifier");
 		}
diff --git a/libop/op_events.h b/libop/op_events.h
index 8cbb622..1a65a7a 100644
--- a/libop/op_events.h
+++ b/libop/op_events.h
@@ -21,6 +21,7 @@ extern "C" {
(Continue reading)

Maynard Johnson | 23 May 00:05
Picon
Favicon

[PATCH] Change operf to create oprofile sample files during profiling instead of afterwards

[PATCH] Change operf to create oprofile sample files during profiling instead of afterwards

Previously, the 'operf-record' process read the perf_events sample data from the kernel
and wrote it to a temporary output file (operf.data).  Then, once the profiling session
was completed, a conversion was performed on that data to put it into oprofile format,
stored in the usual sample files in <session-dir>/samples/current.  I noticed that when
operf was run in system-wide mode, the temporary operf.data file was very large, and the
conversion step was taking inordinately long (from several seconds on a laptop to over
a minute on a large, busy server system.

I've had a TODO comment in the operf.cpp code to investigate performing the conversion
step in-flight (while profiling) versus waiting for the profiling to end.  So I changed
the operf-record process from writing the perf_events sample data to a file to writing
to a pipe.  Then I created a new operf-read process to read from the other end of that
pipe and perform the conversion to oprofile format.  Doing the conversion during the
profiling run allowed me to identify the hot spots in the opreport output. I found several
areas (especially involving the inefficiency of the operf_sfile hash algorithm) where
improvements were needed.  The conversion step now takes about 15% of the time it used
to! A wonderful result!

This patch has been committed to the perf-events branch, but review comments are welcome.

Signed-off-by: Maynard Johnson <maynardj <at> us.ibm.com>
---
 libperf_events/operf_counter.cpp |  214 ++++++++++++++++++----------------
 libperf_events/operf_counter.h   |   12 +-
 libperf_events/operf_event.h     |   11 --
 libperf_events/operf_sfile.cpp   |   74 ++++++------
 libperf_events/operf_sfile.h     |    2 +
 libperf_events/operf_utils.cpp   |  237 +++++++++++++-------------------------
(Continue reading)

Maynard Johnson | 22 May 16:15
Picon
Favicon

[PATCH] Remove reset option from operf and replace with append option

[PATCH] Remove reset option from operf and replace with append option.

By default, operf will now move old profile data from <session_dir>/samples/current
to <session_dir>/samples/previous.  If a 'previous' profile already existed,
it will be replaced.  If the --append option is passed, old profile data is left
in place and new profile data will be added to it, and the 'previous' profile
(if one existed) will remain untouched.

operf man page updates:
Aside from replacing the --reset option with the --append option, several unrelated
fixes were made, including adding the missing --vmlinux option.

This patch has been pushed up to the perf-events branch, but review comments are
as always, welcome.

Signed-off-by: Maynard Johnson <maynardj <at> us.ibm.com>
---
 doc/operf.1.in         |   36 ++++++++++++----
 pe_profiling/operf.cpp |  109 +++++++++++++++++++++++++++--------------------
 2 files changed, 90 insertions(+), 55 deletions(-)

diff --git a/doc/operf.1.in b/doc/operf.1.in
index 00b6b2c..00fb5f3 100644
--- a/doc/operf.1.in
+++ b/doc/operf.1.in
@@ -44,8 +44,9 @@ is required, but
 be used simultaneously.
 .br
 .TP
-.BI "--pid / -p [PID]"
(Continue reading)

Xin Tong | 21 May 06:16
Picon

Getting Data from Oprofile within JVM

What would be a good place to start to be able to get data from oprofile within JVM. i.e. i want to have JVM spawn a thread running the task of oprofiled. The data is then passed to and processed by the thread.
 
Thanks
 
Xin
 
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
oprofile-list mailing list
oprofile-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list
Xin Tong | 20 May 19:28
Picon

BR_INST_RETIRED on Intel microarchitecture

I am using oprofile in a JVM environment. I have 2 questions

1. I am not very familiar with intel microarchitecrure, BR_INST_RETIRED means the branch decision is correct and the branch instruction is committed ?
2. Can one obtain the address branched to in the PMU registers ? Oprofile does not seem to provide it.

Thanks

Xin

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
oprofile-list mailing list
oprofile-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list
SourceForge.net | 20 May 13:43
Picon

[ oprofile-Bugs-3528383 ] oprofied failed to open device on mpc8572 linux version 2.6.

Bugs item #3528383, was opened at 2012-05-20 04:43
Message generated for change (Tracker Item Submitted) made by tombkeeper
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116191&aid=3528383&group_id=16191

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: tombkeeper (tombkeeper)
Assigned to: Nobody/Anonymous (nobody)
Summary: oprofied failed to open device on mpc8572 linux version 2.6.

Initial Comment:
Linux version: 2.6.31
CPU: mpc8572, e500 core
oprofile version: 0.9.7

1>oprofile --init is ok

2>oprofile --start failed, error output:
Using 2.6+ OProfile kernel interface.
Failed to open device. Possibly you have passed incorrect
parameters. Check /var/log/messages.Couldn't start oprofiled.
Check the log file "/var/lib/oprofile/samples/oprofiled.log" and kernel syslog

3>check /var/log/message, nothing there. check  oprofiled.log, no such file exist.
4>oprofile -l: list all features supported by e500

I tried to use strace to find which open failed and got lots of /dev/oprofile/* opened, not sure which
failed. Also walking through oprofile code is not helpful, only see opening /dev/oprofile/buffer code
will output such errors.
Anyone knows how to debug this, to figure out if the issue is in kernel or application, if it is some incorrect parameter?
Thanks.
John

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116191&aid=3528383&group_id=16191

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Picon

Build error: oprofile with CONFIG_CPUMASK_OFFSTACK=y && SMP

My OMAP randconfig build found this build error last night:

arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:28: error: variably modified
'perf_events' at file scope

This is caused because nr_cpumask_bits is a variable when we're building
for a SMP system and CONFIG_CPUMASK_OFFSTACK is set.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Abdul Wahid Memon | 18 May 22:18
Picon

Need help in cross compiling oprofile

Hello everyone

I need some help in cross compiling oprofile for ARM V7 architecture.
Some hints would be really helpful.

Regards

Abdul

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Maynard Johnson | 17 May 16:12
Picon
Favicon

[PATCH] Make various minor cleanup fixes to operf

[PATCH] Make various minor cleanup fixes to operf

	- Remove or update stale comments
	- Add calls to cleanup() at error exit points
	- Add pre-check to verify user has access to sample data dir

Signed-off-by: Maynard Johnson <maynardj <at> us.ibm.com>
---
 libperf_events/operf_utils.cpp |    6 +----
 pe_profiling/operf.cpp         |   41 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp
index 1d18f32..4ff99c0 100644
--- a/libperf_events/operf_utils.cpp
+++ b/libperf_events/operf_utils.cpp
@@ -280,7 +280,6 @@ static struct operf_transient * __get_operf_trans(struct sample_data * data)
 			proc = it->second;
 			trans.cur_procinfo = proc;
 		} else {
-			// TODO
 			/* This can happen for the following reasons:
 			 *   - We get a sample before getting a COMM or MMAP
 			 *     event for the process being profiled
@@ -291,10 +290,7 @@ static struct operf_transient * __get_operf_trans(struct sample_data * data)
 			 *     process other than the one we requested (not
 			 *     likely -- this would be a kernel bug if it did)
 			 *
-			 * Need to look into caching these discarded samples and trying to
-			 * process them after we have a valid app name recorded.  This could
-			 * cause a lot of thrashing about.  But at the very least,
-			 * we need to log the lost sample.
+			 * TODO: log the lost sample if !first_time_processing
 			*/
 			if ((cverb << vmisc) && !first_time_processing)
 				cerr << "Dropping sample -- process info unavailable" << endl;
diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
index bab5b2a..4b2c65f 100644
--- a/pe_profiling/operf.cpp
+++ b/pe_profiling/operf.cpp
@@ -585,12 +585,13 @@ static void complete(void)
 	}
 	if (operf_options::reset) {
 		int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
-
+		errno = 0;
 		if (nftw(current_sampledir.c_str(), __delete_sample_data, 32, flags) !=0 &&
 				errno != ENOENT) {
-			cerr << "Problem encountered clearing old sample data."
-			     << " Possible permissions problem." << endl;
-			cerr << "Try a manual removal of " << current_sampledir << endl;
+			cerr << "Unable to remove old sample data at "
+			     << current_sampledir << "." << endl;
+			if (errno)
+				cerr << strerror(errno) << endl;
 			cleanup();
 			exit(1);
 		}
@@ -1066,8 +1067,6 @@ static void process_args(int argc, char const ** argv)
 	_process_session_dir();
 	outputfile = samples_dir + "/" + DEFAULT_OPERF_OUTFILE;

-	// TODO: Need to examine ocontrol to see what (if any) additional
-	// event verification is needed here.
 	if (operf_options::evts.empty()) {
 		// Use default event
 		get_default_event();
@@ -1129,14 +1128,44 @@ int main(int argc, char const *argv[])
 	my_uid = geteuid();
 	if (operf_options::system_wide && my_uid != 0) {
 		cerr << "You must be root to do system-wide profiling." << endl;
+		cleanup();
 		exit(1);
 	}

 	if (cpu_type == CPU_NO_GOOD) {
 		cerr << "Unable to ascertain cpu type.  Exiting." << endl;
+		cleanup();
 		exit(1);
 	}
 	op_nr_counters = op_get_nr_counters(cpu_type);
+
+	if (my_uid != 0) {
+		/* Pre-check to make sure we have permission to remove old sample data
+		 * or to create new sample data in the specified sample data directory.
+		 * If the user wants us to remove old data, we don't actually do it now,
+		 * since the profile session may fail for some reason or the user may do ctl-c.
+		 * We should exit without unnecessarily removing the old sample data as
+		 * the user may expect it to still be there after an aborted run.
+		 */
+		string current_sampledir = samples_dir + "/current";
+		string current_sampledir_testfile = current_sampledir + "/.xxxTeStFiLe";
+		ofstream afile;
+		errno = 0;
+		afile.open(current_sampledir_testfile.c_str());
+		if (!afile.is_open() && (errno != ENOENT)) {
+			if (operf_options::reset)
+				cerr << "Unable to remove old sample data at "
+				     << current_sampledir << "." << endl;
+			else
+				cerr << "Unable to write to sample data directory at "
+				     << current_sampledir << "." << endl;
+			if (errno)
+				cerr << strerror(errno) << endl;
+			cerr << "Try a manual removal of " << current_sampledir << endl;
+			cleanup();
+			exit(1);
+		}
+	}
 	end_code_t run_result;
 	if ((run_result = _run())) {
 		if (app_started && (run_result != APP_ABNORMAL_END)) {
--

-- 
1.6.2.rc2

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Gmane