Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
s390-tools.17667
s390-tools-sles15sp2-lscpumf-Show-raw-event-num...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File s390-tools-sles15sp2-lscpumf-Show-raw-event-numbers-correctly.patch of Package s390-tools.17667
Subject: [PATCH] [BZ 187827] s390-tools: lscpumf adjust output for raw event number From: Thomas Richter <tmricht@linux.ibm.com> Description: s390-tools: lscpumf adjust output for raw event number Symptom: Output of command lscpumf -c displays the raw counter always with a starting rXXX with XXX being a hex number. Problem: This raw counter number is not valid when the PMU measurement facility device driver has been registered with a different type number than PERF_TYPE_RAW(4). In this case the raw event number is <type>:DDD with DDD being a decimal number. To find out with PMU type number has been assigned to the PMU Measurement facility device driver, type command cat /sys/devices/cpum_cf/type (for counters) cat /sys/devices/cpum_cf/type (for sampling) Solution: Read out the PMU type numbers assigned by the linux kernel and output corresponding raw event format. Reproduction: Run command lscpumf -c Raw counter number should be displayed as rXXX with XXX being hexdecimal number or Y:ZZZ with Y and ZZZ being decimal numbers. Upstream-ID: - Problem-ID: 187827 Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> --- cpumf/bin/lscpumf.in | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) --- a/cpumf/bin/lscpumf.in +++ b/cpumf/bin/lscpumf.in @@ -266,15 +266,15 @@ sub find_ctr265name() return "DFLT_CCFINISH"; } -sub print_counters($$) +sub print_counters($$$) { - my ($ctrdef, $header) = @_; + my ($type, $ctrdef, $header) = @_; my $set_name_map = invoke_cpumf_helper('--ctr-set-names'); my $out = []; my ($ctr_perf, $ctr_num, $set, $name, $desc); format PERF_CTR_FORM = -r@<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +@<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $ctr_perf, $name ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @@ -288,7 +288,11 @@ $ctr_perf, $name print $header; $~ = "PERF_CTR_FORM"; foreach my $ctr (sort { $a <=> $b } keys %$ctrdef) { - $ctr_perf = sprintf "%x", $ctr; + if ($type eq "r" or $type eq "4") { + $ctr_perf = sprintf "r%x", $ctr; + } else { + $ctr_perf = sprintf "$type:%d", $ctr; + } $ctr_num = $ctr < (1 << 16) ? $ctr : ""; if ($ctr == 265) { $name = find_ctr265name(); @@ -309,6 +313,17 @@ $ctr_perf, $name } } +sub get_cpumf_type($) +{ + my $f = shift(); + + open my $fh, '<', $f or die "Can't open file $!"; + read $fh, my $file_content, -s $fh; + close $fh; + chomp($file_content); + return "$file_content"; +} + sub do_show_ctr($;$) { my $c = shift(); @@ -329,6 +344,9 @@ sub do_show_ctr($;$) return 3; } + # Retrieve cpumf type + my $cf_type = get_cpumf_type("/sys/devices/cpum_cf/type"); + # Retrieve hardware type my $hwtype = invoke_cpumf_helper("--hardware-type"); my $model = length $hwtype->[1] ? "for $hwtype->[1]" : ""; @@ -337,10 +355,10 @@ Perf event counter list $model ============================================================================== Raw -event Name Description +event Name Description ------------------------------------------------------------------------------ EoHeader - print_counters($ctrs, $header); + print_counters($cf_type, $ctrs, $header); return 0; } @@ -366,16 +384,19 @@ sub do_show_sf_events($) return 3; } + # Retrieve cpumf type + my $sf_type = get_cpumf_type("/sys/devices/cpum_sf/type"); + # Display sampling facility events (aka. counters) my $header = <<"EoHeader"; Perf events for activating the sampling facility ============================================================================== Raw -event Name Description +event Name Description ------------------------------------------------------------------------------ EoHeader - print_counters($events, $header); + print_counters($sf_type, $events, $header); return 0; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor