Add a global "enable_stats_header" tunable parameter that can be
set to enable/disable the "start_time" and "elapsed_time" fields
in the standard lprocfs "stats" files.
Default to enabled, since this landed shortly after v2_14_0.
Test-Parameters: trivial
Fixes:
5efb892396e3 ("LU-11407 obdclass: add start time to stats files")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I460b957447bfb83e6d4fd7395b79ce994f3ebbe5
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51823
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
Reviewed-by: Nathaniel Clark <nclark@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
extern void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
ktime_t ts_init, int width, const char *colon,
bool show_units, const char *prefix);
extern void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
ktime_t ts_init, int width, const char *colon,
bool show_units, const char *prefix);
+extern unsigned int obd_enable_stats_header;
/* Generic callbacks */
extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
/* Generic callbacks */
extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
+/* enable start/elapsed_time in stats headers by default */
+unsigned int obd_enable_stats_header = 1;
+
static int lprocfs_no_percpu_stats = 0;
module_param(lprocfs_no_percpu_stats, int, 0644);
MODULE_PARM_DESC(lprocfs_no_percpu_stats, "Do not alloc percpu data for lprocfs stats");
static int lprocfs_no_percpu_stats = 0;
module_param(lprocfs_no_percpu_stats, int, 0644);
MODULE_PARM_DESC(lprocfs_no_percpu_stats, "Do not alloc percpu data for lprocfs stats");
seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
(s64)ts.tv_sec, ts.tv_nsec, units);
seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
(s64)ts.tv_sec, ts.tv_nsec, units);
+ if (!obd_enable_stats_header)
+ return;
+
field = (colon && colon[0]) ? "start_time:" : "start_time";
ts = ktime_to_timespec64(ts_init);
seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
field = (colon && colon[0]) ? "start_time:" : "start_time";
ts = ktime_to_timespec64(ts_init);
seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
LUSTRE_STATIC_UINT_ATTR(at_extra, &at_extra);
LUSTRE_STATIC_UINT_ATTR(at_early_margin, &at_early_margin);
LUSTRE_STATIC_UINT_ATTR(at_history, &at_history);
LUSTRE_STATIC_UINT_ATTR(at_extra, &at_extra);
LUSTRE_STATIC_UINT_ATTR(at_early_margin, &at_early_margin);
LUSTRE_STATIC_UINT_ATTR(at_history, &at_history);
+LUSTRE_STATIC_UINT_ATTR(enable_stats_header, &obd_enable_stats_header);
LUSTRE_STATIC_UINT_ATTR(lbug_on_eviction, &obd_lbug_on_eviction);
LUSTRE_STATIC_UINT_ATTR(ping_interval, &ping_interval);
LUSTRE_STATIC_UINT_ATTR(evict_multiplier, &ping_evict_timeout_multiplier);
LUSTRE_STATIC_UINT_ATTR(lbug_on_eviction, &obd_lbug_on_eviction);
LUSTRE_STATIC_UINT_ATTR(ping_interval, &ping_interval);
LUSTRE_STATIC_UINT_ATTR(evict_multiplier, &ping_evict_timeout_multiplier);
static struct attribute *lustre_attrs[] = {
&lustre_attr_version.attr,
&lustre_attr_pinger.attr,
static struct attribute *lustre_attrs[] = {
&lustre_attr_version.attr,
&lustre_attr_pinger.attr,
+ &lustre_sattr_enable_stats_header.u.attr,
&lustre_attr_health_check.attr,
&lustre_attr_jobid_name.attr,
&lustre_attr_jobid_var.attr,
&lustre_attr_health_check.attr,
&lustre_attr_jobid_name.attr,
&lustre_attr_jobid_var.attr,
local name count samp unit min max sum sumsq
local tmpfile=$TMP/$tfile.tmp
local name count samp unit min max sum sumsq
local tmpfile=$TMP/$tfile.tmp
+ # enable stats header if it is disabled
+ $LCTL set_param enable_stats_header=1
+
$LFS setstripe -i 0 -c 1 $DIR/$tfile || error "setstripe failed"
echo "stats before reset"
stack_trap "rm -f $tmpfile"
$LFS setstripe -i 0 -c 1 $DIR/$tfile || error "setstripe failed"
echo "stats before reset"
stack_trap "rm -f $tmpfile"