William Cohen | 29 Jan 16:28 2015
Picon

Re: operf taking 100% cpu

On 01/28/2015 08:13 PM, Xin Tong wrote:
> is there a GUI based tool to read perfect output? I use IBM VPA to read the .opm produced by oprofile
> 
> thanks 
> xin

Hi Xin,

There is a Text User Interface (TUI) in the "perf report" to navigate the information.  There is also an
plugin for Eclipse to read information from perf:

https://eclipse.org/linuxtools/projectPages/perf/

I don't know how either of those compare to IBM's Visual Performance Analyzer.

-Will

> 
> On Wednesday, January 28, 2015, William Cohen <wcohen <at> redhat.com <mailto:wcohen <at> redhat.com>> wrote:
> 
>     On 01/28/2015 03:47 PM, Xin Tong wrote:
>     > does perf has anything to do with operf ?
>     >
>     > Xin
> 
>     Hi Xin,
> 
>     The names are similar but they are different tools. perf is a tool developed by kernel engineers. operf is a
tool in the oprofile.  They both are using the same underlying linux kernel perf support to access the
performance monitoring hardware, but store their data in different formats and have different options.
(Continue reading)

William Cohen | 28 Jan 23:30 2015
Picon

Re: operf taking 100% cpu

On 01/28/2015 03:47 PM, Xin Tong wrote:
> does perf has anything to do with operf ? 
> 
> Xin

Hi Xin,

The names are similar but they are different tools. perf is a tool developed by kernel engineers. operf is a
tool in the oprofile.  They both are using the same underlying linux kernel perf support to access the
performance monitoring hardware, but store their data in different formats and have different options.

-Will
> 
> On Tue, Jan 27, 2015 at 9:03 PM, William Cohen <wcohen <at> redhat.com <mailto:wcohen <at> redhat.com>> wrote:
> 
>     On 01/27/2015 06:51 PM, Xin Tong wrote:
>     > ​what does perf do ? is it a different tool from operf ? the perf command generates perf.data and i do not
need to tell it what performance counters i want to collect ?
>     >
>     > bash-4.1$ perf record --pid=44637
>     >    755 root      39  19     0    0    0 R 100.0  0.0  14085:51 kipmi0
>     >  44637 xintong1  20   0  3928  344  268 R 100.0  0.0   0:37.75 loop
> 
>     Hi Xin,
> 
>     perf is a tools that is included in the kernel source that also uses the performance monitoring hardware
like operf. Most newer linux distributions also package the perf executables in a package.  By default it
uses cycles as the thing sampling metric.  Assuming that you have perf installed on the machine you can do
record some data with the following (hit cntl-c to stop data recording)
> 
(Continue reading)

William Cohen | 28 Jan 06:03 2015
Picon

Re: operf taking 100% cpu

On 01/27/2015 06:51 PM, Xin Tong wrote:
> ​what does perf do ? is it a different tool from operf ? the perf command generates perf.data and i do not
need to tell it what performance counters i want to collect ?
> 
> bash-4.1$ perf record --pid=44637
>    755 root      39  19     0    0    0 R 100.0  0.0  14085:51 kipmi0
>  44637 xintong1  20   0  3928  344  268 R 100.0  0.0   0:37.75 loop

Hi Xin,

perf is a tools that is included in the kernel source that also uses the performance monitoring hardware
like operf. Most newer linux distributions also package the perf executables in a package.  By default it
uses cycles as the thing sampling metric.  Assuming that you have perf installed on the machine you can do
record some data with the following (hit cntl-c to stop data recording)

$ perf record --pid=44637

This will record data in perf.data in the directory.  The use the following to look at the data

$ perf report

The following URL has more information about perf:

http://web.eece.maine.edu/~vweaver/projects/perf_events/

-Will

> 
> 
> ​
(Continue reading)

Andrew Jones | 26 Jan 13:28 2015
Picon

opcontrol sh: write error: Invalid argument

Hi Everyone,

Recently I cross-compiled Oprofiler for MIPS.
When  I run --start, I'm getting 'write error'.  Details are below:

# pwd
/root
# export OPROFILE_EVENTS_DIR=/root
# ./opcontrol --deinit
dump fail: daemon died during last run ?
Detected stale lock file. Removing.
# ./opcontrol --no-vmlinux
# ./opcontrol --reset
# ./opcontrol --init
# ./opcontrol --event=CYCLES:1000:0:1:1
# ./opcontrol --status
Daemon not running
Session-dir: /var/lib/oprofile
Event 0: CYCLES:1000:0:1:1
Separate options: none
vmlinux file: none
Image filter: none
Call-graph depth: 0
# ./opcontrol --start
sh: write error: Invalid argument
Using 2.6+ OProfile kernel interface.
Using log file /var/lib/oprofile/samples/oprofiled.log
Daemon started.
Profiler running.


Unfortunately my sh isn't giving me a line number along with that error.
Any help would greatly appreciated.

oprofiled.log:
oprofiled started Tue Nov 30 00:46:05 1999
kernel pointer size: 4
Failed to exec opjitconv: No such file or directory
oprofiled: open of /var/lib/oprofile/samples//current/{root}//bin/busybox/{dep}/{root}//bin/busybox/INSTRUCTIONS.100000.0.all.all.all failed: Invalid argument
...


Thankyou so much!
Andrew


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
oprofile-list mailing list
oprofile-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list
Xin Tong | 23 Jan 00:57 2015
Picon

operf taking 100% cpu

I am running oprofile on a linux intel haswell machine. and the operf process is taking close to 100% of the time. what is operf doing with that amount of cpu cycles ? maybe its polling on something ? how do i fix this ?

operf --separate-thread --event=CPU_CLK_UNHALTED:10000000 ./gcc/bin/viterb00data_2.exe -autogo && opreport  -l -g -d --xml -o current.opm

top - 15:56:34 up 69 days,  2:59, 13 users,  load average: 2.04, 1.71, 1.43
Tasks: 1196 total,   4 running, 1191 sleeping,   1 stopped,   0 zombie
Cpu(s):  1.1%us,  0.1%sy,  0.0%ni, 98.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  60853364k total, 39834668k used, 21018696k free,   818524k buffers
Swap: 20479992k total,     1428k used, 20478564k free, 34594044k cached

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
   755 root      39  19     0    0    0 R 98.3  0.0   6891:01 kipmi0
118201 xintong1  20   0 14448 1700 1412 R 98.3  0.0   0:03.06 operf
118206 xintong1  20   0 15020  660  524 R 98.3  0.0   0:03.06 viterb00data_2.


Thanks,
Xin
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
oprofile-list mailing list
oprofile-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list
Nagesh Lagishetty | 19 Jan 15:57 2015
Picon

How to compare two oprofile collected stats/logs

Hi,

To debug a performance issue, I ran the oprofile on working image and faulty image.

root> opcontrol --start --no-vmlinux --separate=lib --callgraph 5
<run the application>
root> opcontrol –-stop 
root> opcontrol --dump
root> opreport -l
root> opcontrol --shutdown

Now i have both working and faulty image stats, how to compare both?

root> opreport  /flash/oprofile_working_image /flash/oprofile_issue_image
Using /var/lib/oprofile/samples/ for samples directory.
WARNING! The OProfile kernel driver reports sample buffer overflows.
Such overflows can result in incorrect sample attribution, invalid sample
files and other symptoms.  See the oprofiled.log for details.
You should adjust your sampling frequency to eliminate (or at least minimize)
these overflows.
error: no sample files found: profile specification too strict ?


Please provide the input.

Thanks in advance.

Nagesh
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
oprofile-list mailing list
oprofile-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list
William Cohen | 9 Jan 23:07 2015
Picon

[PATCH] Allow operf to track anon_hugepage mmap entries

The perf mmap information for anon_huge pages has a different filename
("/anon_hugepage") than the mmap information for regions composed of
normal sized pages ("//anon").  This results in opreport not being
able to map samples collected by operf to Java methods when the Java
VM uses statically allocated huge pages (rhbz1180512 and rhbz1180513).

Signed-off-by: William Cohen <wcohen <at> redhat.com>
---
 libperf_events/operf_utils.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp
