From: Robert R. <rob...@am...> - 2009-08-12 15:54:09
|
I figured out that there is no way to reset setup parameters. The only way was removing the setup file in /root/.oprofile/daemonrc. So I added the defaults option that removes the file. If there is no setup file the default values will be set. The option can be combined with other setup options such as: opcontrol --defaults --no-vmlinux --buffer-size=640000 This resets all values to default except buffer size and vmlinux. Signed-off-by: Robert Richter <rob...@am...> --- ChangeLog | 6 ++++++ doc/opcontrol.1.in | 5 +++++ doc/oprofile.xml | 7 +++++++ utils/opcontrol | 13 +++++++++++++ 4 files changed, 31 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fe6e5e..984e936 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-08-11 Robert Richter <rob...@am...> + * doc/opcontrol.1.in: + * doc/oprofile.xml: + * utils/opcontrol: adding --defaults option + +2009-08-11 Robert Richter <rob...@am...> + * agents/Makefile.am: * configure.in: adding config option to disable oprofile user check diff --git a/doc/opcontrol.1.in b/doc/opcontrol.1.in index b9cf61e..8b68746 100644 --- a/doc/opcontrol.1.in +++ b/doc/opcontrol.1.in @@ -41,6 +41,11 @@ in ~root/.oprofile/daemonrc. Optional. Show configuration information. .br .TP +.BI "--defaults" +Reset setup values to defaults. Can be combined with the --setup +option. +.br +.TP .BI "--start-daemon" Start the oprofile daemon without starting profiling. Not available in 2.2/2.4 kernels. diff --git a/doc/oprofile.xml b/doc/oprofile.xml index 35ba48a..1a06bcd 100644 --- a/doc/oprofile.xml +++ b/doc/oprofile.xml @@ -567,6 +567,13 @@ The <command>opcontrol</command> script provides the following actions : </para></listitem> </varlistentry> <varlistentry> + <term><option>--defaults</option></term> + <listitem><para> + Reset setup values to defaults. Can be combined + with the <option>--setup</option> option. + </para></listitem> + </varlistentry> + <varlistentry> <term><option>--status</option></term> <listitem><para> Show configuration information. diff --git a/utils/opcontrol b/utils/opcontrol index 6d1bfc0..0ada540 100644 --- a/utils/opcontrol +++ b/utils/opcontrol @@ -113,6 +113,7 @@ opcontrol: usage: -v/--version show version --init loads the oprofile module and oprofilefs --setup give setup arguments (may be omitted) + --defaults reset setup values to defaults --status show configuration --start-daemon start daemon without starting profiling -s/--start start data collection @@ -241,6 +242,9 @@ do_init_daemon_vars() if test -n "$SESSION_DIR"; then SAVED=$SESSION_DIR fi + if test "$DEFAULTS" = "yes"; then + rm -f "$SETUP_FILE" + fi do_load_setup if test -n "$SAVED"; then SESSION_DIR=$SAVED @@ -665,6 +669,11 @@ do_options() SETUP=yes ;; + --defaults) + # also early option code existing + DO_SETUP=yes + ;; + --start-daemon) if test "$KERNEL_SUPPORT" != "yes"; then echo "$arg unsupported. use \"--start\"" >&2 @@ -1759,6 +1768,7 @@ check_options_early() OPHELP="$OPDIR/ophelp" VERBOSE="" + DEFAULTS=no for i in $@; do # added to handle arg=val parameters @@ -1782,6 +1792,9 @@ check_options_early() VERBOSE=$val fi ;; + --defaults) + DEFAULTS=yes + ;; --session-dir) error_if_empty $arg $val SESSION_DIR="$val" -- 1.6.4 |