From: Maynard J. <may...@us...> - 2011-11-02 17:08:20
|
Andreas Krebbel wrote: > This patch makes use of the event mechanism to allow for dynamic > enabling and disabling of the System z hardware sampling facility with > the OProfile user space tools. [snip] > +# Various checks related to Hardware sampler option > +check_platform_args() > +{ > + case "$CPUTYPE" in > + s390x/basic_mode_sampling_v1) > + if test "$S390_HW_SAMPLER_RATE" == "0"; then > + return > + fi > + if test -r $MOUNT/hwsampling/hw_min_interval; then > + min_interval=`cat $MOUNT/hwsampling/hw_min_interval` > + fi > + if test -r $MOUNT/hwsampling/hw_max_interval; then > + max_interval=`cat $MOUNT/hwsampling/hw_max_interval` > + fi > + I forgot to mention this in my previous response to your patch . . . but if either of the above tests fail and you don't get min_interval or max_interval set, then the below test makes no sense and will fail. -Maynard > + if test "$S390_HW_SAMPLER_RATE" -lt "$min_interval" -o \ > + "$S390_HW_SAMPLER_RATE" -gt "$max_interval"; then > + echo "Invalid value for hardware sampling rate" >&2 > + echo "should be between $min_interval and $max_interval" >&2 > + exit 1 > + fi > + ;; > + *) > + ;; > + esac > +} > > check_valid_args() > { > @@ -971,6 +1018,19 @@ do_options() > exec $OPHELP > ;; > > + --s390hwsamprate) > + error_if_not_number "$arg" "$val" > + S390_HW_SAMPLER_RATE=$val > + DO_SETUP=yes > + ;; > + > + --s390hwsampbufsize) > + error_if_not_number "$arg" "$val" > + S390_HW_SAMPLER_BUFSIZE=$val > + DO_SETUP=yes > + ;; > + > + > *) > echo "Unknown option \"$arg\". See opcontrol --help" >&2 > exit 1 > @@ -1418,6 +1478,15 @@ do_param_setup() > return > fi > > + if test "$S390_HW_SAMPLER" == "1"; then > + if test "$S390_HW_SAMPLER_RATE" != "0"; then > + echo $S390_HW_SAMPLER_RATE >$MOUNT/hwsampling/hw_interval > + fi > + if test "$S390_HW_SAMPLER_BUFSIZE" != "0"; then > + echo $S390_HW_SAMPLER_BUFSIZE >$MOUNT/hwsampling/hw_sdbt_blocks > + fi > + fi > + > # use the default setup if none set > if test "$NR_CHOSEN" = 0; then > set_event 0 $DEFAULT_EVENT > @@ -1701,6 +1770,20 @@ do_status() > echo "CPU buffer size: $CPU_BUF_SIZE" > fi > fi > + if test "$S390_HW_SAMPLER" == "1"; then > + echo -n "System z hardware sampling rate in cycles: " > + if test "$S390_HW_SAMPLER_RATE" == "0"; then > + cat $MOUNT/hwsampling/hw_interval > + else > + echo "$S390_HW_SAMPLER_RATE" > + fi > + echo -n "System z hardware sampling buffer size (in 2MB areas): " > + if test "$S390_HW_SAMPLER_BUFSIZE" == "0"; then > + cat $MOUNT/hwsampling/hw_sdbt_blocks > + else > + echo "$S390_HW_SAMPLER_BUFSIZE" > + fi > + fi > > exit 0 > } > @@ -1855,6 +1938,7 @@ do_operations() > fi > > if test "$SETUP" = "yes"; then > + check_platform_args > check_valid_args > do_save_setup > fi > --- a/utils/ophelp.c > +++ b/utils/ophelp.c > @@ -731,6 +731,10 @@ int main(int argc, char const * argv[]) > "Chapter 6: Performance Counters\n" > "http://www.atmel.com/dyn/resources/prod_documents/doc32000.pdf\n"; > > + case CPU_S390_HWSAMPV1: > + event_doc = "IBM System z Basic Mode Sampling\n"; > + break; > + > case CPU_RTC: > break; > > > ------------------------------------------------------------------------------ > RSA® Conference 2012 > Save $700 by Nov 18 > Register now! > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > oprofile-list mailing list > opr...@li... > https://lists.sourceforge.net/lists/listinfo/oprofile-list > |