index a87524b..90a0765 100644
--- a/libperf_events/operf_utils.cpp
+++ b/libperf_events/operf_utils.cpp
 <at>  <at>  -295,6 +295,10  <at>  <at>  static void __handle_mmap_event(event_t * event)
 		                    strlen("//anon")) == 0)) {
 			mapping->is_anon_mapping = true;
 			strcpy(mapping->filename, "anon");
+		} else if ((strncmp(mapping->filename, "/anon_hugepage",
+		                    strlen("/anon_hugepage")) == 0)) {
+			mapping->is_anon_mapping = true;
+			strcpy(mapping->filename, "anon");
 		}
 		mapping->end_addr = (event->mmap.len == 0ULL)? 0ULL : mapping->start_addr + event->mmap.len - 1;
 		mapping->pgoff = event->mmap.pgoff;
--

-- 
2.1.0

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
William Cohen | 8 Jan 22:56 2015
Picon

[PATCH] Avoid permanently setting POSIXLY_CORRECT environment variable

During testing on Fedora it was discovered that operf was setting the
enviroment variable POSIXLY_CORRECT and this could potentially be
observed in the children tasks that operf starts (Red Hat Bugzilla
1178577). The operf, ocount, and opjitconv commands all ensure that
POSIXLY_CORRECT environment variable is set when the options are
processed with getopt_long, but they never unset the variable
afterwards.  This patch ensures that POSIXLY_CORRECT is as it was
before it was set.

Signed-off-by: William Cohen <wcohen <at> redhat.com>
---
 opjitconv/opjitconv.c  | 5 +++++
 pe_counting/ocount.cpp | 5 +++++
 pe_profiling/operf.cpp | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/opjitconv/opjitconv.c b/opjitconv/opjitconv.c
index 0a6e738..e28bd29 100644
--- a/opjitconv/opjitconv.c
+++ b/opjitconv/opjitconv.c
 <at>  <at>  -819,6 +819,7  <at>  <at>  static int _process_args(int argc, char * const argv[])
 {
 	int keep_trying = 1;
 	int idx_of_non_options = 0;
+	char * prev_env = getenv("POSIXLY_CORRECT");
 	setenv("POSIXLY_CORRECT", "1", 0);
 	while (keep_trying) {
 		int option_idx = 0;
 <at>  <at>  -853,6 +854,10  <at>  <at>  static int _process_args(int argc, char * const argv[])
 			break;
 		}
 	}
+
+	if (prev_env == NULL)
+		unsetenv("POSIXLY_CORRECT");
+
 	return idx_of_non_options;
 }

diff --git a/pe_counting/ocount.cpp b/pe_counting/ocount.cpp
index 07dfd0c..f7caede 100644
--- a/pe_counting/ocount.cpp
+++ b/pe_counting/ocount.cpp
 <at>  <at>  -579,6 +579,7  <at>  <at>  static int _process_ocount_and_app_args(int argc, char * const argv[])
 {
 	bool keep_trying = true;
 	int idx_of_non_options = 0;
+	char * prev_env = getenv("POSIXLY_CORRECT");
 	setenv("POSIXLY_CORRECT", "1", 0);
 	while (keep_trying) {
 		int option_idx = 0;
 <at>  <at>  -663,6 +664,10  <at>  <at>  static int _process_ocount_and_app_args(int argc, char * const argv[])
 			__print_usage_and_exit("ocount: unexpected end of arg parsing");
 		}
 	}
+
+	if (prev_env == NULL)
+		unsetenv("POSIXLY_CORRECT");
+
 	return idx_of_non_options;
 }

diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
index 04a25d9..a186278 100644
--- a/pe_profiling/operf.cpp
+++ b/pe_profiling/operf.cpp
 <at>  <at>  -1258,6 +1258,7  <at>  <at>  static int _process_operf_and_app_args(int argc, char * const argv[])
 {
 	bool keep_trying = true;
 	int idx_of_non_options = 0;
+	char * prev_env = getenv("POSIXLY_CORRECT");
 	setenv("POSIXLY_CORRECT", "1", 0);
 	while (keep_trying) {
 		int option_idx = 0;
 <at>  <at>  -1331,6 +1332,10  <at>  <at>  static int _process_operf_and_app_args(int argc, char * const argv[])
 			__print_usage_and_exit("unexpected end of arg parsing");
 		}
 	}
+
+	if (prev_env == NULL)
+		unsetenv("POSIXLY_CORRECT");
+
 	return idx_of_non_options;
 }

--

-- 
2.1.0

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
Will Schmidt | 7 Jan 17:51 2015
Picon

[Patch/RFC] Oprofile-testsuite, handle power-savings-mode changes during scaling test

The scaling tests will fail if the power-savings-mode changes while the
test is running.  (idle/slow <-> non-idle/fast).
This adds some logic to check the power state before and after running
the ocount scaling workload, and reruns the workload if the state has
changed before it attempts to process results.

Signed-off-by: Will Schmidt <will_schmidt <at> vnet.ibm.com>
---

 lib/op_util.exp                |   36 ++++++++++++++++++++++++++++++
 oprofile-ocount/ocount-run.exp |   49 ++++++++++++++++++++++++++++++++---------
 2 files changed, 75 insertions(+), 10 deletions(-)

diff --git a/testsuite/lib/op_util.exp b/testsuite/lib/op_util.exp
index 08eaa6c..cb0da1e 100644
--- a/testsuite/lib/op_util.exp
+++ b/testsuite/lib/op_util.exp
 <at>  <at>  -27,6 +27,42  <at>  <at>  proc found_error {msg} {
     exit 1
 }

+# collect the current power_mode_data value.  We collect it from
+# the lparcfg interface.  The field value ultimately comes from firmware.
+proc get_baseline_power_savings_mode {} {
+	global initial_power_mode_data_string
+	set initial_power_mode_data_string [ local_exec "grep ^power_mode_data /proc/ppc64/lparcfg" ""
"" 100 ]
+	if { [ regexp -line "power_mode_data=\[0-9\]+" $initial_power_mode_data_string line] != 1 } {
+		verbose "Did not find a power_mode_data value.\n"
+		set initial_power_mode_data_string "unset"
+	}
+}
+
+# verify the current power_mode_data value is unchanged.  A change in this value
+# indicates the systems power saving state has changed, which will affect the
+# test results.
+proc confirm_power_savings_mode {} {
+	global initial_power_mode_data_string
+	global power_mode_has_changed
+	# Pause a few seconds here.  This allows the lparcfg reported value to
+	# catch up with the current setting.  In practice, the lparcfg reported
+	# value does not immediately reflect the change in power modes.
+	local_exec "sleep 1" "" "" 5
+	set current_power_mode_data_string [ local_exec "grep ^power_mode_data /proc/ppc64/lparcfg" ""
"" 100 ]
+	if { [ regexp -line "power_mode_data=\[0-9\]+" $current_power_mode_data_string line] != 1 } {
+		verbose "did not find a power_mode_data value.\n"
+		set current_power_mode_data_string "unset"
+		set power_mode_has_changed 0
+	} elseif { $initial_power_mode_data_string != $current_power_mode_data_string } {
+		verbose "  power_mode_data value has changed. was:  \[$initial_power_mode_data_string\] \n"
+		verbose "                                     now:  \[$current_power_mode_data_string\] \n"
+		set power_mode_has_changed 1
+	} else {
+		verbose "power_mode_data value has not changed since the last baseline check.\n"
+		set power_mode_has_changed 0
+	}
+}
+
 # read contents of file and return
 proc op_get_file_contents {fname} {
     set fd [open $fname]
diff --git a/testsuite/oprofile-ocount/ocount-run.exp b/testsuite/oprofile-ocount/ocount-run.exp
index 9c75fda..6e4942c 100644
--- a/testsuite/oprofile-ocount/ocount-run.exp
+++ b/testsuite/oprofile-ocount/ocount-run.exp
 <at>  <at>  -110,16 +110,45  <at>  <at>  proc do_test_ocount_scaling {workload_exec} {

     set event [get_cycles_event]

-    set pid [exec $workload_exec > /tmp/junky.xwyesu.xse &]
-
-    # allow workload to reach steady state
-    local_exec "sleep 1" "" "" 10
-
-    set result1 [local_exec "taskset -c 0 ocount -e ${event} --time-interval $run_time_interval1:1 -p
$pid" "" "" 60]
-    set result2 [local_exec "taskset -c 0 ocount -e ${event} --time-interval $run_time_interval2:1 -p
$pid" "" "" 60]
-    set result4 [local_exec "taskset -c 0 ocount -e ${event} --time-interval $run_time_interval4:1 -p
$pid" "" "" 60]
-
-    test_kill_workload $pid
+#     Logic here to handle a scenario where the system is switching between
+#     power states.  Since a change in power saving modes will throw off
+#     the scaling test results, if we detect the state has changed, we
+#     will re-run the tests before attempting to process any results.
+	set retry_limit 3
+	set retry_count 0
+	global power_mode_has_changed
+	set power_mode_has_changed 99
+
+	# loop to validate power_savings_mode status begins here
+	while {$power_mode_has_changed > 0} {
+		incr retry_count
+		get_baseline_power_savings_mode
+
+		    set pid [exec $workload_exec > /tmp/junky.xwyesu.xse &]
+
+		    # allow workload to reach steady state
+		    local_exec "sleep 1" "" "" 10
+
+		    set result1 [local_exec "taskset -c 0 ocount -e ${event} --time-interval $run_time_interval1:1 -p
$pid" "" "" 60]
+		    set result2 [local_exec "taskset -c 0 ocount -e ${event} --time-interval $run_time_interval2:1 -p
$pid" "" "" 60]
+		    set result4 [local_exec "taskset -c 0 ocount -e ${event} --time-interval $run_time_interval4:1 -p
$pid" "" "" 60]
+
+		    test_kill_workload $pid
+
+		confirm_power_savings_mode
+
+		if { $power_mode_has_changed == 0 } {
+			# no change detected.  Good to go.
+			verbose "valid run (The power_savings_mode value was stable, or not present)\n"
+		} elseif {$retry_count > $retry_limit} {
+			# exceeded our arbitrary retry limit.
+			send "Warning: Unable to verify a clean run due to power_savings_mode fluctuations.\n"
+			break
+		} else {
+			verbose "Informational: Detected power_savings_mode fluctuation. (iteration #$retry_count)\n"
+		}
+	# end of power_savings_mode loop.
+	}

     set count1 [get_event_count $result1 $event]
     set count2 [get_event_count $result2 $event]

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
Carl Love | 5 Jan 19:44 2015
Picon

[PATCH] Oprofile-testsuite, skip mode selection tests if not supported.


Event counts may occur when the system is running in user mode, kernel
mode or hypervisor modes.  Some architectures have settings that allow
the user to select which modes the events should be collected.  The
testsuite contains tests to make sure sum of counting in each of the modes
individually is the same as counting in the modes simultaneously.  This
patch skips these tests for architectures that do not support mode selection

Signed-off-by: Carl Love <carll <at> us.ibm.com>
---
 testsuite/lib/ocount_util.exp            |   71 ++++++++++++++++++++++++++++++
 testsuite/oprofile-ocount/ocount-run.exp |   16 +++++++
 2 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/testsuite/lib/ocount_util.exp b/testsuite/lib/ocount_util.exp
index c8913f2..1a1d46a 100644
--- a/testsuite/lib/ocount_util.exp
+++ b/testsuite/lib/ocount_util.exp
 <at>  <at>  -196,3 +196,74  <at>  <at>  proc ocount_get_version {} {
     operf_ocount_get_version "ocount"
     set ocount_version $operf_ocount_version
 }
+
+proc arch_does_not_support_exclusive_mode_settings {} {
+    set arch [lindex [split [local_exec "ophelp --get-cpu-type" "" "" 10] "\{" ] 1]
+
+    # Event counts may occur when the system is running in user mode, kernel
+    # mode or hypervisor modes.  Some architectures have settings that allow
+    # the user to select which modes the events should be collected in.  Return
+    # 1 if the architecture being tested does not support selecting the mode
+    # to collect the counts in, otherwise, return 0.
+
+    # The cpu "pretty" descriptions strings come from:
+    #    static struct cpu_descr const cpu_descrs[MAX_CPU_TYPE]  
+    # in op_cpu_type.c.
+
+    ## ARM
+    if {[ regexp "ARM/XScale PMU1" $arch ] == 1 } {  # arm/xcale1
+        return  1
+    }
+
+    if {[ regexp "ARM/XScale PMU2" $arch ] == 1 } {  # arm/xscale2
+        return  1
+    }
+
+    if {[ regexp "ARM 11MPCore" $arch ] == 1 } {  # arm/mpcore
+        return  1
+    }
+
+    if {[ regexp "ARM V6 PMU" $arch ] == 1 } {  # arm/armv6
+        return  1
+    }
+
+    if {[ regexp "ARM Cortex-A8" $arch ] == 1 } {  # arm/armv7
+        return  1
+    }
+
+    if {[ regexp "ARM Cortex-A9" $arch ] == 1 } {  # arm/armv7-ca9
+        return  1
+    }
+
+    if {[ regexp "ARMv7 Scorpion" $arch ] == 1 } {  # arm/armv7-scorpion
+        return  1
+    }
+
+    if {[ regexp "ARMv7 ScorpionMP" $arch ] == 1 } {  # arm/armv7-scorpionmp
+        return  1
+    }
+
+    if {[ regexp "ARMv7 Scorpion" $arch ] == 1 } {  # arm/armv7-scorpion
+        return  1
+    }
+
+    if {[ regexp "ARM Cortex-A5" $arch ] == 1 } {  # arm/armv7-ca5
+        return  1
+    }
+
+
+    ## IBM
+    if {[ regexp "IBM System z10" $arch ] == 1 } {  # s390/z10
+        return  1
+    }
+
+    if {[ regexp "IBM zEnterprise z196" $arch ] == 1 } {  # s390/z196
+        return  1
+    }
+
+    if {[ regexp "IBM zEnterprise EC12" $arch ] == 1 } {  # s390/zEC12
+        return  1
+    }
+
+    return 0
+}
diff --git a/testsuite/oprofile-ocount/ocount-run.exp b/testsuite/oprofile-ocount/ocount-run.exp
index 9c75fda..4e8b484 100644
--- a/testsuite/oprofile-ocount/ocount-run.exp
+++ b/testsuite/oprofile-ocount/ocount-run.exp
 <at>  <at>  -157,6 +157,22  <at>  <at>  proc do_test_ocount_scaling {workload_exec} {
 proc do_test_ocount_modes {workload_exec} {
     global ocount_version

+    # The test assumes the architecture supports counting in user and 
+    # kernel modes unless the architecture is explicitly listed in function
+    # arch_does_not_support_exclusive_mode_settings{}.
+
+    # This test counts the events that occur in user mode, then for kernel
+    # mode.  The test then counts the number of events when both modes are
+    # selected.  The count with both modes selected is then compared to the
+    # sum of the counts when each mode was counted individually to see if
+    # they agree.  
+    if {[arch_does_not_support_exclusive_mode_settings] == 1} {
+        send "\nNote: Architecture is in list of architectures that"
+        send " do not support User mode and Kernel\n"
+        send "mode selection.  Skipping mode scaling tests.  \n\n"
+        return 
+    }
+
     # The actual result is expected to be within the following percent of the
     # actual count
     set percent 5
--

-- 
1.7.1

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
William Cohen | 18 Dec 18:20 2014
Picon

Questionable array size check in operf_counter.cpp

I ran the oprofile currently in the git resository through coverity to see if there were any issues in the
code.  One thing that did look questionable was:

	Error: BAD_SIZEOF (CWE-467): [#def3]
oprofile-1.1.0git/libperf_events/operf_counter.cpp:772: bad_sizeof: The expression "sizeof
(this->poll_data) / sizeof (this->poll_data[0])" is suspicious. Note that "this->poll_data" is a
pointer and therefore the division will not return the number of array elements which may have been the intent.

The method making a larger size array and copying the data over. It is attempting to get the size of the array with:

	num_mmaps = sizeof(poll_data)/sizeof(poll_data[0]);

It appears this was added in commit eb75586eed1d105a22b12d879a31ec32d6a94913

It looks like the class should have the information about the size of poll_data in there. Should the
operf_record class include a num_mmaps field so the size of poll_data is known? Or could the some other
field (such as poll_count) be used to track that information?

-Will

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk

Gmane